-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAppScreenNavigator.tsx
More file actions
130 lines (111 loc) · 4.32 KB
/
AppScreenNavigator.tsx
File metadata and controls
130 lines (111 loc) · 4.32 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
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
import 'react-native-gesture-handler'
import React from 'react'
import {NavigationContainer} from '@react-navigation/native'
import {
createStackNavigator,
TransitionSpecs,
HeaderStyleInterpolators
} from '@react-navigation/stack';
import { View } from 'react-native';
import {createMaterialTopTabNavigator} from '@react-navigation/material-top-tabs'
import News from './src/screens/News';
import Statistics from './src/screens/Statistics';
import Tips from './src/screens/Tips';
import * as app from './app.json';
import {translate} from './src/i18n';
import CoronaSymptom from './src/screens/CoronaSymptom';
import CoronaPrevention from './src/screens/CoronaPrevention';
import CoronaTreatment from './src/screens/CoronaTreatment';
import EnhancedStats from './src/screens/EnhancedStats';
import Header from './src/components/layout/header';
//import MainScreen from './src/screens/MainScreen'
const Slide = {
gestureDirection: 'horizontal',
transitionSpec: {
open: TransitionSpecs.TransitionIOSSpec,
close: TransitionSpecs.TransitionIOSSpec,
},
headerStyleInterpolator: HeaderStyleInterpolators.forFade,
cardStyleInterpolator: ({ current, next, layouts }:{current: any, next:any, layouts:any}) => {
return {
cardStyle: {
transform: [
{
translateX: current.progress.interpolate({
inputRange: [0, 1],
outputRange: [layouts.screen.width, 0],
}),
},
{
scale: next
? next.progress.interpolate({
inputRange: [0, 1],
outputRange: [1, 0.9],
})
: 1,
},
],
},
overlayStyle: {
opacity: current.progress.interpolate({
inputRange: [0, 1],
outputRange: [0, 0.5],
}),
},
};
},
}
const Tab = createMaterialTopTabNavigator()
const TabbarNavigator = () => (
<Tab.Navigator
tabBarOptions={{
indicatorStyle: {
backgroundColor: '#fff',
height: 3,
},
style: {backgroundColor: '#db162f'},
activeTintColor: '#fff',
inactiveTintColor: '#ffffffaa',
showLabel: true,
}}>
{/*<Tab.Screen name="News" component={News} options = {{tabBarLabel: translate('home.news_tab_title')}}/>*/}
<Tab.Screen name="Tips" component={Tips} options = {{tabBarLabel: translate('home.tips_tab_title')}}/>
<Tab.Screen name="Statistics" component={Statistics} options = {{tabBarLabel: translate('home.stats_tab_title')}}/>
</Tab.Navigator>
)
const Stack = createStackNavigator()
export const AppScreenNavigator = () => (
<NavigationContainer>
<Stack.Navigator
initialRouteName="Home"
headerMode="float"
screenOptions={{
cardOverlayEnabled: true,
gestureEnabled: true,
...Slide,
}}>
<Stack.Screen name = "Home" component = {TabbarNavigator}
options= {{
title: 'Custom animation',
headerTintColor: '#fafafa',
header: () => (<Header/>),
headerStyle: {
backgroundColor: '#db162f',
elevation: 0
},
headerTitle: app.displayName,
}}
/>
<Stack.Screen name = "CoronaSymptom" component = {CoronaSymptom}
options = {{headerTintColor: '#fafafa', headerStyle: {backgroundColor: '#db162f'}, headerTitle: translate('infos.symptoms')}} />
<Stack.Screen name = "CoronaPrevention" component = {CoronaPrevention}
options = {{headerTintColor: '#fafafa', headerStyle: {backgroundColor: '#db162f'}, headerTitle: translate('infos.preventions')}} />
<Stack.Screen name = "CoronaTreatment" component = {CoronaTreatment}
options = {{headerTintColor: '#fafafa', headerStyle: {backgroundColor: '#db162f'}, headerTitle: translate('infos.treatments')}} />
<Stack.Screen name = "CountryStats" component = {EnhancedStats}
options = {{headerTintColor: '#fafafa', headerStyle: {backgroundColor: '#db162f'}, headerTitleStyle: {
fontFamily: 'NunitoSans-Regular',
},headerTitle: translate('statistics.individual.title')}} />
</Stack.Navigator>
</NavigationContainer>
)