Appearance
Documentation / expo / AuthBoundary
Function: AuthBoundary() ​
AuthBoundary(
__namedParameters
):Element
This component is used to simplify protecting routes based on the user's authentication status, and the Privy SDK's readiness.
Parameters ​
• __namedParameters: PropsWithChildren
<PrivyAuthGuardProps
>
Returns ​
Element
Example ​
ts
// This is a basic setup using `expo-router`
<AuthBoundary
loading={<SplashScreen />}
unauthenticated={<Redirect href="/sign-in" />}
>
<Stack />
</AuthBoundary>
Example ​
ts
// This is a basic setup using `react-navigation`
<Stack.Navigator>
<AuthBoundary
loading={<SplashScreen />}
unauthenticated={
<Stack.Group>
<Stack.Screen name="Sign In" component={SignInScreen} />
...
</Stack.Group>
}
>
<Stack.Group>
<Stack.Screen name="Home" component={HomeScreen} />
...
</Stack.Group>
</AuthBoundary>