-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.tsx
121 lines (108 loc) · 3.54 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
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
/**
* Sample React Native App
* https://github.com/facebook/react-native
*
* Generated with the TypeScript template
* https://github.com/react-native-community/react-native-template-typescript
*
* @format
*/
import {NavigationContainer} from '@react-navigation/native';
import {createNativeStackNavigator} from '@react-navigation/native-stack';
import {StripeProvider} from '@stripe/stripe-react-native';
import React, {useEffect, useState} from 'react';
import {Provider as PaperProvider} from 'react-native-paper';
import Toast from 'react-native-toast-message';
import {PaymentService} from './libs/payment.service';
import {CarPage} from './pages/CarPage';
import {ChatListPage} from './pages/ChatListPage';
import {ChatPage} from './pages/ChatPage';
import {CreateReservationPage} from './pages/CreateReservationPage';
import {IndexPage} from './pages/IndexPage';
import {InvoiceCheckoutPage} from './pages/InvoiceCheckoutPage';
import {InvoicePage} from './pages/InvoicePage';
import {LoginPage} from './pages/LoginPage';
import {RegisterPage} from './pages/RegisterPage';
import {UserPage} from './pages/UserPage';
import {UserProfile} from './pages/UserProfile';
const Stack = createNativeStackNavigator();
const App = () => {
const [stripePublicKey, setStripePublicKey] = useState('');
async function fetchStripePublicKey() {
const pk = await PaymentService.getStripePublicKey();
setStripePublicKey(pk);
}
useEffect(() => {
fetchStripePublicKey();
}, []);
if (stripePublicKey === '') {
return null;
}
return (
<StripeProvider publishableKey={stripePublicKey}>
<PaperProvider>
<NavigationContainer>
<Stack.Navigator screenOptions={{headerShown: false}}>
<Stack.Screen
name="LoginPage"
component={LoginPage}
options={{animation: 'none'}}
/>
<Stack.Screen
name="RegisterPage"
component={RegisterPage}
options={{animation: 'none'}}
/>
<Stack.Screen
name="ReservationPage"
component={IndexPage}
options={{animation: 'none'}}
/>
<Stack.Screen
name="ChatListPage"
component={ChatListPage}
options={{animation: 'none'}}
/>
<Stack.Screen
name="CarPage"
component={CarPage}
options={{animation: 'none'}}
/>
<Stack.Screen
name="UserPage"
component={UserPage}
options={{animation: 'none'}}
/>
<Stack.Screen
name="ChatPage"
component={ChatPage}
options={{animation: 'none'}}
/>
<Stack.Screen
name="InvoicePage"
component={InvoicePage}
options={{animation: 'none'}}
/>
<Stack.Screen
name="InvoiceCheckoutPage"
component={InvoiceCheckoutPage}
options={{animation: 'none'}}
/>
<Stack.Screen
name="CreateReservationPage"
component={CreateReservationPage}
options={{animation: 'none'}}
/>
<Stack.Screen
name="UserProfile"
component={UserProfile}
options={{animation: 'none'}}
/>
</Stack.Navigator>
</NavigationContainer>
<Toast />
</PaperProvider>
</StripeProvider>
);
};
export default App;