Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: migrate to screens v4 and navigation v7 #6622

Merged
merged 12 commits into from
Nov 14, 2024
Prev Previous commit
using popTo in back button
  • Loading branch information
alduzy committed Nov 12, 2024
commit c36c663380186c538e20f716e98cb4bce8173a17
13 changes: 6 additions & 7 deletions apps/common-app/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,7 @@ import type { HeaderBackButtonProps } from '@react-navigation/elements';
import { HeaderBackButton } from '@react-navigation/elements';
import type { NativeStackNavigationProp } from '@react-navigation/native-stack';
import { createNativeStackNavigator } from '@react-navigation/native-stack';
import type {
NavigationProp,
NavigationState,
PathConfigMap,
} from '@react-navigation/native';
import type { NavigationState, PathConfigMap } from '@react-navigation/native';
import { NavigationContainer, useNavigation } from '@react-navigation/native';
import type { StackNavigationProp } from '@react-navigation/stack';
import { createStackNavigator } from '@react-navigation/stack';
Expand Down Expand Up @@ -168,10 +164,13 @@ const linking = {
};

function BackButton(props: HeaderBackButtonProps) {
const navigation = useNavigation<NavigationProp<RootStackParamList>>();
const navigation = useNavigation<
| StackNavigationProp<RootStackParamList>
| NativeStackNavigationProp<RootStackParamList>
>();

return (
<HeaderBackButton {...props} onPress={() => navigation.goBack()} />
<HeaderBackButton {...props} onPress={() => navigation.popTo('Home')} />
);
}

Expand Down
Loading