diff --git a/src/navigation/MainNavigationContainer.tsx b/src/navigation/MainNavigationContainer.tsx index e1a8e64..4b2256c 100644 --- a/src/navigation/MainNavigationContainer.tsx +++ b/src/navigation/MainNavigationContainer.tsx @@ -13,6 +13,7 @@ import { useAppDispatch, useAppSelector } from '../redux/hooks'; import { useTheme } from 'react-native-paper'; import { MaterialCommunityIcons } from '@expo/vector-icons'; import { setLogout } from '../features/auth/authSlice'; +import { isReadyRef, navigationRef } from './RootNavigation'; export type RootStackParamsList = { SignIn: undefined; @@ -29,9 +30,6 @@ const Stack = createStackNavigator(); const MainNavigationContainer: React.FC = (props: Props) => { const { colors } = useTheme(); - // to be replaced later by redux state variables - const [isSignout, setIsSignout] = useState(false); - const dispatch = useAppDispatch(); const isLoggedIn = useAppSelector((state) => state.auth.isLoggedIn); const isAttemptingFetchConfiguration = useAppSelector( @@ -50,7 +48,13 @@ const MainNavigationContainer: React.FC = (props: Props) => { const handleLogout = () => dispatch(setLogout()); return ( - + { + // @ts-ignore + isReadyRef.current = true; + }} + > {!isLoggedIn ? ( <> @@ -60,11 +64,6 @@ const MainNavigationContainer: React.FC = (props: Props) => { component={SignInScreen} options={{ title: 'Sign In', - // When logging out, a pop animation feels intuitive - // You can remove this if you want the default 'push' animation - animationTypeForReplace: isSignout - ? 'pop' - : 'push', headerShown: false, }} /> @@ -93,7 +92,7 @@ const MainNavigationContainer: React.FC = (props: Props) => { }, headerRight: () => ( - +