-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathApp.js
150 lines (144 loc) · 3.63 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
import React , {Component} from 'react';
import {FlatList, StyleSheet, Text, View, TouchableOpacity, ImageBackground, Image, ActivityIndicator, ProgressBarAndroid } from 'react-native';
import { createAppContainer } from "react-navigation";
import { createStackNavigator } from 'react-navigation-stack';
import { createMaterialTopTabNavigator } from 'react-navigation-tabs';
import * as HomeStyle from './styles/HomeStyle.js';
import WebData from './components/WebData.js';
import HomeScreen from './components/HomeScreen.js';
import CommercialVehicleScreen from './components/CommercialVehicleScreen.js';
import NexusScreen from './components/NexusScreen.js';
import AboutScreen from './components/AboutScreen';
import Icon from 'react-native-vector-icons/FontAwesome5';
import LoadingScreen from './components/LoadingScreen.js';
export default class App extends React.Component {
state={
loaded: false
}
constructor(){
super()
}
componentDidMount() {
LoadingScreen.load(v => this.setState({loaded: true}));
}
render() {
return this.state.loaded?<AppContainer />:<View style={styles.container}><Image source={require('./assets/icon.png')} style={{width: 100, height: 100}}></Image><ProgressBarAndroid styleAttr="Horizontal" color='#fff' /></View>;
}
}
// Stack navigator
// we can have different format of navigator bottom , top , stack or none button in return to //render those page
const AppNavigator = createStackNavigator({
Home: {
screen: createMaterialTopTabNavigator({
PersonalVehicle: {
screen: HomeScreen,
navigationOptions: ({ navigation }) => ({
title: 'Personal',
tabBarIcon: ({ tintColor }) => (
<Icon
name="car"
size={17}
color={tintColor} />
),
}),
},
CommercialVehicle: {
screen: CommercialVehicleScreen,
navigationOptions: ({ navigation }) => ({
title: 'Commercial',
tabBarIcon: ({ tintColor }) => (
<Icon
name="truck"
size={17}
color={tintColor} />
),
}),
},
Nexus: {
screen: NexusScreen,
navigationOptions: ({ navigation }) => ({
title: 'NEXUS',
tabBarIcon: ({ tintColor }) => (
<Icon
name="barcode"
size={17}
color={tintColor} />
),
}),
},
},
{
tabBarOptions: {
activeTintColor: '#fff',
inactiveTintColor: '#e6e6e6',
style: {
backgroundColor: '#13b0b9',
},
indicatorStyle: {
backgroundColor: '#fff',
},
showIcon: true,
},
}
),
navigationOptions: ({ navigation }) => ({
headerTitle: 'Home',
headerStyle: {
backgroundColor: '#12A3AA',
},
headerTitleStyle: {
color: '#fff',
},
headerRight: <TouchableOpacity onPress={() => navigation.navigate('About')}>
<Text style={{color: 'white', paddingRight: 20}}>About</Text>
</TouchableOpacity>
}),
},
About: {
screen: AboutScreen,
navigationOptions: ({ navigation }) => ({
headerTitle: 'About',
})
},
Data: {
screen: WebData,
navigationOptions: ({ navigation }) => ({
headerTitle: 'Test',
})
},
});
const AppContainer = createAppContainer(AppNavigator);
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#13b0b9',
alignItems: 'center',
justifyContent: 'center',
},
AboutContainer: {
paddingTop: 30,
flex: 4,
backgroundColor: '#fff',
},
TextAlignCenter: {
textAlign: "center",
},
TextPadding: {
paddingLeft: 30,
paddingRight: 30,
},
DeveloperInfo: {
flex: 1,
flexDirection: 'row',
justifyContent: 'space-between',
paddingRight: 60,
paddingLeft: 60,
},
head: {
fontSize: 20,
fontWeight: "bold",
textAlign: 'center',
paddingLeft: 30,
paddingRight: 30,
},
});