-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathApp.tsx
More file actions
55 lines (50 loc) · 1.49 KB
/
App.tsx
File metadata and controls
55 lines (50 loc) · 1.49 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
import React from 'react';
import {
NavigationContainer,
DefaultTheme,
DarkTheme,
} from '@react-navigation/native';
import { SafeAreaProvider, SafeAreaView } from 'react-native-safe-area-context';
import { TabNavigator } from './src/navigation';
import { ThemeProvider, useTheme } from './src/contexts';
import { StatusBar, KeyboardAvoidingView, Platform } from 'react-native';
function AppNavigator() {
const { currentTheme, colors } = useTheme();
// Create custom navigation theme based on app theme
const navigationTheme = {
...(currentTheme === 'dark' ? DarkTheme : DefaultTheme),
colors: {
...(currentTheme === 'dark' ? DarkTheme.colors : DefaultTheme.colors),
primary: colors.primary,
background: colors.background,
card: colors.white,
text: colors.textPrimary,
border: colors.border,
notification: colors.primary,
},
};
return (
<KeyboardAvoidingView
style={{ flex: 1 }}
behavior={Platform.OS === 'ios' ? 'padding' : 'height'}
keyboardVerticalOffset={Platform.OS === 'ios' ? 0 : 0}
>
<NavigationContainer theme={navigationTheme}>
<TabNavigator />
</NavigationContainer>
</KeyboardAvoidingView>
);
}
function App() {
return (
<SafeAreaProvider>
<SafeAreaView style={{ flex: 1 }}>
<StatusBar barStyle="light-content" />
<ThemeProvider>
<AppNavigator />
</ThemeProvider>
</SafeAreaView>
</SafeAreaProvider>
);
}
export default App;