Browse Source

Use bound functions in OptionsScreen.js

Guy Carmeli 6 years ago
parent
commit
05354fd2ae
1 changed files with 12 additions and 24 deletions
  1. 12
    24
      playground/src/screens/OptionsScreen.js

+ 12
- 24
playground/src/screens/OptionsScreen.js View File

90
     };
90
     };
91
   }
91
   }
92
 
92
 
93
-  constructor(props) {
94
-    super(props);
95
-    this.onClickDynamicOptions = this.onClickDynamicOptions.bind(this);
96
-    this.onClickShowTopBar = this.onClickShowTopBar.bind(this);
97
-    this.onClickHideTopBar = this.onClickHideTopBar.bind(this);
98
-    this.onClickScrollViewScreen = this.onClickScrollViewScreen.bind(this);
99
-    this.onClickTopBarTransparent = this.onClickTopBarTransparent.bind(this);
100
-    this.onClickTopBarOpaque = this.onClickTopBarOpaque.bind(this);
101
-    this.onClickCustomTranstition = this.onClickCustomTranstition.bind(this);
102
-    this.onClickShowOverlay = this.onClickShowOverlay.bind(this);
103
-    this.onClickPushDefaultOptionsScreen = this.onClickPushDefaultOptionsScreen.bind(this);
104
-    this.onClickFab = this.onClickFab.bind(this);
105
-  }
106
-
107
   render() {
93
   render() {
108
     return (
94
     return (
109
       <View style={styles.root}>
95
       <View style={styles.root}>
167
     }
153
     }
168
   }
154
   }
169
 
155
 
170
-  onClickDynamicOptions() {
156
+  onClickDynamicOptions = () => {
171
     Navigation.setOptions(this.props.componentId, {
157
     Navigation.setOptions(this.props.componentId, {
172
       topBar: {
158
       topBar: {
173
         title: {
159
         title: {
182
     });
168
     });
183
   }
169
   }
184
 
170
 
185
-  onClickScrollViewScreen() {
171
+  onClickScrollViewScreen = () => {
186
     Navigation.push(this.props.componentId, {
172
     Navigation.push(this.props.componentId, {
187
       component: {
173
       component: {
188
         name: 'navigation.playground.ScrollViewScreen'
174
         name: 'navigation.playground.ScrollViewScreen'
190
     });
176
     });
191
   }
177
   }
192
 
178
 
193
-  onClickCustomTranstition() {
179
+  onClickCustomTranstition = () => {
194
     Navigation.push(this.props.componentId, {
180
     Navigation.push(this.props.componentId, {
195
       component: {
181
       component: {
196
         name: 'navigation.playground.CustomTransitionOrigin'
182
         name: 'navigation.playground.CustomTransitionOrigin'
198
     });
184
     });
199
   }
185
   }
200
 
186
 
201
-  onClickTopBarTransparent() {
187
+  onClickTopBarTransparent = () => {
202
     Navigation.setOptions(this.props.componentId, {
188
     Navigation.setOptions(this.props.componentId, {
203
       topBar: {
189
       topBar: {
204
         transparent: true
190
         transparent: true
205
       }
191
       }
206
     });
192
     });
207
   }
193
   }
208
-  onClickTopBarOpaque() {
194
+  
195
+  onClickTopBarOpaque = () => {
209
     Navigation.setOptions(this.props.componentId, {
196
     Navigation.setOptions(this.props.componentId, {
210
       topBar: {
197
       topBar: {
211
         transparent: false
198
         transparent: false
212
       }
199
       }
213
     });
200
     });
214
   }
201
   }
215
-  onClickShowTopBar() {
202
+  
203
+  onClickShowTopBar = () => {
216
     Navigation.setOptions(this.props.componentId, {
204
     Navigation.setOptions(this.props.componentId, {
217
       topBar: {
205
       topBar: {
218
         visible: true,
206
         visible: true,
221
     });
209
     });
222
   }
210
   }
223
 
211
 
224
-  onClickHideTopBar() {
212
+  onClickHideTopBar = () => {
225
     Navigation.setOptions(this.props.componentId, {
213
     Navigation.setOptions(this.props.componentId, {
226
       topBar: {
214
       topBar: {
227
         visible: false,
215
         visible: false,
230
     });
218
     });
231
   }
219
   }
232
 
220
 
233
-  onClickFab() {
221
+  onClickFab = () => {
234
     Navigation.setOptions(this.props.componentId, {
222
     Navigation.setOptions(this.props.componentId, {
235
       fab: {
223
       fab: {
236
         id: FAB,
224
         id: FAB,
240
     });
228
     });
241
   }
229
   }
242
 
230
 
243
-  onClickShowOverlay(interceptTouchOutside) {
231
+  onClickShowOverlay = (interceptTouchOutside) => {
244
     Navigation.showOverlay({
232
     Navigation.showOverlay({
245
       component: {
233
       component: {
246
         name: 'navigation.playground.CustomDialog',
234
         name: 'navigation.playground.CustomDialog',
253
     });
241
     });
254
   }
242
   }
255
 
243
 
256
-  onClickPushDefaultOptionsScreen() {
244
+  onClickPushDefaultOptionsScreen = () => {
257
     Navigation.setDefaultOptions({
245
     Navigation.setDefaultOptions({
258
       topBar: {
246
       topBar: {
259
         visible: false,
247
         visible: false,