My code has, in the React.createClass() call:
watchID: (null: ?number),
componentDidMount: function() {
navigator.geolocation.getCurrentPosition(
(initialPosition) => this.setState({initialPosition}),
(error) => console.error(error),
(position) => this.setState({position}),
{enableHighAccuracy: false, timeout: 20000, maximumAge: 60 * 60 * 1000});
this.watchID = navigator.geolocation.watchPosition((lastPosition) =>
this.setState({lastPosition}));
},
This is generating the error message Argument 0 (RCTLocationOptions of RCTLocationObserver.getCurrentPosition must not be null
.
Is there a problem with the initialPosition arrow function? Also, how can I replace the initialPosition argument with an appropriate anonymous function that will set the initial position to both the initial and last position (being both the initial and the last position), and call a this.fetchData()
?
(Feel free to explain anything I'm missing about arrow functions...)
Thanks,