Skip to content

Commit 4d70469

Browse files
committed
fix: Show "Your phone does not have a Camera" if no camera is found in example app
1 parent 37525a2 commit 4d70469

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

package/example/src/CameraPage.tsx

+10-1
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ export function CameraPage({ navigation }: Props): React.ReactElement {
194194

195195
return (
196196
<View style={styles.container}>
197-
{device != null && (
197+
{device != null ? (
198198
<PinchGestureHandler onGestureEvent={onPinchGesture} enabled={isActive}>
199199
<Reanimated.View onTouchEnd={onFocusTap} style={StyleSheet.absoluteFill}>
200200
<TapGestureHandler onEnded={onDoubleTap} numberOfTaps={2}>
@@ -232,6 +232,10 @@ export function CameraPage({ navigation }: Props): React.ReactElement {
232232
</TapGestureHandler>
233233
</Reanimated.View>
234234
</PinchGestureHandler>
235+
) : (
236+
<View style={styles.emptyContainer}>
237+
<Text style={styles.text}>Your phone does not have a Camera.</Text>
238+
</View>
235239
)}
236240

237241
<CaptureButton
@@ -313,4 +317,9 @@ const styles = StyleSheet.create({
313317
fontWeight: 'bold',
314318
textAlign: 'center',
315319
},
320+
emptyContainer: {
321+
flex: 1,
322+
justifyContent: 'center',
323+
alignItems: 'center',
324+
},
316325
})

0 commit comments

Comments
 (0)