This repository has been archived by the owner on Jan 17, 2022. It is now read-only.
/
App.js
123 lines (107 loc) · 3.08 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
import React from 'react'
import { StatusBar } from 'react-native'
//ui kitten
import * as eva from '@eva-design/eva';
import { ApplicationProvider, IconRegistry} from '@ui-kitten/components';
import { EvaIconsPack } from '@ui-kitten/eva-icons';
//navigator
import 'react-native-gesture-handler';
import { NavigationContainer } from '@react-navigation/native';
import { createStackNavigator } from '@react-navigation/stack';
import { CardStyleInterpolators } from '@react-navigation/stack';
import BottomNavigation from './components/BottomNav'
import DetailScreen from './screens/Detail'
import HomeScreen from './screens/Home'
import SearchScreen from './screens/Search'
//redux
import { Provider } from "react-redux";
import store from './store'
// pop up
import { Root } from 'popup-ui'
// configure color scheme
import { Appearance, useColorScheme } from 'react-native-appearance';
// splash screen
import SplashScreen from 'react-native-splash-screen'
// configure navBar color
import changeNavigationBarColor from 'react-native-navigation-bar-color';
/**
* Get the current color scheme
*/
Appearance.getColorScheme();
const Stack = createStackNavigator();
const App = () => {
const colorScheme = useColorScheme()
const barColor = colorScheme === 'light' ? 'white' : '#212b46'
const barStyle = colorScheme == 'light' ? 'dark-content' : 'light-content'
React.useEffect(() => {
SplashScreen.hide()
changeNavigationBarColor(barColor)
}, [])
return(
<Provider store={store}>
<StatusBar backgroundColor={barColor} barStyle={barStyle}/>
<IconRegistry icons={EvaIconsPack} />
<ApplicationProvider
{...eva}
theme={colorScheme === 'light' ? eva.light : eva.dark}
>
{/* Root for Toast (bottom pop up) */}
<Root>
<NavigationContainer>
<Stack.Navigator
initialRouteName="Main"
screenOptions={{
headerShown: false,
}}
>
<Stack.Screen
name="Main"
component={BottomNavigation}
/>
<Stack.Screen
name="Home"
component={HomeScreen}
/>
<Stack.Screen
name="Detail"
component={DetailScreen}
options={{
cardStyleInterpolator: CardStyleInterpolators.forHorizontalIOS,
transitionSpec: {
open:animationConfig,
close:animationConfig
}
}}
/>
<Stack.Screen
name="Search"
component={SearchScreen}
options={{
cardStyleInterpolator: CardStyleInterpolators.forModalPresentationIOS,
gestureEnabled:true,
gestureDirection:'vertical',
transitionSpec: {
open:animationConfig,
close:animationConfig
}
}}
/>
</Stack.Navigator>
</NavigationContainer>
</Root>
</ApplicationProvider>
</Provider>
)
}
const animationConfig = {
animation: 'spring',
config: {
stiffness: 1000,
damping: 500,
mass: 3,
overshootClamping: true,
restDisplacementThreshold: 0.01,
restSpeedThreshold: 0.01,
},
}
export default App