* wip * wip * wip * format * wip(mobile): lint and format * cleanup * nits * nits * idiomatic react * nit * format all root files
62 lines
2.2 KiB
TypeScript
62 lines
2.2 KiB
TypeScript
import { createNativeStackNavigator } from '@react-navigation/native-stack';
|
|
import { ActivityIndicator, View } from 'react-native';
|
|
import { useAuthStore } from '@/stores/auth-store';
|
|
import { SignInScreen } from '@/features/auth/SignInScreen';
|
|
import { NetworkListScreen } from '@/features/networks/NetworkListScreen';
|
|
import { StreamListScreen } from '@/features/streams/StreamListScreen';
|
|
import { NewStreamScreen } from '@/features/streams/NewStreamScreen';
|
|
import { StreamViewScreen } from '@/features/stream-view/StreamViewScreen';
|
|
import { HuddleScreen } from '@/features/huddle/HuddleScreen';
|
|
import { SettingsScreen } from '@/features/settings/SettingsScreen';
|
|
import { AccountScreen } from '@/features/settings/AccountScreen';
|
|
import type { RootStackParamList } from './types';
|
|
|
|
const Stack = createNativeStackNavigator<RootStackParamList>();
|
|
|
|
export function RootNavigator() {
|
|
const status = useAuthStore((s) => s.status);
|
|
|
|
if (status === 'idle' || status === 'restoring') {
|
|
return (
|
|
<View className="flex-1 items-center justify-center bg-background">
|
|
<ActivityIndicator />
|
|
</View>
|
|
);
|
|
}
|
|
|
|
if (status === 'unauthenticated') {
|
|
return (
|
|
<Stack.Navigator screenOptions={{ headerShown: false }}>
|
|
<Stack.Screen name="SignIn" component={SignInScreen} />
|
|
</Stack.Navigator>
|
|
);
|
|
}
|
|
|
|
return (
|
|
<Stack.Navigator
|
|
initialRouteName="NetworkList"
|
|
screenOptions={{ headerShown: false }}
|
|
>
|
|
<Stack.Screen name="NetworkList" component={NetworkListScreen} />
|
|
<Stack.Screen name="StreamList" component={StreamListScreen} />
|
|
<Stack.Screen
|
|
name="StreamView"
|
|
component={StreamViewScreen}
|
|
options={{ animation: 'fade', gestureEnabled: false }}
|
|
/>
|
|
<Stack.Screen
|
|
name="Huddle"
|
|
component={HuddleScreen}
|
|
options={{ animation: 'slide_from_bottom', gestureEnabled: false }}
|
|
/>
|
|
<Stack.Screen
|
|
name="NewStream"
|
|
component={NewStreamScreen}
|
|
options={{ animation: 'slide_from_bottom' }}
|
|
/>
|
|
<Stack.Screen name="Settings" component={SettingsScreen} />
|
|
<Stack.Screen name="Account" component={AccountScreen} />
|
|
</Stack.Navigator>
|
|
);
|
|
}
|