Open History to see the last commit
1import { useAuth } from "@clerk/expo";
2import { AuthView, UserProfileView } from "@clerk/expo/native";
3import { Redirect, Stack } from "expo-router";
4import { View } from "react-native";
5
6import { hasCloudPublicConfig } from "../../features/cloud/publicConfig";
7
8export default function SettingsAuthRouteScreen() {
9 return hasCloudPublicConfig() ? (
10 <ConfiguredSettingsAuthRouteScreen />
11 ) : (
12 <Redirect href="/settings" />
13 );
14}
15
16function ConfiguredSettingsAuthRouteScreen() {
17 const { isLoaded, isSignedIn } = useAuth({ treatPendingAsSignedOut: false });
18
19 return (
20 <>
21 <Stack.Screen options={{ title: isSignedIn ? "Account" : "Sign in" }} />
22 <View collapsable={false} className="flex-1 overflow-hidden bg-sheet">
23 {isLoaded ? (
24 isSignedIn ? (
25 <UserProfileView isDismissible={false} />
26 ) : (
27 <AuthView isDismissible={false} />
28 )
29 ) : null}
30 </View>
31 </>
32 );
33}