Skip to content

Commit 624d6dc

Browse files
Clarify permission handling
Co-authored-by: digitalnomad91 <2067771+digitalnomad91@users.noreply.github.com>
1 parent 70d5883 commit 624d6dc

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

components/permissions/LocationPermissionDemo.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export default function LocationPermissionDemo() {
2424
const loc = await Location.getCurrentPositionAsync({});
2525
setCoords(`${loc.coords.latitude.toFixed(5)}, ${loc.coords.longitude.toFixed(5)}`);
2626
} catch (e) {
27-
setError((e as Error).message);
27+
setError(e instanceof Error ? e.message : String(e));
2828
}
2929
};
3030

components/permissions/NotificationsPermissionDemo.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ export default function NotificationsPermissionDemo() {
88

99
const requestPermissions = async () => {
1010
const settings = await Notifications.requestPermissionsAsync();
11+
// Expo returns both a status field and a legacy granted boolean; normalize to a single label for display.
1112
const derivedStatus = settings.status ?? (settings.granted ? 'granted' : 'denied');
1213
setStatus(derivedStatus);
1314
};

0 commit comments

Comments
 (0)