react-native-maps-navigation icon indicating copy to clipboard operation
react-native-maps-navigation copied to clipboard

Unable to use it in my project

Open sravanpronteff opened this issue 4 years ago • 0 comments

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}) } /> </MapView>

sravanpronteff avatar Oct 13 '21 10:10 sravanpronteff