-
Notifications
You must be signed in to change notification settings - Fork 7
/
App.js
155 lines (147 loc) · 4.1 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
import React from "react";
import { createAppContainer, createSwitchNavigator } from "react-navigation";
import { StyleSheet, Platform, StatusBar, View } from "react-native";
import { createStackNavigator } from "react-navigation-stack";
import { createBottomTabNavigator } from "react-navigation-tabs";
import { Ionicons } from "@expo/vector-icons";
import { enableScreens } from "react-native-screens";
import HomeScreen from "./screens/home/HomeScreen";
import LoadingScreen from "./screens/LoadingScreen";
import SavedItemScreen from "./screens/user/SavedItemScreen";
import AccountScreen from "./screens/user/AccountScreen";
import CubeScreen from "./screens/cube/CubeScreen";
import PrismScreen from "./screens/prism/PrismScreen";
import SphereScreen from "./screens/sphere/SphereScreen";
import OctahedronScreen from "./screens/octahedron/OctahedronScreen";
import BaseLayoutScreen from "./screens/BaseLayoutScreen";
import ConeScreen from "./screens/cone/ConeScreen";
import globalStorage from "./store";
import { Provider } from "react-redux";
import { PersistGate } from "redux-persist/integration/react";
import Spinner from "./Spinner";
import Toast from "react-native-toast-message";
import LoginScreen from "./screens/auth/LoginScreen";
import RegisterScreen from "./screens/auth/RegisterScreen";
enableScreens();
const AuthStack = createStackNavigator(
{
Login: LoginScreen,
Register: RegisterScreen,
},
{
headerMode: "none",
}
);
const AppBottomNavigator = createBottomTabNavigator(
{
Home: {
screen: HomeScreen,
navigationOptions: {
tabBarIcon: ({ tintColor }) => (
<Ionicons name="ios-home" size={24} color={tintColor} />
),
},
},
Items: {
screen: SavedItemScreen,
navigationOptions: {
tabBarIcon: ({ tintColor }) => (
<Ionicons name="ios-albums" size={24} color={tintColor} />
),
},
},
Account: {
screen: AccountScreen,
navigationOptions: {
tabBarIcon: ({ tintColor }) => (
<Ionicons name="ios-contact" size={24} color={tintColor} />
),
},
},
},
{
headerMode: "none",
initialRouteName: "Home",
backBehavior: "order",
//tabBarComponent: (props) => <CustomTabBar {...props} />,
}
);
const Object3DNavigator = createStackNavigator(
{
CubeScreen: {
screen: (props) => <CubeScreen initShape={"cube"} {...props} />,
},
SphereScreen: {
screen: (props) => <SphereScreen initShape={"sphere"} {...props} />,
},
BaseLayoutScreen: {
screen: (props) => (
<BaseLayoutScreen
initShape={""}
params={
props.navigation && props.navigation.state
? props.navigation.state.params
: null
}
/>
),
},
ConeScreen: {
screen: (props) => <ConeScreen initShape={"cone"} {...props} />,
},
OctahedronScreen: {
screen: (props) => (
<OctahedronScreen initShape={"octahedron"} {...props} />
),
},
PrismScreen: {
screen: (props) => <PrismScreen initShape={"prism"} {...props} />,
},
},
{
headerMode: "none",
}
);
const AppNavigator = createAppContainer(
createSwitchNavigator(
{
Loading: LoadingScreen,
App: AppBottomNavigator,
Auth: AuthStack,
Objects: Object3DNavigator,
},
{
initialRouteName: "Loading",
}
)
);
export default function App() {
console.disableYellowBox = true;
return (
<Provider store={globalStorage.store}>
<PersistGate
persistor={globalStorage.persistor}
loading={<Spinner visible={true} />}
>
<StatusBar style="dark" translucent={true} />
<View
style={{
flex: 1,
marginTop: Platform.OS === "android" ? StatusBar.currentHeight : 0,
}}
>
<AppNavigator />
</View>
<Toast ref={(ref) => Toast.setRef(ref)} />
</PersistGate>
</Provider>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: "#fff",
alignItems: "center",
justifyContent: "center",
},
});