Agontuk / react-native-geolocation-service

React native geolocation service for iOS and android
https://www.npmjs.com/package/react-native-geolocation-service
MIT License
1.61k stars 292 forks source link

Not abe to use successCallback in Geolocation.getCurrentPosition #260

Closed ppv94 closed 3 years ago

ppv94 commented 3 years ago

I am using the latest version of react-native-geolocation-service in my project.

My Versions

"react": "16.13.1", "react-native": "0.63.4", "react-native-geolocation-service": "^5.2.0",

My Code This Works fine I am able to get the current location.

Geolocation.getCurrentPosition( position => { console.log(position) }, error => { console.log(error) }, {showLocationDialog: true,enableHighAccuracy: true,timeout: 20000,maximumAge: 30000} );

But when I try to use successCallback it does not work.

Geolocation.getCurrentPosition( position => { console.log(position) }, successCallback => { console.log(successCallback) }, error => { console.log(error) }, {showLocationDialog: true,enableHighAccuracy: true,timeout: 20000,maximumAge: 30000} );

How to use the successCallback after the current position is retrived.

yestay90 commented 3 years ago

@ppv94 In my case I am not able to run callback on iPhone 8, but can run it on Iphone 11. I think it is hardware related issue.

Agontuk commented 3 years ago

First example is the correct implementation, please read documentation and see how many parameter you can pass.