如何将 Leaflet.js 与 react-native 一起使用

How to use leaflet.js with react-native(如何将 Leaflet.js 与 react-native 一起使用)
本文介绍了如何将 Leaflet.js 与 react-native 一起使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我很难用 react-native 设置 Leaflet.js.文档告诉我在我的 html 中添加以下脚本...

I am having a difficult time setting up Leaflet.js with react-native. The documentation tells me to add the following script in my html...

<script src="https://unpkg.com/leaflet@1.0.1/dist/leaflet.js"></script>

但我不确定我是如何使用 react 来做到这一点的.现在我的主页呈现如下...

But I am not sure how I do this using react. Right now my main page is being rendered as follows...

AppRegistry.registerComponent('beacon', () => Home);

而我的 Home 就是...

export default Home = () => {
    return (
        <Provider store={store}>
            <MainMap />
        </Provider>
    );
}

在哪里/如何添加此脚本标记以包含 Leaflet.js?甚至可能吗?是否有其他解决方案?

Where/How do I add this script tag to include Leaflet.js? Is it even possible? Is there perhaps another solution?

我还没有看到任何 react-nativeLeaflet.js 的示例,如果有的话,在 github 上或其他什么地方,我很乐意看看吧.

I haven't seen any examples of react-native and Leaflet.js, if there is one, on github or what not, I'd be happy to see it.

推荐答案

有个项目react-leaflet 通过它你可以使用leaflet.js 和react.

There is a project react-leaflet through which you can use leaflet.js with react.

但目前 不支持 在 react-native 中使用 leaflet.js.有关详细信息,请参阅此问题.

But currently there is no support for using leaflet.js in react-native. See this issue for more info.

这篇关于如何将 Leaflet.js 与 react-native 一起使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

Why local notification is not firing for UNCalendarNotificationTrigger(为什么没有为UNCalendarNotificationTrigger触发本地通知)
iOS VoiceOver functionality changes with Bundle Identifier(IOS画外音功能随捆绑包标识符而变化)
tabbar middle tab out of tabbar corner(选项卡栏中间的选项卡角外)
Pushing UIViewController above UITabBar(将UIView控制器推送到UITabBar上方)
Dropbox Files.download does not start when number of files in folder is gt; 1000(当文件夹中的文件数为1000时,Dropbox Files.Download不会启动)
How to target newer versions in .gitlab-ci.yml using auto devops (java 11 instead of 8 and Android 31 instead of 29)(如何在.gitlab-ci.yml中使用自动开发工具(Java 11而不是8,Android 31而不是29)瞄准较新的版本)