-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.tsx
65 lines (57 loc) · 1.51 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
import React, { useEffect, useState } from "react"
import { Root } from "native-base"
import AppLoading from "expo-app-loading"
import { StripeProvider } from "@stripe/stripe-react-native"
import useStore, { AppStateInterface } from "./src/store"
import { graphqlClient } from "./src/utils/graphqlClient"
import {
useFonts,
Roboto_100Thin,
Roboto_100Thin_Italic,
Roboto_300Light,
Roboto_300Light_Italic,
Roboto_400Regular,
Roboto_400Regular_Italic,
Roboto_500Medium,
Roboto_500Medium_Italic,
Roboto_700Bold,
Roboto_700Bold_Italic,
Roboto_900Black,
Roboto_900Black_Italic,
} from "@expo-google-fonts/roboto"
import { MainNavigation } from "./src/navigation"
import { GETPUBLISHABLEKEY } from "./src/graphql/queries"
export default function App() {
const [pk, setPk] = useState<string | "">("")
async function getKey() {
const {
getPublishableKey: { key },
} = await graphqlClient.request(GETPUBLISHABLEKEY, {})
key && setPk(key)
}
useEffect(() => {
getKey()
}, [])
let [fontsLoaded] = useFonts({
Roboto_100Thin,
Roboto_100Thin_Italic,
Roboto_300Light,
Roboto_300Light_Italic,
Roboto_400Regular,
Roboto_400Regular_Italic,
Roboto_500Medium,
Roboto_500Medium_Italic,
Roboto_700Bold,
Roboto_700Bold_Italic,
Roboto_900Black,
Roboto_900Black_Italic,
})
if (!fontsLoaded) return <AppLoading />
return (
<Root>
<StripeProvider publishableKey={`${pk}`}>
<MainNavigation />
</StripeProvider>
</Root>
)
}