-
Notifications
You must be signed in to change notification settings - Fork 5
/
index.ios.js
75 lines (64 loc) · 1.74 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
/**
* NZ Festival Demo App
* https://github.com/facebook/react-native
*/
'use strict';
import React, {
AppRegistry,
Component,
Text,
View,
Navigator
} from 'react-native';
import config from './config';
import styles from './styles';
import Home from './views/home';
import EventInfo from './views/eventInfo';
class Festival extends Component {
constructor(props) {
super(props)
this._renderScene = this._renderScene.bind(this);
this._configureScene = this._configureScene.bind(this);
}
_renderScene(route, navigator) {
if (route.name === 'home') {
return (
<Home
name={route.name}
onDetail={(details, image) => {
navigator.push({
name: 'event',
details,
image
})
}}
/>
);
}
if (route.name === 'event') {
return (
<EventInfo
name={route.name}
details={route.details}
image={route.image}
onBack={() => { navigator.pop() }}
/>
);
}
}
_configureScene(route) {
if (route.sceneConfig) {
return route.sceneConfig;
}
return Navigator.SceneConfigs.FloatFromRight;
}
render() {
return (
<Navigator
initialRoute={{ name: 'home', index: 0}}
renderScene={this._renderScene}
configureScene={this._configureScene} />
);
}
}
AppRegistry.registerComponent('Festival', () => Festival);