mirror of
https://gitee.com/wanwujie/sub2api-mobile
synced 2026-04-03 06:52:14 +08:00
44 lines
1.5 KiB
TypeScript
44 lines
1.5 KiB
TypeScript
import '@/src/global.css';
|
|
|
|
import { QueryClientProvider } from '@tanstack/react-query';
|
|
import { Stack } from 'expo-router';
|
|
import { useEffect } from 'react';
|
|
import { ActivityIndicator, View } from 'react-native';
|
|
import { GestureHandlerRootView } from 'react-native-gesture-handler';
|
|
|
|
import { queryClient } from '@/src/lib/query-client';
|
|
import { markPerformance } from '@/src/lib/performance';
|
|
import { adminConfigState, hydrateAdminConfig } from '@/src/store/admin-config';
|
|
|
|
const { useSnapshot } = require('valtio/react');
|
|
|
|
export default function RootLayout() {
|
|
useEffect(() => {
|
|
hydrateAdminConfig()
|
|
.then(() => markPerformance('config_hydrated'))
|
|
.catch(() => undefined);
|
|
}, []);
|
|
|
|
const config = useSnapshot(adminConfigState);
|
|
const isReady = config.hydrated;
|
|
|
|
return (
|
|
<GestureHandlerRootView style={{ flex: 1 }}>
|
|
<QueryClientProvider client={queryClient}>
|
|
{!isReady ? (
|
|
<View style={{ flex: 1, alignItems: 'center', justifyContent: 'center', backgroundColor: '#f4efe4' }}>
|
|
<ActivityIndicator color="#1d5f55" />
|
|
</View>
|
|
) : (
|
|
<Stack screenOptions={{ headerShown: false }}>
|
|
<Stack.Screen name="(tabs)" />
|
|
<Stack.Screen name="login" />
|
|
<Stack.Screen name="users/[id]" options={{ animation: 'slide_from_right', presentation: 'card' }} />
|
|
<Stack.Screen name="accounts/[id]" options={{ presentation: 'card' }} />
|
|
</Stack>
|
|
)}
|
|
</QueryClientProvider>
|
|
</GestureHandlerRootView>
|
|
);
|
|
}
|