From 6f89d4dd880f02f3690fc5031a846415de5c4478 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Wed, 25 Mar 2026 22:15:42 +0000 Subject: [PATCH 1/3] fix: handle back press for selected recipient Co-authored-by: Augie --- apps/expo/src/app/camera.tsx | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/apps/expo/src/app/camera.tsx b/apps/expo/src/app/camera.tsx index 8e762d9..11defd3 100644 --- a/apps/expo/src/app/camera.tsx +++ b/apps/expo/src/app/camera.tsx @@ -4,6 +4,7 @@ import type { NativeStackNavigationProp } from "@react-navigation/native-stack"; import type * as React from "react"; import { useCallback, useEffect, useMemo, useRef, useState } from "react"; import { + BackHandler, InteractionManager, Pressable, StyleSheet, @@ -213,6 +214,11 @@ export default function CameraPage(): React.ReactElement { onFlipCameraPressed(); }, [onFlipCameraPressed]); + const clearSelectedRecipient = useCallback(() => { + navigation.setParams({ defaultRecipientId: undefined }); + navigation.navigate("Main", { screen: "Friends" }); + }, [navigation]); + // On focus, revalidate the session in case cookie exists but session expired useFocusEffect( useCallback(() => { @@ -261,6 +267,20 @@ export default function CameraPage(): React.ReactElement { void requestPermissions(); }, [isCameraInitialized, isActive, requestPermissions]); + useEffect(() => { + if (!defaultRecipientId) return; + + const backHandler = BackHandler.addEventListener( + "hardwareBackPress", + () => { + clearSelectedRecipient(); + return true; + }, + ); + + return () => backHandler.remove(); + }, [clearSelectedRecipient, defaultRecipientId]); + const videoHdr = format?.supportsVideoHdr && enableHdr; const photoHdr = format?.supportsPhotoHdr && enableHdr && !videoHdr; @@ -364,10 +384,7 @@ export default function CameraPage(): React.ReactElement { Sending to {selectedFriend.name} { - // Clear the pre-selection by resetting navigation params - navigation.setParams({ defaultRecipientId: undefined }); - }} + onPress={clearSelectedRecipient} style={styles.clearButton} > From 2113313b2d85cc8c7e3900d31b5c93b62647c30b Mon Sep 17 00:00:00 2001 From: AugusDogus <9794679+AugusDogus@users.noreply.github.com> Date: Wed, 25 Mar 2026 18:38:06 -0500 Subject: [PATCH 2/3] fix: scope camera back handler to focus Keep the camera screen's hardware back listener active only while the screen is focused so it doesn't intercept back presses from other routes when a recipient is preselected. --- apps/expo/src/app/camera.tsx | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/apps/expo/src/app/camera.tsx b/apps/expo/src/app/camera.tsx index 11defd3..3d92e66 100644 --- a/apps/expo/src/app/camera.tsx +++ b/apps/expo/src/app/camera.tsx @@ -267,19 +267,21 @@ export default function CameraPage(): React.ReactElement { void requestPermissions(); }, [isCameraInitialized, isActive, requestPermissions]); - useEffect(() => { - if (!defaultRecipientId) return; - - const backHandler = BackHandler.addEventListener( - "hardwareBackPress", - () => { - clearSelectedRecipient(); - return true; - }, - ); - - return () => backHandler.remove(); - }, [clearSelectedRecipient, defaultRecipientId]); + useFocusEffect( + useCallback(() => { + if (!defaultRecipientId) return; + + const backHandler = BackHandler.addEventListener( + "hardwareBackPress", + () => { + clearSelectedRecipient(); + return true; + }, + ); + + return () => backHandler.remove(); + }, [clearSelectedRecipient, defaultRecipientId]), + ); const videoHdr = format?.supportsVideoHdr && enableHdr; const photoHdr = format?.supportsPhotoHdr && enableHdr && !videoHdr; From ede4504702c20b37ac665e2662b4b55cec90e95e Mon Sep 17 00:00:00 2001 From: AugusDogus <9794679+AugusDogus@users.noreply.github.com> Date: Wed, 25 Mar 2026 18:47:11 -0500 Subject: [PATCH 3/3] fix: keep camera open when clearing recipient Let the selected-recipient banner close button clear the selection in place while preserving the existing hardware back behavior that returns to Friends. --- apps/expo/src/app/camera.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/apps/expo/src/app/camera.tsx b/apps/expo/src/app/camera.tsx index 3d92e66..e9ab94e 100644 --- a/apps/expo/src/app/camera.tsx +++ b/apps/expo/src/app/camera.tsx @@ -218,6 +218,9 @@ export default function CameraPage(): React.ReactElement { navigation.setParams({ defaultRecipientId: undefined }); navigation.navigate("Main", { screen: "Friends" }); }, [navigation]); + const clearSelectedRecipientInPlace = useCallback(() => { + navigation.setParams({ defaultRecipientId: undefined }); + }, [navigation]); // On focus, revalidate the session in case cookie exists but session expired useFocusEffect( @@ -386,7 +389,7 @@ export default function CameraPage(): React.ReactElement { Sending to {selectedFriend.name}