-
-
Notifications
You must be signed in to change notification settings - Fork 117
Expand file tree
/
Copy path_layout.tsx.ejs
More file actions
86 lines (78 loc) · 2.97 KB
/
Copy path_layout.tsx.ejs
File metadata and controls
86 lines (78 loc) · 2.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
import '../global.css';
import 'expo-dev-client';
import { ThemeProvider as NavThemeProvider } from '@react-navigation/native';
<% if (props.stateManagementPackage?.name === "redux") { %>
import { Provider } from 'react-redux'
import store from 'store/store'
<% } %>
<% if (props.stylingPackage?.options.selectedComponents.includes('action-sheet')) { %>
import { ActionSheetProvider } from '@expo/react-native-action-sheet';
<% } %>
<% if (props.stylingPackage?.options.selectedComponents.includes('bottom-sheet')) { %>
import { BottomSheetModalProvider } from '@gorhom/bottom-sheet';
<% } %>
import { Stack } from 'expo-router';
import { StatusBar } from 'expo-status-bar';
<% if (props.stylingPackage?.options.selectedComponents.includes('bottom-sheet')) { %>
import { GestureHandlerRootView } from 'react-native-gesture-handler';
<% } %>
import { ThemeToggle } from '~/components/ThemeToggle';
import { useColorScheme, useInitialAndroidBarSync } from '~/lib/useColorScheme';
import { NAV_THEME } from '~/theme';
export {
// Catch any errors thrown by the Layout component.
ErrorBoundary,
} from 'expo-router';
export default function RootLayout() {
useInitialAndroidBarSync();
const { colorScheme, isDarkColorScheme } = useColorScheme();
return (
<>
<StatusBar
key={`root-status-bar-${isDarkColorScheme ? 'light' : 'dark'}`}
style={isDarkColorScheme ? 'light' : 'dark'}
/>
{/* WRAP YOUR APP WITH ANY ADDITIONAL PROVIDERS HERE */}
{/* <ExampleProvider> */}
<% if (props.stateManagementPackage?.name === "redux") { %>
<Provider store={store}>
<% } %>
<% if (props.stylingPackage?.options.selectedComponents.includes('bottom-sheet')) { %>
<GestureHandlerRootView style={{ flex: 1 }}>
<BottomSheetModalProvider>
<% } %>
<% if (props.stylingPackage?.options.selectedComponents.includes('action-sheet')) { %>
<ActionSheetProvider>
<% } %>
<NavThemeProvider value={NAV_THEME[colorScheme]}>
<Stack screenOptions={SCREEN_OPTIONS}>
<Stack.Screen name="(drawer)" options={DRAWER_OPTIONS} />
<Stack.Screen name="modal" options={MODAL_OPTIONS} />
</Stack>
</NavThemeProvider>
<% if (props.stylingPackage?.options.selectedComponents.includes('action-sheet')) { %>
</ActionSheetProvider>
<% } %>
<% if (props.stylingPackage?.options.selectedComponents.includes('bottom-sheet')) { %>
</BottomSheetModalProvider>
</GestureHandlerRootView>
<% } %>
<% if (props.stateManagementPackage?.name === "redux") { %>
</Provider>
<% } %>
{/* </ExampleProvider> */}
</>
);
}
const SCREEN_OPTIONS = {
animation: 'ios', // for android
} as const;
const DRAWER_OPTIONS = {
headerShown: false,
} as const;
const MODAL_OPTIONS = {
presentation: 'modal',
animation: 'fade_from_bottom', // for android
title: 'Settings',
headerRight: () => <ThemeToggle />,
} as const;