如何使用leaflet.js与react-native

时间:2016-11-02 03:11:58

标签: android react-native leaflet

我很难用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-nativeLeaflet.js的任何例子,如果有的话,在github或者什么不是,我很乐意看到它。

3 个答案:

答案 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