How to use leaflet.js with 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-native
和 Leaflet.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 一起使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何将 Leaflet.js 与 react-native 一起使用


基础教程推荐
- NSString intValue 不能用于检索电话号码 2022-01-01
- Cocos2d iPhone 非矩形精灵触摸检测 2022-01-01
- 通过重定向链接在 Google Play 中打开应用 2022-01-01
- libGDX 从精灵或纹理中获取像素颜色 2022-01-01
- AdMob 广告未在模拟器中显示 2022-01-01
- iOS4 创建后台定时器 2022-01-01
- 如何从 logcat 中删除旧数据? 2022-01-01
- iPhone - 获取给定地点/时区的当前日期和时间并将其与同一地点的另一个日期/时间进行比较的正确方法 2022-01-01
- Android:getLastKnownLocation(LocationManager.NETWORK_PROVIDER 2022-01-01
- navigator.geolocation.getCurrentPosition 在 Android 浏览器上 2022-01-01