-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.js
45 lines (39 loc) · 1.27 KB
/
App.js
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
import 'react-native-gesture-handler';
import React, { useMemo, useState } from 'react';
import AppLoading from 'expo-app-loading';
import { StyleSheet, View } from 'react-native';
import { NavigationContainer } from '@react-navigation/native';
// import useFonts hook
import { useFonts } from '@use-expo/font';
import { Footer } from './components';
import { AppContext } from './context/AppContext';
import { Audio, Bookmark, Home, Shop } from './screens';
const customFonts = {
'Montserrat-Regular': require('./assets/fonts/regular.ttf'),
'Montserrat-SemiBold': require('./assets/fonts/semibold.ttf'),
'Libre-Regular': require('./assets/fonts/libre-regular.ttf')
};
export default function App() {
const [ isLoaded ] = useFonts(customFonts);
const [ tab, setTab ] = useState(1);
const providerValue = useMemo(() => ({ tab, setTab }), [ tab, setTab ]);
if (!isLoaded) {
return <AppLoading />;
}
return (
<NavigationContainer>
<AppContext.Provider value={providerValue}>
<View style={styles.container}>
{tab === 1 ? <Home /> : tab === 2 ? <Bookmark /> : tab === 3 ? <Audio /> : <Shop />}
<Footer />
</View>
</AppContext.Provider>
</NavigationContainer>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#fff'
}
});