Every sensitive capability needs permission at runtime, and the shape of the request decides whether you get it. Ask at launch, with no context, and most people decline - and on iOS a declined permission cannot be asked for again from inside your app. The only route back is Settings, which means your recovery path is a dialog explaining how to get there.
So ask at the moment of use, after the reader has done something that makes the reason obvious. They tap "Scan a receipt", then the camera permission appears. Expo's hooks give you the status and the request function together, so the pattern is: check, explain if you must, request, and handle a refusal with something useful rather than a dead screen.
The strings matter as much as the timing. iOS requires a usage description in Info.plist and crashes without one, deliberately, so a request can never ship with no explanation. With Expo these are written by the config plugin from your app.json. App Review reads them, and "We use the camera to scan receipts so you can add them to an expense" passes where "Required for app functionality" does not.
For the library rather than the camera, expo-image-picker covers both, and on iOS 14 and later there is a limited-access mode where the reader grants a few photos rather than all of them - handle it, because it is increasingly the common case.
import { useState } from 'react';
import { View, Text, Pressable, Image, Linking } from 'react-native';
import { useCameraPermissions, CameraView } from 'expo-camera';
import * as ImagePicker from 'expo-image-picker';
import * as FileSystem from 'expo-file-system';
export function ReceiptCapture() {
const [permission, requestPermission] = useCameraPermissions();
const [photoUri, setPhotoUri] = useState<string | null>(null);
// Not asked yet - show why, THEN request.
if (!permission) return <Text>Checking...</Text>;
if (!permission.granted) {
return (
<View style={{ padding: 16, gap: 12 }}>
<Text>We use the camera to scan a receipt so you can attach it.</Text>
{permission.canAskAgain ? (
<Pressable onPress={requestPermission}>
<Text>Allow the camera</Text>
</Pressable>
) : (
// Refused once on iOS: the only way back is Settings.
<Pressable onPress={() => Linking.openSettings()}>
<Text>Open Settings to enable the camera</Text>
</Pressable>
)}
</View>
);
}
return (
<View style={{ flex: 1 }}>
<CameraView style={{ flex: 1 }} facing="back" />
<Pressable
onPress={async () => {
const result = await ImagePicker.launchImageLibraryAsync({
mediaTypes: ['images'],
quality: 0.7,
});
if (!result.canceled) {
const asset = result.assets[0];
setPhotoUri(asset.uri);
// Copy it somewhere permanent: a picker URI is temporary.
const target = `${FileSystem.documentDirectory}receipt.jpg`;
await FileSystem.copyAsync({ from: asset.uri, to: target });
}
}}
>
<Text>Choose from library instead</Text>
</Pressable>
{photoUri && <Image source={{ uri: photoUri }} style={{ width: 80, height: 80 }} />}
</View>
);
}
Open this example in the editor and change it. Nothing you type is saved.