react-native: Geolocation can not watch the position.

Geolocation can not watch the position. It only updates when you go to homescreen and reopen the app. To recreate this problem, just use the example on React Native docs: http://facebook.github.io/react-native/releases/0.31/docs/geolocation.html#watchposition

componentDidMount(){
  this.watchID = navigator.geolocation.watchPosition((position) => {
      var lastPosition = JSON.stringify(position);
      this.setState({lastPosition});
    });
}

Using React Native version 0.31.0 & 0.30.0 on iOS.

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 19 (2 by maintainers)

Most upvoted comments

Closing for now. Please re-open if this problem is still here!

I have the same problem which @briangainer has. @ericvicenti I think this issue should be opened.