-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.ios.js
87 lines (81 loc) · 2.41 KB
/
index.ios.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
/**
* Sample React Native App
* https://github.com/facebook/react-native
*/
'use strict';
import React, {TabBarIOS, AppRegistry, StyleSheet, Text, View, WebView} from 'react-native';
// import App from './components/App/App.js';
import Users from './components/Users.js';
import Auth from './components/Auth';
import Favorites from './components/Favorites.js';
import Search from './components/Search.js';
import {appModel} from './stores/stores.js';
class maya extends React.Component {
constructor(props) {
super(props);
this.state = {
token: appModel.get('token'),
selectedTab: 'search'
};
}
componentDidMount() {
appModel.on('change:token', () => {
console.log('Change token');
this.setState({token: appModel.get('token')})
});
}
render() {
console.log('index', this.state.token);
if (this.state.token) {
return (
<TabBarIOS selectedTab={this.state.selectedTab}>
<TabBarIOS.Item
selected={this.state.selectedTab === 'featured'}
icon={{uri: 'wedding-photo'}}
title='Spy'
onPress={() => {
this.setState({
selectedTab: 'featured'
});
}}>
<Favorites />
</TabBarIOS.Item>
<TabBarIOS.Item
selected={this.state.selectedTab === 'search'}
icon={{uri: 'female'}}
title='Girls'
onPress={() => {
this.setState({
selectedTab: 'search'
});
}}>
<Users />
</TabBarIOS.Item>
<TabBarIOS.Item
selected={this.state.selectedTab === 'options'}
icon={{uri: 'binoculars'}}
title='Find More'
onPress={() => {
this.setState({
selectedTab: 'options'
});
}}>
<Search />
</TabBarIOS.Item>
</TabBarIOS>
);
} else {
return <Auth />
}
}
}
var styles = StyleSheet.create({
container: {
// flex: 1,
// justifyContent: 'center',
// alignItems: 'center',
backgroundColor: '#FAFAFA',
flex: 1
}
});
AppRegistry.registerComponent('maya', () => maya);