How to use leaflet.js with react-native

advertisements

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/[email protected]/dist/leaflet.js"></script>

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);

And my Home is simply something like...

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

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

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.


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

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