Browse Source

Use bound functions in WelcomeScreen

Guy Carmeli 6 years ago
parent
commit
8524f36067
1 changed files with 13 additions and 26 deletions
  1. 13
    26
      playground/src/screens/WelcomeScreen.js

+ 13
- 26
playground/src/screens/WelcomeScreen.js View File

17
       }
17
       }
18
     };
18
     };
19
   }
19
   }
20
-  constructor(props) {
21
-    super(props);
22
-    this.onClickPush = this.onClickPush.bind(this);
23
-    this.onClickShowModal = this.onClickShowModal.bind(this);
24
-    this.onClickLifecycleScreen = this.onClickLifecycleScreen.bind(this);
25
-    this.onClickPushOptionsScreen = this.onClickPushOptionsScreen.bind(this);
26
-    this.onClickPushExternalComponent = this.onClickPushExternalComponent.bind(this);
27
-    this.onClickPushOrientationMenuScreen = this.onClickPushOrientationMenuScreen.bind(this);
28
-    this.onClickBackHandler = this.onClickBackHandler.bind(this);
29
-    this.onClickPushTopTabsScreen = this.onClickPushTopTabsScreen.bind(this);
30
-    this.onClickShowStaticLifecycleOverlay = this.onClickShowStaticLifecycleOverlay.bind(this);
31
-    this.onClickProvidedId = this.onClickProvidedId.bind(this);
32
-  }
33
 
20
 
34
   render() {
21
   render() {
35
     return (
22
     return (
53
     );
40
     );
54
   }
41
   }
55
 
42
 
56
-  onClickSwitchToTabs() {
43
+  onClickSwitchToTabs = () => {
57
     Navigation.setRoot({
44
     Navigation.setRoot({
58
       bottomTabs: {
45
       bottomTabs: {
59
         children: [
46
         children: [
123
     });
110
     });
124
   }
111
   }
125
 
112
 
126
-  onClickSwitchToSideMenus() {
113
+  onClickSwitchToSideMenus = () => {
127
     Navigation.setRoot({
114
     Navigation.setRoot({
128
       sideMenu: {
115
       sideMenu: {
129
         left: {
116
         left: {
223
     });
210
     });
224
   }
211
   }
225
 
212
 
226
-  async onClickPush() {
213
+  onClickPush = async () => {
227
     await Navigation.push(this.props.componentId, {
214
     await Navigation.push(this.props.componentId, {
228
       component: {
215
       component: {
229
         name: 'navigation.playground.PushedScreen',
216
         name: 'navigation.playground.PushedScreen',
236
     });
223
     });
237
   }
224
   }
238
 
225
 
239
-  async onClickPushExternalComponent() {
226
+  onClickPushExternalComponent = async () => {
240
     await Navigation.push(this.props.componentId, {
227
     await Navigation.push(this.props.componentId, {
241
       externalComponent: {
228
       externalComponent: {
242
         name: 'RNNCustomComponent',
229
         name: 'RNNCustomComponent',
254
     });
241
     });
255
   }
242
   }
256
 
243
 
257
-  onClickLifecycleScreen() {
244
+  onClickLifecycleScreen = () => {
258
     Navigation.push(this.props.componentId, {
245
     Navigation.push(this.props.componentId, {
259
       component: {
246
       component: {
260
         name: 'navigation.playground.LifecycleScreen'
247
         name: 'navigation.playground.LifecycleScreen'
262
     });
249
     });
263
   }
250
   }
264
 
251
 
265
-  onClickShowStaticLifecycleOverlay() {
252
+  onClickShowStaticLifecycleOverlay = () => {
266
     Navigation.showOverlay({
253
     Navigation.showOverlay({
267
       component: {
254
       component: {
268
         name: 'navigation.playground.StaticLifecycleOverlay'
255
         name: 'navigation.playground.StaticLifecycleOverlay'
270
     });
257
     });
271
   }
258
   }
272
 
259
 
273
-  async onClickShowModal() {
260
+  onClickShowModal = async () => {
274
     await Navigation.showModal({
261
     await Navigation.showModal({
275
       stack: {
262
       stack: {
276
         children: [
263
         children: [
284
     });
271
     });
285
   }
272
   }
286
 
273
 
287
-  onClickShowRedbox() {
274
+  onClickShowRedbox = () => {
288
     undefined();
275
     undefined();
289
   }
276
   }
290
 
277
 
291
-  onClickPushOptionsScreen() {
278
+  onClickPushOptionsScreen = () => {
292
     Navigation.push(this.props.componentId, {
279
     Navigation.push(this.props.componentId, {
293
       component: {
280
       component: {
294
         name: 'navigation.playground.OptionsScreen',
281
         name: 'navigation.playground.OptionsScreen',
299
     });
286
     });
300
   }
287
   }
301
 
288
 
302
-  onClickPushTopTabsScreen() {
289
+  onClickPushTopTabsScreen = () => {
303
     Navigation.push(this.props.componentId, {
290
     Navigation.push(this.props.componentId, {
304
       topTabs: {
291
       topTabs: {
305
         children: [
292
         children: [
367
     });
354
     });
368
   }
355
   }
369
 
356
 
370
-  onClickBackHandler() {
357
+  onClickBackHandler = () => {
371
     Navigation.push(this.props.componentId, {
358
     Navigation.push(this.props.componentId, {
372
       component: {
359
       component: {
373
         name: 'navigation.playground.BackHandlerScreen'
360
         name: 'navigation.playground.BackHandlerScreen'
375
     });
362
     });
376
   }
363
   }
377
 
364
 
378
-  onClickPushOrientationMenuScreen() {
365
+  onClickPushOrientationMenuScreen = () => {
379
     Navigation.push(this.props.componentId, {
366
     Navigation.push(this.props.componentId, {
380
       component: {
367
       component: {
381
         name: 'navigation.playground.OrientationSelectScreen'
368
         name: 'navigation.playground.OrientationSelectScreen'
383
     });
370
     });
384
   }
371
   }
385
 
372
 
386
-  onClickProvidedId() {
373
+  onClickProvidedId = () => {
387
     Navigation.showModal({
374
     Navigation.showModal({
388
       stack: {
375
       stack: {
389
         children: [
376
         children: [