Merge commit '7851567f4a89fa48e80a240d9659ecf8167c5c2c' into patch/5.0.x
This commit is contained in:
commit
9b91c4a50e
8
menu.js
8
menu.js
@ -41,12 +41,16 @@ export default function Menu({ getCurrentTrain }) {
|
|||||||
const [locationStatus, setLocationStatus] = useState(null);
|
const [locationStatus, setLocationStatus] = useState(null);
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
Location.requestForegroundPermissionsAsync().then((data) => {
|
Location.requestForegroundPermissionsAsync().then((data) => {
|
||||||
setLocationStatus(data.status);
|
setLocationStatus(
|
||||||
|
Platform.OS == "ios"
|
||||||
|
? data.status == "granted"
|
||||||
|
: data.android.accuracy == "fine"
|
||||||
|
);
|
||||||
});
|
});
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const getCurrentPosition = () => {
|
const getCurrentPosition = () => {
|
||||||
if (locationStatus !== "granted") return () => {};
|
if (!locationStatus) return () => {};
|
||||||
Location.getCurrentPositionAsync({}).then((location) =>
|
Location.getCurrentPositionAsync({}).then((location) =>
|
||||||
makeCurrentStation(location)
|
makeCurrentStation(location)
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user