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

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

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

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

而我的Home只不过是...

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

在何处/如何添加此脚本标记以包含Leaflet.js?有可能吗?也许还有别的解决办法吗?

我还没有在github上看到任何react-nativeLeaflet.js的例子,如果有的话,我很乐意看到.

推荐答案

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

但目前使用传单的有no support种.js在react native中.更多信息,请参见此issue.

React-native相关问答推荐

useState 函数似乎阻止了 Animated.timing 事件?

React Native Android:how to remove "overscroll effect" of ScrollView

React Native:在 ScrollView contentContainerStyle 上设置 flex:1 会导致组件重叠

最近 react-native 版本中的Unable to resolve moduledebuggerWorker 错误

React-native 组件的 elevation样式导致的阴影

React-Native 应用程序的 Jest 测试 Animated.View

react-native:如何在离线模式下在模拟器上运行应用程序?

通过带有对象子对象的数组react native 映射 - 与react网络中的工作方式不同?

在本react-native中具有异步和等待的箭头函数

react-native 自动完成文本输入

Unexpected token on "export default const"

在 OPTIONS 响应后使 fetch API 与 CORS 一起工作

使用 React Native 运行多个 iOS 模拟器?

React Native 模块中的依赖注入

运行 expo start 时如何禁用在浏览器中打开 DevTools?

如何设置样式属性以填充剩余空间?

React Native font outline / textShadow

为什么 this.state 在react-native中未定义?

如何在react-native中验证 TextInput 值?

在 React Native 中,两个等宽的按钮水平填充屏幕