-
Notifications
You must be signed in to change notification settings - Fork 24.8k
Closed
Labels
StaleThere has been a lack of activity on this issue and it may be closed soon.There has been a lack of activity on this issue and it may be closed soon.
Description
Is this a bug report?
Yes
Environment
OS: macOS Sierra 10.13.1
Node: 8.9.1
Yarn: 0.21.3
npm: 5.5.1
Xcode: Xcode 9.1 Build version 9B55
react-native: 0.50.3
react: 16.0.0
Test device: Simulator iPhone6s / iOS11
Steps to Reproduce
-
create a pure app with command: react-init geoTest
-
Setup the app as following: include NSLocationAlwaysUsageDescription and NSLocationWhenInUseUsageDescription in the info.plist, add location as a background mode in the 'Capabilities' tab in Xcode
-
Add code as below:
componentDidMount() {
navigator.geolocation.getCurrentPosition(
(position) => {
console.log("position.coords: ", position.coords);
},
(error) => this.setState({ error: error.message }),
{ enableHighAccuracy: true, useSignificantChanges: true, distanceFilter:10, timeout: 20000, maximumAge: 1000 },
);
}
Below error message show up:
TypeError: Cannot read property 'geolocation' of undefined
Metadata
Metadata
Assignees
Labels
StaleThere has been a lack of activity on this issue and it may be closed soon.There has been a lack of activity on this issue and it may be closed soon.