-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.js
88 lines (85 loc) · 2.8 KB
/
App.js
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
87
88
import React from 'react';
import { NavigationContainer, DarkTheme as NavigationDarkTheme } from '@react-navigation/native';
import { TouchableOpacity } from 'react-native';
import { Ionicons } from '@expo/vector-icons';
import { Provider as PaperProvider } from 'react-native-paper';
import { createStackNavigator } from '@react-navigation/stack';
import ChatHistoryScreen from './screens/ChatHistoryScreen';
import HeaderButton from './components/HeaderButton';
import ChatDetailScreen from './screens/ChatDetailScreen';
import NewChatScreen from './screens/NewChatScreen';
const Stack = createStackNavigator();
// Custom Dark Theme
const CustomDarkTheme = {
...NavigationDarkTheme,
colors: {
...NavigationDarkTheme.colors,
primary: '#BB86FC',
background: '#121212',
card: '#1F1F1F',
text: '#FFFFFF',
border: '#272727',
},
};
export default function App() {
return (
<PaperProvider theme={CustomDarkTheme}>
<NavigationContainer theme={CustomDarkTheme}>
<Stack.Navigator>
<Stack.Screen
name="Chats"
component={ChatHistoryScreen}
options={({ navigation }) => ({
title: 'Chats',
headerTitleStyle: {
fontSize: 32,
paddingBottom: 25,
color: CustomDarkTheme.colors.text,
},
headerRight: () => (
<HeaderButton onPress={() => navigation.navigate('NewChatScreen')} />
),
headerStyle: {
backgroundColor: CustomDarkTheme.colors.card,
},
})}
/>
<Stack.Screen
name="ChatDetail"
component={ChatDetailScreen}
options={({ route }) => ({
title: route.params.name,
headerTitleStyle: {
fontSize: 32,
paddingBottom: 15,
color: CustomDarkTheme.colors.text,
},
headerStyle: {
backgroundColor: CustomDarkTheme.colors.card,
},
})}
/>
<Stack.Screen
name="NewChatScreen"
component={NewChatScreen}
options={({ navigation }) => ({
title: 'New Chat',
headerRight: () => (
<TouchableOpacity onPress={() => navigation.goBack()} style={{ marginRight: 15 }}>
<Ionicons name="close" size={24} color="white" />
</TouchableOpacity>
),
headerLeft: () => null,
headerTitleStyle: {
color: 'white',
},
headerStyle: {
backgroundColor: '#1F1F1F',
},
})}
/>
</Stack.Navigator>
</NavigationContainer>
</PaperProvider>
);
}