From 059331031004b0d4c5798f52969eb661c31c8615 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Qu=E1=BB=91c=20Kh=C3=A1nh?= Date: Mon, 2 Sep 2024 18:29:28 +0700 Subject: [PATCH] fix(mobile): fix local auth guard cause router crashes (#253) Resolves https://github.com/get6pm/6pm/issues/251 --- apps/mobile/app/(app)/_layout.tsx | 256 +++++++++++---------- apps/mobile/components/auth/auth-local.tsx | 2 +- 2 files changed, 130 insertions(+), 128 deletions(-) diff --git a/apps/mobile/app/(app)/_layout.tsx b/apps/mobile/app/(app)/_layout.tsx index 71627cf6..ec2cb574 100644 --- a/apps/mobile/app/(app)/_layout.tsx +++ b/apps/mobile/app/(app)/_layout.tsx @@ -12,6 +12,7 @@ import { useLingui } from '@lingui/react' import { Link, Redirect, SplashScreen, Stack } from 'expo-router' import { PlusIcon } from 'lucide-react-native' import { useEffect } from 'react' +import { View } from 'react-native' export default function AuthenticatedLayout() { const { isLoaded, isSignedIn } = useUser() @@ -35,134 +36,135 @@ export default function AuthenticatedLayout() { return } - if (shouldAuthLocal) { - return setShouldAuthLocal(false)} /> - } - return ( - , - }} - > - - - - - - - - ( - - - - ), - }} - /> - - - ( - - - - ), - }} - /> - - - + {shouldAuthLocal && ( + setShouldAuthLocal(false)} /> + )} + , }} - /> - + > + + + + + + + + ( + + + + ), + }} + /> + + + ( + + + + ), + }} + /> + + + + + ) } diff --git a/apps/mobile/components/auth/auth-local.tsx b/apps/mobile/components/auth/auth-local.tsx index d706b7d8..1367a0b0 100644 --- a/apps/mobile/components/auth/auth-local.tsx +++ b/apps/mobile/components/auth/auth-local.tsx @@ -29,7 +29,7 @@ export function AuthLocal({ onAuthenticated }: AuthLocalProps) { }, []) return ( - + {t( i18n,