Skip to content

Commit 4ace2f5

Browse files
committed
fix: navigation go back bug
1 parent 098df49 commit 4ace2f5

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

examples/SampleApp/src/components/ScreenHeader.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,13 @@ export const BackButton: React.FC<{
6464
return (
6565
<TouchableOpacity
6666
onPress={() => {
67-
navigation.goBack();
67+
if (!navigation.canGoBack()) {
68+
// if no previous screen was present in history, go to the list screen
69+
// this can happen when opened through push notification
70+
navigation.reset({ index: 0, routes: [{ name: 'HomeScreen' }] });
71+
} else {
72+
navigation.goBack();
73+
}
6874
if (onBack) {
6975
onBack();
7076
}

examples/SampleApp/src/components/UserInfoOverlay.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,6 @@ export const UserInfoOverlay = (props: UserInfoOverlayProps) => {
302302
members,
303303
});
304304

305-
console.log('channels', channels.length);
306305
let newChannel;
307306
if (channels.length === 1) {
308307
newChannel = channels[0];

0 commit comments

Comments
 (0)