-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.tsx
61 lines (54 loc) · 2.03 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
import "react-native-url-polyfill/auto";
import { StatusBar } from "expo-status-bar";
import { Provider as ReduxProvider } from "react-redux";
import { persistor, store, } from "./src/store/store";
import { PersistGate } from "redux-persist/integration/react";
import { StripeProvider } from "@stripe/stripe-react-native";
import appJson from "./app.json";
import { REACT_APP_STRIPE_PUBLISHABLE_KEY } from "@env";
import AppBodyContainer from "./AppBodyContainer";
import * as SplashScreen from "expo-splash-screen";
import { useFonts } from "expo-font";
import { useCallback } from "react";
import { View } from "react-native";
import { SafeAreaProvider } from "react-native-safe-area-context";
import { RootSiblingParent } from 'react-native-root-siblings';
import { ActionSheetProvider } from '@expo/react-native-action-sheet';
SplashScreen.preventAutoHideAsync();
const stripePublishableKey = REACT_APP_STRIPE_PUBLISHABLE_KEY;
export default function App() {
const [isLoaded] = useFonts({
"PlusJakartaSans-Regular": require("./src/assets/fonts/PlusJakartaSans-Regular.ttf"),
"Inter-Regular": require("./src/assets/fonts/Inter-Regular.ttf")
});
const handleOnLayout = useCallback(async () => {
if (isLoaded) {
await SplashScreen.hideAsync();
}
}, [isLoaded]);
if (!isLoaded) {
return null;
}
console.log(store.getState().user.token);
return (
<View style={{ flex: 1 }} onLayout={handleOnLayout}>
<SafeAreaProvider>
<StripeProvider
publishableKey={stripePublishableKey}
urlScheme={appJson.expo.scheme}
merchantIdentifier={`merchant.com.${appJson.expo.slug}`}
>
<ReduxProvider store={store}>
<PersistGate loading={null} persistor={persistor}>
<RootSiblingParent>
<ActionSheetProvider>
<AppBodyContainer />
</ActionSheetProvider>
</RootSiblingParent>
</PersistGate>
</ReduxProvider>
</StripeProvider>
</SafeAreaProvider>
</View>
);
}