-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.js
89 lines (82 loc) · 2.45 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
import React from 'react';
import { WEATHER_API_ORIGIN } from 'react-native-dotenv'
import { StyleSheet, Text, View } from 'react-native';
import { createStore, applyMiddleware } from 'redux';
import { Provider } from 'react-redux';
import { NativeRouter, Route, Link } from 'react-router-native'
import { Ionicons } from '@expo/vector-icons';
import { Constants } from 'expo';
import axios from 'axios';
import axiosMiddleware from 'redux-axios-middleware';
import { createLogger } from 'redux-logger'
import reducer from './reducer';
import Home from './components/home';
import GetLocation from './components/getLocation';
import GetDates from './components/getDates';
import GetPressure from './components/getPressure';
const client = axios.create({
baseURL: WEATHER_API_ORIGIN,
responseType: 'json'
});
const loggerMiddleware = createLogger({ predicate: (getState, action) => __DEV__ })
const store = createStore(reducer, applyMiddleware(axiosMiddleware(client), loggerMiddleware));
export default class App extends React.Component {
render() {
return (
<Provider store={store}>
<NativeRouter>
<View style={styles.container}>
<View style={styles.nav}>
<Link
to="/"
underlayColor='#592e81'
style={styles.navItem}>
<View style={styles.navLogo}>
<Ionicons style={styles.navLogoIcon} name="md-rainy" size={32} color="#FFF" />
<Text style={styles.navLogoText}>Pressure App</Text>
</View>
</Link>
</View>
<Route exact path="/" render={() => <Home/>}/>
<Route path="/location" render={() => <GetLocation/>}/>
<Route path="/dates" render={() => <GetDates/>}/>
<Route path="/pressure" render={() => <GetPressure/>}/>
</View>
</NativeRouter>
</Provider>
);
}
}
const styles = StyleSheet.create({
container: {
paddingTop: Constants.statusBarHeight,
height: '100%',
backgroundColor: '#592e81'
},
header: {
fontSize: 20,
},
nav: {
height: 50,
flexDirection: 'row',
backgroundColor: '#592e81'
},
navLogo: {
display: 'flex',
flexDirection: 'row',
alignItems: 'center',
justifyContent: 'center'
},
navLogoIcon: {
marginRight: 10
},
navLogoText: {
color: '#FFF',
fontSize: 20
},
navItem: {
flex: 1,
alignItems: 'center',
padding: 10,
},
});