2

I have to develop apps with React Native for mobile that concern with mapping and found out there are two libraries for Native on this - react-native-mapbox-gl and react-native-maps. From github pages and tutorials I see no big difference on what they can achieve. I can't decide which one to choose and can't afford to change later because one does not meet what I need. What I want the apps to do is to:

  • show markers and routes
  • work great with GeoJson and PostGIS
  • better performance on both Android and iOS

Which one would have advantage over another?

  • What do you mean by work great with GeoJSON... can you elaborate in your question. – nmtoken Jul 28 '18 at 19:09
  • Ease of parsing GeoJSON data... like in Leaflet... I believe they have this as a basic feature... – user8703143 Jul 29 '18 at 7:14
2

I have done an app with react-native-maps and haven't used mapbox one. If you need to have a larger number of markers displayed at once it's tricky to get there (you'd have to fork the repository and change something in the Android/iOS parts of the codebase).

There should be no issues displaying 50 markers on the map but the CPU explodes (that's I guess one of the reasons why AirBnB in their app does not have many markers and limits the number when you look at a small region with hundreds of locations).

Given that mapbox seems to be more low level I guess there would be no issues with that.

1

If you are using Create-React-Native-App (Expo) to kick off your project, react-native-map is already included... I've done a bunch of Leaflet and Django work in the past, I found it pretty straight-forward to get going with this approach.

Adding Mapbox to Expo is "In Progress" https://expo.canny.io/feature-requests/p/add-mapbox-gl-support

I find the documentation for react-native-maps to be more example based (easier to understand) where as the Mapbox docs are API definition driven. Good, but not as approachable for those new to React-Native their library.

They will both work with GeoJson, no worries.

1

To complement on the answers:

react-native-mapbox-gl is a lot more feature complete, for sure. but there is a huge catch: you'll need to eject your project.

If you are comfortable working with a much different workflow then what expo gives you, then eject it and go the react-native-mapbox-gl route.

I'm not a mobile developer at all and I suffered a lot to get it working on a toy project.

If your application is simple, I'm sure the regular react-native-maps will work just fine. The velocity you gain from expo cannot be compared with maintaining a much more complex project, just to use mapbox-gl. If you require, of course, change, but if not, don't.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.