Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathApp.js
More file actions
Latest commit
53 lines (48 loc) · 1.92 KB
/
Copy pathApp.js
File metadata and controls
53 lines (48 loc) · 1.92 KB
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
// This import is necessary for any file containing a React component
importReactfrom"react";
// These imports are part of our navigation package, React Navigation
// https://reactnavigation.org/docs/getting-started
import"react-native-gesture-handler";
import{NavigationContainer}from"@react-navigation/native";
import{createStackNavigator}from"@react-navigation/stack";
// Our project has two screens: HomeScreen and GameScreen
// Thus, we import both of these screens
importHomeScreenfrom"./screens/HomeScreen";
importGameScreenfrom"./screens/GameScreen";
import{nameToPic}from"./constants/Constants";
import{Asset}from"expo-asset";
// To initialize and style our Navigation Stack, we call the default methods
// https://reactnavigation.org/docs/hello-react-navigation
constStack=createStackNavigator();
constStackOptions={headerTitleStyle: {fontFamily: "Avenir"}};
// Loading all images for quick use (eliminates lag problem)
// https://docs.expo.io/versions/latest/sdk/asset/
Asset.loadAsync(require("./assets/mdb_logo.png"));
for(varninnameToPic){
Asset.loadAsync(nameToPic[n][1]);
}
// This is the default entry point of our application
// This function returns JSX: a tree-like structure of React components
exportdefaultfunctionApp(){
return(
<NavigationContainer>
<Stack.Navigator>
{/* Our Navigation Stack has two screens:
1) "Match the Members" - our HomeScreen, and...
2) "Play" - our GameScreen
Notice how we can define exactly which components are used for
each screen using the "component" parameter. */}
<Stack.Screen
options={StackOptions}
name="Match the Members"
component={HomeScreen}
/>
<Stack.Screen
options={StackOptions}
name="Play"
component={GameScreen}
/>
</Stack.Navigator>
</NavigationContainer>
);
}