Merge commit '7851567f4a89fa48e80a240d9659ecf8167c5c2c' into patch/5.0.x

This commit is contained in:
harukin-expo-dev-env 2024-09-20 15:14:23 +00:00
commit 9b91c4a50e

View File

@ -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)
); );