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.
We must import Map from react-leaflet (along with some other packages that we'll utilize later), and we'll return it from our App component: import React, {useState} from "react"; import { MapContainer, TileLayer, Marker, Popup } from 'react-leaflet'; import './App.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With