Skip to content

Commit aef83fa

Browse files
committed
Only perform these changes on Android (use an if-then)
1 parent ab52d5f commit aef83fa

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

source/views/help/wifi-tools.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import deviceInfo from 'react-native-device-info'
44
import networkInfo from 'react-native-network-info'
5+
import {Platform} from 'react-native'
56
import pkg from '../../../package.json'
67

78
export const getIpAddress = (): Promise<?string> =>
@@ -13,9 +14,18 @@ export const getIpAddress = (): Promise<?string> =>
1314
}
1415
})
1516

16-
export const getPosition = (): Promise<Object> =>
17+
export const getPosition = (args: any = {}): Promise<Object> =>
1718
new Promise((resolve, reject) => {
18-
navigator.geolocation.getCurrentPosition(resolve, reject)
19+
if(Platform.OS === 'ios') {
20+
navigator.geolocation.getCurrentPosition(resolve, reject, {
21+
...args,
22+
enableHighAccuracy: true,
23+
maximumAge: 1000 /* ms */,
24+
timeout: 5000 /* ms */,
25+
})
26+
} else {
27+
navigator.geolocation.getCurrentPosition(resolve, reject)
28+
}
1929
})
2030

2131
export const collectData = async () => ({

0 commit comments

Comments
 (0)