-
Notifications
You must be signed in to change notification settings - Fork 82
/
Copy pathMovieListScreen.js
executable file
·212 lines (173 loc) · 7.75 KB
/
MovieListScreen.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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
'use strict';
var React = require('react');
var ReactNative = require('react-native');
var {
AppRegistry,
StyleSheet,
Text,
ScrollView,
TouchableOpacity
} = ReactNative;
require('./LightBox');
require('./Notification');
var Controllers = require('react-native-controllers');
var {
Modal,
ControllerRegistry,
Constants,
Notification
} = Controllers;
var MovieListScreen = React.createClass({
componentDidMount: function() {
Controllers.NavigationControllerIOS("movies_nav").setLeftButtons([{
title: "Burger",
onPress: function() {
Controllers.DrawerControllerIOS("drawer").toggle({side:"left"});
}
}]);
Controllers.NavigationControllerIOS("movies_nav").setRightButtons([{
title: "MegaBurger",
onPress: function() {
Controllers.DrawerControllerIOS("drawer").toggle({side:"right"});
}
}]);
},
onButtonClick: function(val) {
Controllers.DrawerControllerIOS("drawer").setStyle({
animationType: val
});
},
onShowLightBoxClick: function(backgroundBlur, backgroundColor = undefined) {
Modal.showLightBox({
component: 'LightBox',
passProps: {
greeting: 'hello world'
},
style: {
backgroundBlur: backgroundBlur,
backgroundColor: backgroundColor
}
});
},
onShowNotificationClick: function(animationParams, shadowRadius, position) {
Notification.show({
component: 'NotificationExample',
passProps: {
greeting: 'This is a Notification!'
},
position: position,
animation: animationParams,
dismissWithSwipe: true,
autoDismissTimerSec: 5,
shadowRadius: shadowRadius
});
},
onShowModalVcClick: async function() {
// defaults: Modal.showController('ModalScreenTester');
// this example shows animation type and passProps
Modal.showController('ModalScreenTester', 'slide-up', { greeting: 'hi there!' });
},
onShowModalMoreDrawerOptionsVcClick: async function() {
//Modal.showController('MoreDrawerScreenTester');
ControllerRegistry.setRootController('MoreDrawerScreenTester', 'slide-down', { greeting: 'how you doin?' });
},
onToggleTabBarClick: async function() {
this.setState({
tabBarHidden: !this.state.tabBarHidden
});
Controllers.TabBarControllerIOS("main").setHidden({hidden: this.state.tabBarHidden, animated: true});
},
onReplaceRootAnimatedClick: function() {
// this example shows animation type and passProps
ControllerRegistry.setRootController('ModalScreenTester', 'slide-down', { greeting: 'how you doin?' });
},
render: function() {
return (
<ScrollView style={styles.container} contentInset={{bottom: 50}}>
<Text style={{fontSize: 20, textAlign: 'center', margin: 10, fontWeight: '500', marginTop: 30}}>
Side Menu Example
</Text>
<Text style={{fontSize: 16, textAlign: 'center', marginHorizontal: 30, marginBottom: 20}}>
There's a right and a left side menu in this example. Control the side menu animation using the options below:
</Text>
<TouchableOpacity onPress={ this.onButtonClick.bind(this, Constants.MMDRAWER_DOOR) } >
<Text style={styles.button}>Door</Text>
</TouchableOpacity>
<TouchableOpacity onPress={ this.onButtonClick.bind(this, Constants.MMDRAWER_PARALLAX) }>
<Text style={styles.button}>Parallax</Text>
</TouchableOpacity>
<TouchableOpacity onPress={ this.onButtonClick.bind(this, Constants.MMDRAWER_SLIDE) }>
<Text style={styles.button}>Slide</Text>
</TouchableOpacity>
<TouchableOpacity onPress={ this.onButtonClick.bind(this, Constants.MMDRAWER_SLIDE_AND_SCALE) } >
<Text style={styles.button}>Slide & Scale</Text>
</TouchableOpacity>
<TouchableOpacity onPress={ this.onShowModalMoreDrawerOptionsVcClick }>
<Text style={styles.button}>More...</Text>
</TouchableOpacity>
<Text style={{fontSize: 20, textAlign: 'center', margin: 10, fontWeight: '500', marginTop: 30}}>
Modal Example
</Text>
<Text style={{fontSize: 16, textAlign: 'center', marginHorizontal: 30, marginBottom: 20}}>
Use the various options below to bring up modal screens:
</Text>
<TouchableOpacity onPress={ this.onShowLightBoxClick.bind(this, "dark") }>
<Text style={styles.button}>LightBox (dark blur)</Text>
</TouchableOpacity>
<TouchableOpacity onPress={ this.onShowLightBoxClick.bind(this, "light") }>
<Text style={styles.button}>LightBox (light blur)</Text>
</TouchableOpacity>
<TouchableOpacity onPress={ this.onShowLightBoxClick.bind(this, "light", "rgba(66, 141, 200, 0.2)") }>
<Text style={styles.button}>LightBox (light blur + color overlay)</Text>
</TouchableOpacity>
<TouchableOpacity onPress={ this.onShowLightBoxClick.bind(this, "none") }>
<Text style={styles.button}>LightBox (no blur, no color overlay)</Text>
</TouchableOpacity>
<TouchableOpacity onPress={ this.onShowModalVcClick }>
<Text style={styles.button}>Show Modal ViewController</Text>
</TouchableOpacity>
<TouchableOpacity onPress={ this.onReplaceRootAnimatedClick }>
<Text style={styles.button}>Replace root animated</Text>
</TouchableOpacity>
<TouchableOpacity onPress={ this.onShowNotificationClick.bind(this, Notification.AnimationPresets.default, 0, 'top') }>
<Text style={styles.button}>Show Default Notification</Text>
</TouchableOpacity>
<TouchableOpacity onPress={ this.onShowNotificationClick.bind(this, Notification.AnimationPresets.simple, 0, 'top') }>
<Text style={styles.button}>Show Simple Notification</Text>
</TouchableOpacity>
<TouchableOpacity onPress={ this.onShowNotificationClick.bind(this, Notification.AnimationPresets.default, 10, 'top') }>
<Text style={styles.button}>Show Notification With Shadow</Text>
</TouchableOpacity>
<TouchableOpacity onPress={ this.onShowNotificationClick.bind(this, Notification.AnimationPresets.swing, 0, 'top') }>
<Text style={styles.button}>Show Swing Notification</Text>
</TouchableOpacity>
<TouchableOpacity onPress={ this.onShowNotificationClick.bind(this, Notification.AnimationPresets.default, 0, 'bottom') }>
<Text style={styles.button}>Show Bottom Notification</Text>
</TouchableOpacity>
</ScrollView>
);
},
});
var styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#F5FCFF'
},
button: {
textAlign: 'center',
fontSize: 18,
marginBottom: 10,
marginTop:10,
color:'blue'
},
lineView: {
height: 1,
marginTop: 4,
marginBottom: 4,
marginLeft: 8,
marginRight: 8,
backgroundColor:'gray'
}
});
AppRegistry.registerComponent('MovieListScreen', () => MovieListScreen);
module.exports = MovieListScreen;