-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.js
157 lines (141 loc) · 3.74 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
import React, {useState} from 'react';
import {NavigationContainer} from '@react-navigation/native';
import {createBottomTabNavigator} from '@react-navigation/bottom-tabs';
import {createStackNavigator} from '@react-navigation/stack';
import AppLoading from './src/components/AppLoading';
import {Animated} from 'react-native';
import {
ModelHub,
SubjectScreen,
PortalHub,
DeckHub,
ModelScreen,
ModelView,
PortalView,
DeckView,
AssignCard,
} from './src/screens';
import Icons from './src/constants/Icons';
import TabBarButton from './src/components/TabBarButton';
const Stack = createStackNavigator();
const ModelStack = () => {
return (
<Stack.Navigator screenOptions={{headerShown: false}}>
<Stack.Screen name="ModelHub" component={ModelHub} />
<Stack.Screen name="SubjectScreen" component={SubjectScreen} />
<Stack.Screen name="ModelScreen" component={ModelScreen} />
<Stack.Screen name="PortalHub" component={PortalHub} />
</Stack.Navigator>
);
};
const PortalStack = () => {
return (
<Stack.Navigator screenOptions={{headerShown: false}}>
<Stack.Screen name="PortalHub" component={PortalHub} />
</Stack.Navigator>
);
};
const DeckStack = () => {
return (
<Stack.Navigator screenOptions={{headerShown: false}}>
<Stack.Screen name="DeckHub" component={DeckHub} />
</Stack.Navigator>
);
};
const Tab = createBottomTabNavigator();
//TODO: icon and tab bar sizes need to be responsive maybe
const TabArr = [
{
route: 'Models',
name: 'Models',
type: Icons.Feather,
activeIcon: 'codesandbox',
inactiveIcon: 'box',
component: ModelStack,
},
{
route: 'Portals',
name: 'Portals',
type: Icons.Ionicons,
activeIcon: 'planet',
inactiveIcon: 'planet-outline',
component: PortalStack,
},
{
route: 'Deck',
name: 'Deck',
type: Icons.MaterialCommunityIcons,
activeIcon: 'cards-playing-outline',
inactiveIcon: 'cards-outline',
component: DeckStack,
},
];
const TabNavigator = () => (
<Tab.Navigator
screenOptions={{
headerShown: false,
tabBarStyle: {
height: 60,
position: 'absolute',
bottom: 12,
right: 12,
left: 12,
borderRadius: 16,
},
}}>
{TabArr.map((item, index) => {
return (
<Tab.Screen
key={index}
options={{
tabBarShowLabel: false,
tabBarButton: props => <TabBarButton {...props} item={item} />,
}}
name={item.route}
component={item.component}
/>
);
})}
</Tab.Navigator>
);
export default () => {
const [initVisible, setInitVisible] = useState(true);
const [fadeAnim, setFadeAnim] = useState(new Animated.Value(1));
const fadeOut = () => {
Animated.timing(fadeAnim, {
toValue: 0,
duration: 500,
useNativeDriver: true,
}).start();
};
setTimeout(() => {
setInitVisible(false);
}, 3000);
setTimeout(() => {
fadeOut();
}, 2500);
return (
<>
<NavigationContainer>
<Stack.Navigator screenOptions={{headerShown: false}}>
<Stack.Screen name="TabNavigator" component={TabNavigator} />
<Stack.Screen name="ModelView" component={ModelView} />
<Stack.Screen name="PortalView" component={PortalView} />
<Stack.Screen name="DeckView" component={DeckView} />
<Stack.Screen name="AssignCard" component={AssignCard} />
</Stack.Navigator>
</NavigationContainer>
{initVisible && (
<Animated.View
style={{
position: 'absolute',
width: '100%',
height: '100%',
opacity: fadeAnim,
}}>
<AppLoading />
</Animated.View>
)}
</>
);
};