homeeondemand / react-native-mapbox-navigation

A navigation UI ready to drop into your React Native application
MIT License
162 stars 123 forks source link

Question on best practices for passing lat/long props... #26

Closed adhendo closed 3 years ago

adhendo commented 3 years ago

Hello all, I was just wondering how everyone is using this library in their application and how they are handling the passing of the origin and destination props. Right now we are using react-native-geolocation-service with enableHighAccuracy set to true for the origin prop to get the users current location. What is everyone else using for this?

Also how is everyone passing in the lat/long array to this package? Passing in an object and converting it into an array? Directly passing in an array of the lat/long?

Thanks this would be a huge help!!

bachhuberdesign commented 3 years ago

@adhendo We are also using react-native-geolocation-service in conjunction with this library and default to enableHighAccuracy: true. We previously used @mauron85/react-native-background-geolocation, but react-native-geolocation-service seems to be working out better for us.

Origin and destination should be passed in as an array with longitude first (all of MapBox, including API calls, require longitude before latitude), i.e.

origin={[location.lng, location.lat]}
destination={[jobDestination.lng, jobDestination.lat]}
adhendo commented 3 years ago

@bachhuberdesign Hey thanks for the response! Just wanted to say I've also been trying out (https://www.npmjs.com/package/expo-location) even though I'm not really using expo and it seems to be working just as good as react-native-geolocation-service with a slightly simpler interface. Haven't noticed a difference yet and I'm using the accuracy set to best for navigation.