DEV Community

Pierre
Pierre

Posted on

How can I integrate Leaflet to React Native

Hi,
I am very new with React Native. I built a smartphone app with Cordova but I want to migrate to Reat Native. My App use and need Leaftlet and Chartjs and I need to find a way to use those feature with my new Reat Native 7.6 and Expo App.

I investigated one full days trying different npm with React Native Leaflet but it looks like have been done for the 7.3 version or older, or I simply could not implement it due to my lake of practice with React Native.

I will appreciate if you could share your expertise with Leaftlet for React Native 7.6.

  1. I found the React-leaflet npm. Is it compatible with React Native? or it's only built for React?

  2. Would it possible to "inject" my javascript script, I developed for my web app. My Idea is to use my Javascript script I developped for my Cordova App (instead of the web app, even if it's very similar) and import is to React Native with some adaptaption. In that case, I would not need a npm.

My I create a map.js and include the leaflet js library and "duplicate" my cordova javascript script?

  1. Do you have any experience with leaftlet and React Native 7.6?

Note: I would like to use OpenStreetMap instead of Google and Apple Map.

Many thanks for any help and I wish you a nice day
Cheers

Top comments (1)

Collapse
 
pierrot10 profile image
Pierre • Edited

Hi, AĂŻe. it looks like react-leaflet can not be used with React Native.

But then how could I imoort the leaflet javascript library?