Skip to content

Commit

Permalink
fix(mobile): fix app stuck in splash when offline (#310)
Browse files Browse the repository at this point in the history
  • Loading branch information
bkdev98 committed Sep 11, 2024
1 parent ce28056 commit 788f693
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
9 changes: 1 addition & 8 deletions apps/mobile/app/(app)/_layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ import { theme } from '@/lib/theme'
import { useUser } from '@clerk/clerk-expo'
import { t } from '@lingui/macro'
import { useLingui } from '@lingui/react'
import { Redirect, SplashScreen, Stack } from 'expo-router'
import { useEffect } from 'react'
import { Redirect, Stack } from 'expo-router'
import { View } from 'react-native'

export default function AuthenticatedLayout() {
Expand All @@ -20,12 +19,6 @@ export default function AuthenticatedLayout() {
const { shouldAuthLocal, setShouldAuthLocal } = useLocalAuth()
useScheduleNotificationTrigger()

useEffect(() => {
if (isLoaded) {
setTimeout(() => SplashScreen.hideAsync(), 1000)
}
}, [isLoaded])

if (!isSignedIn && isLoaded) {
return <Redirect href={'/login'} />
}
Expand Down
2 changes: 2 additions & 0 deletions apps/mobile/app/_layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,8 @@ function RootLayout() {
useNotificationObserver()

useEffect(() => {
setTimeout(() => SplashScreen.hideAsync(), 2000)

const subscription = AppState.addEventListener('change', onAppStateChange)

return () => subscription.remove()
Expand Down

0 comments on commit 788f693

Please sign in to comment.