-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.android.js
85 lines (77 loc) · 2.03 KB
/
index.android.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
/**
* Sample React Native App
* https://github.com/facebook/react-native
*/
import React, {
AppRegistry,
BackAndroid,
Component,
ListView,
ScrollView,
Navigator,
View,
Text,
TextInput,
} from 'react-native';
import CameraViewAndroid from './components/CameraViewAndroid';
import HomeViewAndroid from './components/HomeViewAndroid';
import RecordFormViewAndroid from './components/RecordFormViewAndroid';
import styles from './styles/Initial';
import MockData from './data/records';
const actions = [
{title: 'Settings', icon: require('image!app_logo'), show: 'always'},
{title: 'Boom', icon: require('image!app_logo'), show: 'always'},
];
class NotitieBlok extends Component {
constructor(props) {
super(props);
const ds = new ListView.DataSource({rowHasChanged: (r1, r2) => r1 !== r2});
this.state = {
dataSource: ds.cloneWithRows(MockData.records),
colorProps: {
titleColor: 'red'
}
};
}
render() {
return (
<Navigator
initialRoute={{name: 'ABC Notitie Blok', id:'home' ,index: 0}}
renderScene={this.renderScene.bind(this)}
configureScene={route => (
route.sceneConfig || Navigator.SceneConfigs.HorizontalSwipeJump
)}
ref="navigator"/>
);
}
renderScene(route, navigator) {
BackAndroid.addEventListener('hardwareBackPress', function() {
if(navigator && navigator.getCurrentRoutes().length > 1) {
console.log(navigator.getCurrentRoutes());
navigator.pop();
return true;
}
return false;
});
switch (route.id) {
case 'home':
return(
<HomeViewAndroid
navigator={navigator}
records={this.state.dataSource} />
);
case 'new':
return (
<RecordFormViewAndroid
navigator={navigator} />
);
case 'camera':
return (
<CameraViewAndroid
navigator={navigator}
route={route} {...this.props} />
);
}
}
}
AppRegistry.registerComponent('NotitieBlok', () => NotitieBlok);