very basics of auth state - not actually authenticating anything right now....
This commit is contained in:
@@ -1,9 +1,29 @@
|
||||
import { Stack } from 'expo-router'
|
||||
import { SessionProvider, useSession } from './ctx'
|
||||
import { SplashScreenController } from './splash'
|
||||
|
||||
export default function RootLayout() {
|
||||
export default function Root() {
|
||||
// Set up the auth context and render our layout inside of it.
|
||||
return (
|
||||
<SessionProvider>
|
||||
<SplashScreenController />
|
||||
<RootNavigator />
|
||||
</SessionProvider>
|
||||
)
|
||||
}
|
||||
|
||||
// Separate this into a new component so it can access the SessionProvider context later
|
||||
function RootNavigator() {
|
||||
const { session } = useSession()
|
||||
return (
|
||||
<Stack>
|
||||
<Stack.Screen name='(tabs)' options={{ headerShown: false }}></Stack.Screen>
|
||||
<Stack.Protected guard={!!session}>
|
||||
<Stack.Screen options={{ headerShown: false }} name='(tabs)' />
|
||||
</Stack.Protected>
|
||||
|
||||
<Stack.Protected guard={!session}>
|
||||
<Stack.Screen options={{ headerShown: false }} name='login' />
|
||||
</Stack.Protected>
|
||||
</Stack>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user