-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.tsx
55 lines (50 loc) · 1.88 KB
/
App.tsx
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 {StatusBar} from 'react-native';
import {NavigationContainer} from '@react-navigation/native';
import {createNativeStackNavigator} from '@react-navigation/native-stack';
import {FormProvider, useForm} from 'react-hook-form';
import {ActionSheetProvider} from '@expo/react-native-action-sheet';
import {QueryClient, QueryClientProvider} from 'react-query';
import ContactDetail from './Screens/ContactDetail';
import Form from './Screens/CreateContact';
import HomeScreen from './Screens/HomeScreen';
import CustomRightHeader from './Components/CustomRightHeader';
import {ContextType} from './types';
const Stack = createNativeStackNavigator();
const queryClient = new QueryClient();
export default function App() {
const methods = useForm<ContextType>();
return (
<ActionSheetProvider>
<FormProvider {...methods}>
<QueryClientProvider client={queryClient}>
<NavigationContainer>
<StatusBar barStyle={'default'} />
<Stack.Navigator
initialRouteName="Home"
screenOptions={{
headerStyle: {
backgroundColor: '#212A3E',
},
headerTintColor: '#F1F6F9',
}}>
<Stack.Screen
name="Home"
component={HomeScreen}
options={{
headerTitle: 'Contacts',
// eslint-disable-next-line react/no-unstable-nested-components
headerRight: () => {
return <CustomRightHeader />;
},
}}
/>
<Stack.Screen name="Form" component={Form} />
<Stack.Screen name="Detail" component={ContactDetail} />
</Stack.Navigator>
</NavigationContainer>
</QueryClientProvider>
</FormProvider>
</ActionSheetProvider>
);
}