-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.ios.js
76 lines (67 loc) · 1.68 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
var React = require('react-native');
var database = require('./app/utils/database');
var Main = require('./app/components/Main');
var menu = require('./app/components/imgs/ic_menu.png');
var search = require('./app/components/imgs/ic_search.png');
var {
AppRegistry,
StyleSheet,
NavigatorIOS,
View
} = React;
var styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#111111',
}
});
class places extends React.Component {
constructor(){
super()
this.state = {
dbReady: false,
}
}
componentWillMount(){
database.initialize()
.then(() => {this.setState({dbReady: true})})
.catch(() => {
database.populateDB()
.then(() => {this.setState({dbReady: true})});
})
}
render() {
if(this.state.dbReady){
return (
<NavigatorIOS
style={styles.container}
ref="nav"
initialRoute={{
title: 'Places',
component: Main,
passProps: {
filters: {
category: 0,
tags: [0],
select: 0,
},
ref: (component) => {this.pushedComponent = component},
},
leftButtonIcon: menu,
onLeftButtonPress: () => {
this.pushedComponent && this.pushedComponent.handleLeftButtonPress();
},
rightButtonIcon: search,
onRightButtonPress: () => {
this.pushedComponent && this.pushedComponent.handleRightButtonPress();
}
}} />
);
} else {
return(
<View />
);
}
}
}
AppRegistry.registerComponent('places', () => places);