flyandi / react-native-maps-navigation

Enables custom navigation in react-native-maps
134 stars 54 forks source link

Unable to use it in my project #21

Open sravanpronteff opened 3 years ago

sravanpronteff commented 3 years ago

undefined is not an object (evaluating 'navigator.geolocation.watchPosition')

This error is located at: in MapViewNavigation (at App.js:139) in AIRMap (at MapView.js:1056) in MapView (at App.js:125) in RCTView (at View.js:32) in View (at ScrollView.js:1674) in RCTScrollView (at ScrollView.js:1792) in ScrollView (at ScrollView.js:1818) in ScrollView (at App.js:102) in RCTView (at View.js:32) in View (at SafeAreaView.js:41) in SafeAreaView (at App.js:100) in App (at renderApplication.js:50) in RCTView (at View.js:32) in View (at AppContainer.js:92) in RCTView (at View.js:32) in View (at AppContainer.js:119) in AppContainer (at renderApplication.js:43) in DirectionsNative(RootComponent) (at renderApplication.js:60) ERROR TypeError: undefined is not an object (evaluating 'navigator.geolocation.watchPosition')

Here is my code

<MapView ref={refMap} provider={PROVIDER_GOOGLE} style={{ flex: 1, height: ht, width: wd, }} initialRegion={{ latitude: 37.78825, longitude: -122.4324, latitudeDelta: 0.0922, longitudeDelta: 0.0421, }}> <MapViewNavigation origin={origin} destination={destination} navigationMode={navigationMode} travelMode={travelMode} ref={refNavigation} map={refMap} apiKey={"GOOGLE_API_KEY"} // placed my own key here and even in manifest.xml file in android simulate={true} onRouteChange={route => setRoute(route)} onStepChange={(step, nextStep) => { // this.setState({step, nextStep}) setStep(step); setNextStep(nextStep); }} displayDebugMarkers={true} onNavigationStarted={route => console.log('Navigation Started')} onNavigationCompleted={ route => setIsNavigation(false) // this.setState({isNavigation: false}) } />