Fix bugs when adding activity
This commit is contained in:
@@ -66,11 +66,8 @@ export class Home extends React.Component {
|
||||
results[PermissionsAndroid.PERMISSIONS.ACCESS_FINE_LOCATION] ===
|
||||
PermissionsAndroid.RESULTS.GRANTED
|
||||
) {
|
||||
this.watchId = navigator.geolocation.watchPosition(
|
||||
this.handlePositionChange,
|
||||
null,
|
||||
{ distanceFilter: 10 }
|
||||
)
|
||||
this.setState({ haveLocationPermission: true })
|
||||
navigator.geolocation.getCurrentPosition(this.handlePositionChange)
|
||||
}
|
||||
|
||||
if (
|
||||
@@ -250,9 +247,18 @@ export class Home extends React.Component {
|
||||
positionInfo,
|
||||
messageModal,
|
||||
haveCameraPermission,
|
||||
haveLocationPermission,
|
||||
workItemDistance,
|
||||
} = this.state
|
||||
|
||||
if (!this.watchId && haveLocationPermission) {
|
||||
this.watchId = navigator.geolocation.watchPosition(
|
||||
this.handlePositionChange,
|
||||
null,
|
||||
{ distanceFilter: 10 }
|
||||
)
|
||||
}
|
||||
|
||||
return (
|
||||
<View
|
||||
style={{
|
||||
@@ -268,7 +274,9 @@ export class Home extends React.Component {
|
||||
!(
|
||||
positionInfo &&
|
||||
positionInfo.coords.accuracy <= config.minGPSAccuracy
|
||||
) || !haveCameraPermission
|
||||
) ||
|
||||
!haveCameraPermission ||
|
||||
!haveLocationPermission
|
||||
}
|
||||
/>
|
||||
<MapView
|
||||
|
||||
Reference in New Issue
Block a user