-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
65 lines (60 loc) · 1.97 KB
/
index.js
File metadata and controls
65 lines (60 loc) · 1.97 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
import React, { Component } from 'react';
import { AppRegistry, ActivityIndicator, AsyncStorage, Text, View, Image } from 'react-native';
import { Router, Scene, Actions } from 'react-native-router-flux';
import LoginForm from './src/screens/LoginForm';
import Checkin from './src/screens/Checkin';
import Dashboard from './src/screens/Dashboard';
class App extends Component {
constructor() {
super();
this.state = { hasToken: false, isLoaded: false };
}
componentDidMount() {
AsyncStorage.getItem('username').then((token) =>{
this.setState({ hasToken: token !== null, isLoaded: true })
});
}
render() {
if (!this.state.isLoaded) {
return <ActivityIndicator />
} else {
return (
<Router>
<Scene key='root'>
<Scene key='Login'
component={LoginForm}
hideNavBar={true}
initial={!this.state.hasToken}
title='Login'
/>
<Scene
key='main'
hideNavBar={true}
initial={this.state.hasToken}
>
<Scene key='tabbar'
tabs={true}
tabbarStyle={{ backgroundColor: 'green' }}
>
<Scene key='Checkin'
hideNavBar={true}
icon={() => <Image style={{height: 30, width: 30}} source={require('./feel_icon.png')}/>}
component={Checkin}
title='Checkin'
/>
<Scene key='Dashboard'
icon={() => <Image style={{height: 30, width: 30}} source={require('./dashboard_icon.png')}/>}
hideNavBar={true}
component={Dashboard}
title='Dashboard'
/>
</Scene>
</Scene>
</Scene>
</Router>
);
}
}
};
// AppRegistry.registerComponent('thrive', () => ExtrasExample);
AppRegistry.registerComponent('thrive', () => App);