-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.tsx
85 lines (71 loc) · 1.78 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
import { DefaultTheme, NavigationContainer } from '@react-navigation/native'
import { View, StatusBar, StyleSheet, Platform } from 'react-native'
import { configureAxios, links } from "@/utils/utils"
import Tabs from '@screens/index'
import { COLORS } from '@/styles'
import { useFonts } from 'expo-font'
import { AuthProvider } from '@/context/AuthContext'
import * as Linking from 'expo-linking'
import { useEffect } from 'react'
configureAxios()
const prefix = Linking.createURL('/')
let customFonts = {
'Montserrat-Bold': require('./assets/fonts/Montserrat-Bold.ttf'),
'Montserrat-Regular': require('./assets/fonts/Montserrat-Regular.ttf')
}
const theme = {
...DefaultTheme,
colors: {
...DefaultTheme.colors,
background: COLORS.bg,
},
}
const linking = {
prefixes: [prefix],
config: {
screens: links
}
}
export default function App() {
const [isLoaded] = useFonts(customFonts)
useEffect(() => {
const open = async () => {
const initialURL = await Linking.parseInitialURLAsync()
if (Platform.OS == 'web') {
Linking.openURL(`emergencycontact://${initialURL.path}`)
}
}
open()
}, [])
if (isLoaded) {
return (
<AuthProvider>
<StatusBar backgroundColor={COLORS.text}/>
<View style={stylesheet.window}>
<View style={stylesheet.view}>
<NavigationContainer linking={linking} theme={theme}>
<Tabs/>
</NavigationContainer>
</View>
</View>
</AuthProvider>
)
}
return (
<View/>
)
}
const stylesheet = StyleSheet.create({
view: {
display: 'flex',
maxWidth: 1280,
flex: 1
},
window: {
display: 'flex',
flexDirection: 'row',
justifyContent: 'center',
flex: 1,
backgroundColor: COLORS.bg
}
})