From d464ff78c52c8e5569359b26fc0268e6aa9d93f7 Mon Sep 17 00:00:00 2001 From: GCyganek Date: Fri, 9 Jan 2026 18:24:23 +0100 Subject: [PATCH] Fix ReferenceError in getCurrentPosition() - web API reference on mobile --- src/libs/getCurrentPosition/index.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/libs/getCurrentPosition/index.ts b/src/libs/getCurrentPosition/index.ts index e64a8e9b0f5c..dc0079439ad1 100644 --- a/src/libs/getCurrentPosition/index.ts +++ b/src/libs/getCurrentPosition/index.ts @@ -1,5 +1,6 @@ import {getCurrentPositionAsync, PermissionStatus, requestForegroundPermissionsAsync} from 'expo-location'; import type {PermissionResponse} from 'expo-location'; +import {Platform} from 'react-native'; import {GeolocationErrorCode} from './getCurrentPosition.types'; import type {GetCurrentPosition} from './getCurrentPosition.types'; @@ -18,7 +19,7 @@ const getCurrentPosition: GetCurrentPosition = async (success, error, options) = let message = 'Geolocation call failed'; let code = GeolocationErrorCode.POSITION_UNAVAILABLE; - if (caughtError instanceof GeolocationPositionError) { + if (Platform.OS === 'web' && caughtError instanceof GeolocationPositionError) { code = caughtError.code; message = caughtError.message; } else if (caughtError instanceof Error) {