Browse Source

Some more code clean up in playground app

Guy Carmeli 5 years ago
parent
commit
eb17eb2139
1 changed files with 2 additions and 438 deletions
  1. 2
    438
      playground/src/screens/LayoutsScreen.js

+ 2
- 438
playground/src/screens/LayoutsScreen.js View File

@@ -58,317 +58,16 @@ class LayoutsScreen extends React.Component {
58 58
   sideMenu = () => Navigation.showModal({
59 59
     sideMenu: {
60 60
       left: {...component(Screens.SideMenuLeft)},
61
-      center: {
62
-        ...stack({
61
+      center: stack({
63 62
           component: {
64 63
             id: 'SideMenuCenter',
65 64
             name: Screens.SideMenuCenter
66 65
           }
67
-        })
68
-      },
66
+        }),
69 67
       right: {...component(Screens.SideMenuRight)}
70 68
     }
71 69
   });
72 70
 
73
-  onClickSwitchToTabs = () => {
74
-    Navigation.setRoot({
75
-      root: {
76
-        bottomTabs: {
77
-          id: 'BottomTabs',
78
-          children: [
79
-            {
80
-              stack: {
81
-                id: 'TAB1_ID',
82
-                children: [
83
-                  {
84
-                    component: {
85
-                      name: 'navigation.playground.TextScreen',
86
-                      passProps: {
87
-                        text: 'This is tab 1',
88
-                        myFunction: () => 'Hello from a function!'
89
-                      },
90
-                      options: {
91
-                        topBar: {
92
-                          visible: true,
93
-                          animate: false,
94
-                          title: {
95
-                            text: 'React Native Navigation!'
96
-                          }
97
-                        },
98
-                        bottomTab: {
99
-                          text: 'Tab 1',
100
-                          icon: require('../images/colored_tab_icon.png'),
101
-                          testID: testIDs.FIRST_TAB_BAR_BUTTON
102
-                        }
103
-                      }
104
-                    }
105
-                  }
106
-                ],
107
-                options: {
108
-                  topBar: {
109
-                    visible: false
110
-                  }
111
-                }
112
-              }
113
-            },
114
-            {
115
-              stack: {
116
-                children: [
117
-                  {
118
-                    component: {
119
-                      name: 'navigation.playground.TextScreen',
120
-                      passProps: {
121
-                        text: 'This is tab 2'
122
-                      }
123
-                    }
124
-                  }
125
-                ],
126
-                options: {
127
-                  bottomTab: {
128
-                    text: 'Tab 2',
129
-                    icon: require('../images/two.png'),
130
-                    iconColor: '#1B4C77',
131
-                    selectedIconColor: '#0f0',
132
-                    testID: testIDs.SECOND_TAB_BAR_BUTTON
133
-                  }
134
-                }
135
-              }
136
-            },
137
-            {
138
-              component: {
139
-                name: 'navigation.playground.TextScreen',
140
-                passProps: {
141
-                  text: 'This is tab 3',
142
-                  myFunction: () => 'Hello from a function!'
143
-                },
144
-                options: {
145
-                  topBar: {
146
-                    visible: true,
147
-                    animate: false
148
-                  },
149
-                  bottomTab: {
150
-                    text: 'Tab 3',
151
-                    icon: require('../images/one.png'),
152
-                    iconColor: '#1B4C77',
153
-                    selectedIconColor: '#0f0',
154
-                    selectedIcon: require('../images/one.png')
155
-                  }
156
-                }
157
-              }
158
-            }
159
-          ],
160
-          options: {
161
-            bottomTabs: {
162
-              titleDisplayMode: 'alwaysShow',
163
-              testID: testIDs.BOTTOM_TABS_ELEMENT
164
-            }
165
-          }
166
-        }
167
-      }
168
-    });
169
-  }
170
-
171
-  onClickSwitchToSideMenus = () => {
172
-    Navigation.setRoot({
173
-      root: {
174
-        sideMenu: {
175
-          left: {
176
-            component: {
177
-              name: 'navigation.playground.SideMenuScreen',
178
-              passProps: {
179
-                side: 'left'
180
-              }
181
-            }
182
-          },
183
-          center: {
184
-            bottomTabs: {
185
-              children: [
186
-                {
187
-                  stack: {
188
-                    id: 'tab1Stack',
189
-                    children: [
190
-                      {
191
-                        component: {
192
-                          name: 'navigation.playground.TextScreen',
193
-                          passProps: {
194
-                            text: 'This is a side menu center screen tab 1'
195
-                          }
196
-                        }
197
-                      }
198
-                    ],
199
-                    options: {
200
-                      bottomTab: {
201
-                        iconColor: 'red',
202
-                        textColor: 'red',
203
-                        selectedIconColor: 'purple',
204
-                        selectedTextColor: 'purple',
205
-                        text: 'Tab 1',
206
-                        icon: require('../images/one.png'),
207
-                        testID: testIDs.FIRST_TAB_BAR_BUTTON
208
-                      }
209
-                    }
210
-                  }
211
-                },
212
-                {
213
-                  stack: {
214
-                    children: [
215
-                      {
216
-                        component: {
217
-                          name: 'navigation.playground.TextScreen',
218
-                          passProps: {
219
-                            text: 'This is a side menu center screen tab 2'
220
-                          }
221
-                        }
222
-                      }
223
-                    ],
224
-                    options: {
225
-                      bottomTab: {
226
-                        text: 'Tab 2',
227
-                        icon: require('../images/two.png'),
228
-                        testID: testIDs.SECOND_TAB_BAR_BUTTON
229
-                      }
230
-                    }
231
-                  }
232
-                },
233
-                {
234
-                  stack: {
235
-                    children: [
236
-                      {
237
-                        component: {
238
-                          name: 'navigation.playground.TextScreen',
239
-                          passProps: {
240
-                            text: 'This is a side menu center screen tab 3'
241
-                          }
242
-                        }
243
-                      }
244
-                    ],
245
-                    options: {
246
-                      bottomTab: {
247
-                        text: 'Tab 3',
248
-                        icon: require('../images/three.png'),
249
-                        testID: testIDs.SECOND_TAB_BAR_BUTTON
250
-                      }
251
-                    }
252
-                  }
253
-                }
254
-              ],
255
-              options: {
256
-                bottomTab: {
257
-                  textColor: '#AED581',
258
-                  iconColor: '#AED581',
259
-                  selectedTextColor: '#90CAF9',
260
-                  selectedIconColor: '#90CAF9',
261
-                  fontFamily: 'HelveticaNeue-Italic',
262
-                  fontSize: 13
263
-                }
264
-              }
265
-            }
266
-          },
267
-          right: {
268
-            component: {
269
-              name: 'navigation.playground.SideMenuScreen',
270
-              passProps: {
271
-                side: 'right'
272
-              }
273
-            }
274
-          }
275
-        }
276
-      }
277
-    });
278
-  }
279
-
280
-  onClickPush = async () => {
281
-    await Navigation.push(this.props.componentId, {
282
-      component: {
283
-        name: 'navigation.playground.PushedScreen',
284
-        options: {
285
-          layout: {
286
-
287
-          },
288
-          topBar: {
289
-            title: {
290
-              text: 'pushed',
291
-              color: '#0000ff',
292
-              fontSize: 14
293
-            },
294
-            subtitle: {
295
-              text: 'subtitle',
296
-              fontSize: 10,
297
-              color: '#00ff00'
298
-            }
299
-          }
300
-        }
301
-      }
302
-    });
303
-  }
304
-
305
-  onClickPushContextScreen = async () => {
306
-    await Navigation.push(this.props.componentId, {
307
-      component: {
308
-        name: 'navigation.playground.ContextScreen',
309
-      }
310
-    })
311
-  }
312
-
313
-  onClickPushExternalComponent = async () => {
314
-    await Navigation.push(this.props.componentId, {
315
-      externalComponent: {
316
-        name: 'RNNCustomComponent',
317
-        passProps: {
318
-          text: 'This is an external component'
319
-        },
320
-        options: {
321
-          topBar: {
322
-            title: {
323
-              text: 'pushed'
324
-            },
325
-            visible: true,
326
-            testID: testIDs.TOP_BAR_ELEMENT
327
-          }
328
-        }
329
-      }
330
-    });
331
-  }
332
-
333
-  onClickLifecycleScreen = () => {
334
-    Navigation.push(this.props.componentId, {
335
-      component: {
336
-        name: 'navigation.playground.LifecycleScreen'
337
-      }
338
-    });
339
-  }
340
-
341
-  onClickShowStaticLifecycleOverlay = () => {
342
-    Navigation.showOverlay({
343
-      component: {
344
-        name: 'navigation.playground.StaticLifecycleOverlay',
345
-        options: {
346
-          overlay: {
347
-            interceptTouchOutside: false
348
-          }
349
-        }
350
-      }
351
-    });
352
-  }
353
-
354
-  onClickShowModal = async () => {
355
-    await Navigation.showModal({
356
-      stack: {
357
-        children: [
358
-          {
359
-            component: {
360
-              name: 'navigation.playground.ModalScreen'
361
-            }
362
-          }
363
-        ]
364
-      }
365
-    });
366
-  }
367
-
368
-  onClickShowRedbox = () => {
369
-    undefined();
370
-  }
371
-
372 71
   onClickShowPreview = async ({reactTag}) => {
373 72
     await Navigation.push(this.props.componentId, {
374 73
       component: {
@@ -401,141 +100,6 @@ class LayoutsScreen extends React.Component {
401 100
     });
402 101
   }
403 102
 
404
-  onClickPushOptionsScreen = () => {
405
-    Navigation.push(this.props.componentId, {
406
-      component: {
407
-        name: 'navigation.playground.OptionsScreen',
408
-        options: {
409
-          animations: {
410
-            push: {
411
-              enabled: false
412
-            }
413
-          }
414
-        }
415
-      }
416
-    });
417
-  }
418
-
419
-  onClickPushTopTabsScreen = () => {
420
-    Navigation.push(this.props.componentId, {
421
-      topTabs: {
422
-        children: [
423
-          {
424
-            component: {
425
-              name: 'navigation.playground.TopTabOptionsScreen',
426
-              passProps: {
427
-                title: 'Tab 1',
428
-                text: 'This is top tab 1'
429
-              },
430
-              options: {
431
-                topTab: {
432
-                  title: 'Tab 1'
433
-                },
434
-                topBar: {
435
-                  title: {
436
-                    text: 'One'
437
-                  }
438
-                }
439
-              }
440
-            }
441
-          },
442
-          {
443
-            component: {
444
-              name: 'navigation.playground.TopTabScreen',
445
-              passProps: {
446
-                title: 'Tab 2',
447
-                text: 'This is top tab 2'
448
-              },
449
-              options: {
450
-                topTab: {
451
-                  title: 'Tab 2',
452
-                  titleFontFamily: 'HelveticaNeue-Italic'
453
-                },
454
-                topBar: {
455
-                  title: {
456
-                    text: 'Two'
457
-                  }
458
-                }
459
-              }
460
-            }
461
-          },
462
-          {
463
-            component: {
464
-              name: 'navigation.playground.TopTabScreen',
465
-              passProps: {
466
-                title: 'Tab 3',
467
-                text: 'This is top tab 3'
468
-              },
469
-              options: {
470
-                topTab: {
471
-                  title: 'Tab 3'
472
-                },
473
-                topBar: {
474
-                  title: {
475
-                    text: 'Three'
476
-                  }
477
-                }
478
-              }
479
-            }
480
-          }
481
-        ],
482
-        options: {
483
-          topTabs: {
484
-            selectedTabColor: '#12766b',
485
-            unselectedTabColor: 'red',
486
-            fontSize: 6
487
-          }
488
-        }
489
-      }
490
-    });
491
-  }
492
-
493
-  onClickBackHandler = () => {
494
-    Navigation.push(this.props.componentId, {
495
-      component: {
496
-        name: 'navigation.playground.BackHandlerScreen'
497
-      }
498
-    });
499
-  }
500
-
501
-  onClickPushOrientationMenuScreen = () => {
502
-    Navigation.push(this.props.componentId, {
503
-      component: {
504
-        name: 'navigation.playground.OrientationSelectScreen'
505
-      }
506
-    });
507
-  }
508
-
509
-  onClickProvidedId = () => {
510
-    Navigation.showModal({
511
-      stack: {
512
-        children: [
513
-          {
514
-            component: {
515
-              name: 'navigation.playground.TextScreen',
516
-              id: 'my unique id'
517
-            }
518
-          }
519
-        ]
520
-      }
521
-    });
522
-    Navigation.mergeOptions('my unique id', {
523
-      topBar: {
524
-        title: {
525
-          text: 'User provided id'
526
-        }
527
-      }
528
-    });
529
-  }
530
-
531
-  onClickComplexLayout = () => {
532
-    Navigation.showModal({
533
-      component: {
534
-        name: 'navigation.playground.ComplexLayout'
535
-      }
536
-    });
537
-  }
538
-
539 103
   onClickSplitView = () => {
540 104
     Navigation.setRoot({
541 105
       root: {