-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.js
65 lines (54 loc) · 1.91 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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
// In App.js in a new project
import * as React from 'react';
import { Text, StyleSheet, ActivityIndicator } from 'react-native';
import { NavigationContainer } from '@react-navigation/native';
import { createNativeStackNavigator } from '@react-navigation/native-stack';
import { useFonts } from "expo-font";
import { View } from 'react-native';
/*import AsyncStorage from '@react-native-async-storage/async-storage'; */
import HomeScreen from './components/Home';
import MenuScreen from './components/Menu';
import CardsScreen from './components/Cards';
const Stack = createNativeStackNavigator();
const messageColor = '#c3c3c3';
function App() {
const Message = ({ text }) => {
return (
<View style={styles.messageContainer}>
<ActivityIndicator size="small" color={messageColor} />
<Text style={styles.messageText}>{text}</Text>
</View>
);
}
// Loading all Fonts
const [loaded] = useFonts({
'Montserrat-Regular': require('./assets/fonts/Montserrat-Regular.ttf'),
'Montserrat-Bold': require('./assets/fonts/Montserrat-Bold.ttf'),
'Montserrat-Light': require('./assets/fonts/Montserrat-Light.ttf'),
});
if (!loaded) return (<Message text={"Loading fonts"}/>);
// Returning the Pages
return (
<NavigationContainer>
<Stack.Navigator initialRouteName='Home'>
<Stack.Screen name="Home" component={HomeScreen} options={{ headerShown: false }} />
<Stack.Screen name="Menu" component={MenuScreen} options={{ headerShown: false }} />
<Stack.Screen name="Cards" component={CardsScreen} options={{ headerShown: false }} />
</Stack.Navigator>
</NavigationContainer>
);
}
export default App;
const styles = StyleSheet.create({
messageContainer: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
paddingHorizontal: 50,
},
messageText: {
color: messageColor,
textAlign: 'center',
marginTop: 20,
}
});