我很难用Leaflet.js
设置react-native
。文档告诉我在我的html中添加以下脚本......
<script src="https://unpkg.com/leaflet@1.0.1/dist/leaflet.js"></script>
但我不确定我是如何使用反应做的。现在我的主页面呈现如下......
AppRegistry.registerComponent('beacon', () => Home);
我的Home
简直就是......
export default Home = () => {
return (
<Provider store={store}>
<MainMap />
</Provider>
);
}
在哪里/如何添加此脚本标记以包含Leaflet.js
?它甚至可能吗?还有其他解决办法吗?
我还没有看到react-native
和Leaflet.js
的任何例子,如果有的话,在github或者什么不是,我很乐意看到它。
答案 0 :(得分:10)
有一个项目react-leaflet,你可以通过它来反复使用leaflet.js。
但目前在react-native中使用leaflet.js有无支持。有关详细信息,请参阅此issue。
答案 1 :(得分:2)
请查看本地
推荐的react-native-maps答案 2 :(得分:2)
我在网上找到一个项目,该项目用React Native解决了传单:https://github.com/reggie3/react-native-webview-leaflet