|
1 | | -import { DarkTheme, DefaultTheme, ThemeProvider } from '@react-navigation/native'; |
| 1 | +import '../global.css'; |
| 2 | +import React from 'react'; |
2 | 3 | import { Stack } from 'expo-router'; |
| 4 | +import { Platform, useColorScheme } from 'react-native'; |
| 5 | +import { GestureHandlerRootView } from 'react-native-gesture-handler'; |
3 | 6 | import { StatusBar } from 'expo-status-bar'; |
4 | | -import 'react-native-reanimated'; |
5 | | -import { useColorScheme } from 'react-native'; |
| 7 | +import { DarkTheme, DefaultTheme, ThemeProvider } from '@react-navigation/native'; |
| 8 | + |
| 9 | +function ThemedLayout() { |
| 10 | + const colorScheme = useColorScheme(); |
| 11 | + |
| 12 | + return ( |
| 13 | + <> |
| 14 | + <StatusBar |
| 15 | + style={colorScheme === 'dark' ? 'dark' : 'light'} |
| 16 | + backgroundColor="transparent" |
| 17 | + translucent={true} |
| 18 | + /> |
| 19 | + <Stack screenOptions={{ |
| 20 | + headerShown: false |
| 21 | + }}> |
| 22 | + <Stack.Screen |
| 23 | + name="(drawer)" |
| 24 | + options={{ headerShown: false }} |
| 25 | + /> |
6 | 26 |
|
7 | | -export const unstable_settings = { |
8 | | - anchor: '(tabs)', |
9 | | -}; |
| 27 | + </Stack> |
| 28 | + </> |
| 29 | + ); |
| 30 | +} |
10 | 31 |
|
11 | 32 | export default function RootLayout() { |
12 | | - const colorScheme = useColorScheme(); |
| 33 | + const colorScheme = useColorScheme(); |
13 | 34 |
|
14 | | - return ( |
15 | | - <ThemeProvider value={colorScheme === 'dark' ? DarkTheme : DefaultTheme}> |
16 | | - <Stack> |
17 | | - <Stack.Screen name="(tabs)" options={{ headerShown: false }} /> |
18 | | - <Stack.Screen name="modal" options={{ presentation: 'modal', title: 'Modal' }} /> |
19 | | - </Stack> |
20 | | - <StatusBar style="auto" /> |
21 | | - </ThemeProvider> |
| 35 | + return ( |
| 36 | + <ThemeProvider value={colorScheme === 'dark' ? DarkTheme : DefaultTheme}> |
| 37 | + <GestureHandlerRootView className={`bg-light-primary dark:bg-dark-primary ${Platform.OS === 'ios' ? 'pb-0' : ''}`} style={{ flex: 1 }}> |
| 38 | + <ThemedLayout /> |
| 39 | + </GestureHandlerRootView> |
| 40 | + </ThemeProvider> |
22 | 41 | ); |
23 | 42 | } |
0 commit comments