@@ -93,16 +93,14 @@ function HomeScreen() {
93
93
< View style= {{ flex: 1 , alignItems: ' center' , justifyContent: ' center' }}>
94
94
< Text > This is the home screen of the app< / Text >
95
95
< Button
96
- onPress= {
97
- () =>
98
- // highlight-start
99
- navigation .navigate (' Profile' , {
100
- names: [' Brent' , ' Satya' , ' Michaś' ],
101
- })
96
+ onPress= {() => {
97
+ // highlight-start
98
+ navigation .navigate (' Profile' , {
99
+ names: [' Brent' , ' Satya' , ' Michaś' ],
100
+ });
102
101
// highlight-end
103
- }
102
+ }}
104
103
>
105
- {' ' }
106
104
Go to Brent' s profile
107
105
</Button>
108
106
</View>
@@ -120,7 +118,7 @@ function ProfileScreen({ route }) {
120
118
<Text>{route.params.names[0]}</Text>
121
119
<Text>{route.params.names[1]}</Text>
122
120
<Text>{route.params.names[2]}</Text>
123
- <Button onPress={() => navigation.goBack()}>Go back </Button>
121
+ <Button onPress={() => navigation.goBack()}>Go back</Button>
124
122
</View>
125
123
);
126
124
}
@@ -158,14 +156,12 @@ function HomeScreen({ navigation: { navigate } }) {
158
156
<View style={{ flex: 1, alignItems: ' center' , justifyContent: ' center' }}>
159
157
<Text>This is the home screen of the app</Text>
160
158
<Button
161
- onPress={
162
- () =>
163
- // highlight-start
164
- navigate(' Profile' , { names: [' Brent' , ' Satya' , ' Michaś' ] })
159
+ onPress={() => {
160
+ // highlight-start
161
+ navigate(' Profile' , { names: [' Brent' , ' Satya' , ' Michaś' ] });
165
162
// highlight-end
166
- }
163
+ }}
167
164
>
168
- {' ' }
169
165
Go to Brent' s profile
170
166
< / Button>
171
167
< / View>
@@ -270,13 +266,12 @@ function HomeScreen() {
270
266
< View style= {{ flex: 1 , alignItems: ' center' , justifyContent: ' center' }}>
271
267
< Text > This is the home screen of the app< / Text >
272
268
< Button
273
- onPress= {() =>
269
+ onPress= {() => {
274
270
navigation .navigate (' Profile' , {
275
271
names: [' Brent' , ' Satya' , ' Michaś' ],
276
- })
277
- }
272
+ });
273
+ }}
278
274
>
279
- {' ' }
280
275
Go to Brent' s profile
281
276
</Button>
282
277
</View>
@@ -295,7 +290,7 @@ function ProfileScreen({ route }) {
295
290
<Text>{route.params.names[1]}</Text>
296
291
<Text>{route.params.names[2]}</Text>
297
292
// highlight-next-line
298
- <Button onPress={() => navigation.goBack()}>Go back </Button>
293
+ <Button onPress={() => navigation.goBack()}>Go back</Button>
299
294
</View>
300
295
);
301
296
}
@@ -333,11 +328,10 @@ function HomeScreen({ navigation: { navigate } }) {
333
328
<View style={{ flex: 1, alignItems: ' center' , justifyContent: ' center' }}>
334
329
<Text>This is the home screen of the app</Text>
335
330
<Button
336
- onPress={() =>
337
- navigate(' Profile' , { names: [' Brent' , ' Satya' , ' Michaś' ] })
338
- }
331
+ onPress={() => {
332
+ navigate(' Profile' , { names: [' Brent' , ' Satya' , ' Michaś' ] });
333
+ }}
339
334
>
340
- {' ' }
341
335
Go to Brent' s profile
342
336
< / Button>
343
337
< / View>
@@ -354,7 +348,7 @@ function ProfileScreen({ navigation, route }) {
354
348
< Text > {route .params .names [1 ]}< / Text >
355
349
< Text > {route .params .names [2 ]}< / Text >
356
350
// highlight-next-line
357
- < Button onPress= {() => navigation .goBack ()}> Go back < / Button>
351
+ < Button onPress= {() => navigation .goBack ()}> Go back< / Button>
358
352
< / View>
359
353
);
360
354
}
@@ -403,13 +397,13 @@ function HomeScreen() {
403
397
< View style= {{ flex: 1 , alignItems: ' center' , justifyContent: ' center' }}>
404
398
< Text > This is the home screen of the app< / Text >
405
399
< Button
406
- onPress= {() =>
400
+ onPress= {() => {
407
401
navigation .navigate (' Profile' , {
408
402
names: [' Brent' , ' Satya' , ' Michaś' ],
409
- })
410
- }
403
+ });
404
+ }}
411
405
>
412
- Go to Brents profile{ ' ' }
406
+ Go to Brents profile
413
407
< / Button>
414
408
< / View>
415
409
);
@@ -427,31 +421,30 @@ function ProfileScreen({ route }) {
427
421
< Text > {route .params .names [2 ]}< / Text >
428
422
< Button onPress= {() => navigation .goBack ()}> Go back< / Button>
429
423
< Button
430
- onPress= {() =>
424
+ onPress= {() => {
431
425
navigation .replace (' Settings' , {
432
426
someParam: ' Param' ,
433
- })
434
- }
427
+ });
428
+ }}
435
429
>
436
430
Replace this screen with Settings
437
431
< / Button>
438
432
< Button
439
- onPress= {
440
- () =>
441
- // codeblock-focus-start
442
- navigation .reset ({
443
- index: 0 ,
444
- routes: [
445
- {
446
- name: ' Settings' ,
447
- params: { someParam: ' Param1' },
448
- },
449
- ],
450
- })
433
+ onPress= {() => {
434
+ // codeblock-focus-start
435
+ navigation .reset ({
436
+ index: 0 ,
437
+ routes: [
438
+ {
439
+ name: ' Settings' ,
440
+ params: { someParam: ' Param1' },
441
+ },
442
+ ],
443
+ });
451
444
// codeblock-focus-end
452
- }
445
+ }}
453
446
>
454
- Reset navigator state to Settings{ ' ' }
447
+ Reset navigator state to Settings
455
448
< / Button>
456
449
< Button onPress= {() => navigation .navigate (' Home' )}> Go to Home < / Button>
457
450
< Button
@@ -470,13 +463,13 @@ function SettingsScreen({ route }) {
470
463
< View style= {{ flex: 1 , alignItems: ' center' , justifyContent: ' center' }}>
471
464
< Text > Settings screen < / Text >
472
465
< Text > {route .params .someParam }< / Text >
473
- < Button onPress= {() => navigation .goBack ()}> Go back < / Button>
466
+ < Button onPress= {() => navigation .goBack ()}> Go back< / Button>
474
467
< Button
475
- onPress= {() =>
468
+ onPress= {() => {
476
469
navigation .navigate (' Profile' , {
477
470
names: [' Brent' , ' Satya' , ' Michaś' ],
478
- })
479
- }
471
+ });
472
+ }}
480
473
>
481
474
Go to Brents profile
482
475
< / Button>
@@ -517,11 +510,11 @@ function HomeScreen({ navigation: { navigate } }) {
517
510
< View style= {{ flex: 1 , alignItems: ' center' , justifyContent: ' center' }}>
518
511
< Text > This is the home screen of the app< / Text >
519
512
< Button
520
- onPress= {() =>
521
- navigate (' Profile' , { names: [' Brent' , ' Satya' , ' Michaś' ] })
522
- }
513
+ onPress= {() => {
514
+ navigate (' Profile' , { names: [' Brent' , ' Satya' , ' Michaś' ] });
515
+ }}
523
516
>
524
- Go to Brents profile{ ' ' }
517
+ Go to Brents profile
525
518
< / Button>
526
519
< / View>
527
520
);
@@ -546,22 +539,21 @@ function ProfileScreen({ navigation, route }) {
546
539
Replace this screen with Settings
547
540
< / Button>
548
541
< Button
549
- onPress= {
550
- () =>
551
- // codeblock-focus-start
552
- navigation .reset ({
553
- index: 0 ,
554
- routes: [
555
- {
556
- name: ' Settings' ,
557
- params: { someParam: ' Param1' },
558
- },
559
- ],
560
- })
542
+ onPress= {() => {
543
+ // codeblock-focus-start
544
+ navigation .reset ({
545
+ index: 0 ,
546
+ routes: [
547
+ {
548
+ name: ' Settings' ,
549
+ params: { someParam: ' Param1' },
550
+ },
551
+ ],
552
+ });
561
553
// codeblock-focus-end
562
- }
554
+ }}
563
555
>
564
- Reset navigator state to Settings{ ' ' }
556
+ Reset navigator state to Settings
565
557
< / Button>
566
558
< Button onPress= {() => navigation .navigate (' Home' )}> Go to Home < / Button>
567
559
< Button
@@ -579,16 +571,15 @@ function SettingsScreen({ navigation, route }) {
579
571
< View style= {{ flex: 1 , alignItems: ' center' , justifyContent: ' center' }}>
580
572
< Text > Settings screen < / Text >
581
573
< Text > {route .params .someParam }< / Text >
582
- < Button onPress= {() => navigation .goBack ()}> Go back < / Button>
574
+ < Button onPress= {() => navigation .goBack ()}> Go back< / Button>
583
575
< Button
584
- onPress= {() =>
576
+ onPress= {() => {
585
577
navigation .navigate (' Profile' , {
586
578
names: [' Brent' , ' Satya' , ' Michaś' ],
587
- })
588
- }
579
+ });
580
+ }}
589
581
>
590
- {' ' }
591
- Go to Brents profile{' ' }
582
+ Go to Brents profile
592
583
< / Button>
593
584
< / View>
594
585
);
@@ -646,12 +637,12 @@ function HomeScreen() {
646
637
< View style= {{ flex: 1 , alignItems: ' center' , justifyContent: ' center' }}>
647
638
< Text > This is the home screen of the app< / Text >
648
639
< Button
649
- onPress= {() =>
640
+ onPress= {() => {
650
641
navigation .navigate (' Profile' , {
651
642
friends: [' Brent' , ' Satya' , ' Michaś' ],
652
643
title: " Brent's Profile" ,
653
- })
654
- }
644
+ });
645
+ }}
655
646
>
656
647
Go to Brents profile
657
648
< / Button>
@@ -671,21 +662,20 @@ function ProfileScreen({ route }) {
671
662
< Text > {route .params .friends [1 ]}< / Text >
672
663
< Text > {route .params .friends [2 ]}< / Text >
673
664
< Button
674
- onPress= {
675
- () =>
676
- // highlight-start
677
- navigation .setParams ({
678
- friends:
679
- route .params .friends [0 ] === ' Brent'
680
- ? [' Wojciech' , ' Szymon' , ' Jakub' ]
681
- : [' Brent' , ' Satya' , ' Michaś' ],
682
- title:
683
- route .params .title === " Brent's Profile"
684
- ? " Lucy's Profile"
685
- : " Brent's Profile" ,
686
- })
665
+ onPress= {() => {
666
+ // highlight-start
667
+ navigation .setParams ({
668
+ friends:
669
+ route .params .friends [0 ] === ' Brent'
670
+ ? [' Wojciech' , ' Szymon' , ' Jakub' ]
671
+ : [' Brent' , ' Satya' , ' Michaś' ],
672
+ title:
673
+ route .params .title === " Brent's Profile"
674
+ ? " Lucy's Profile"
675
+ : " Brent's Profile" ,
676
+ });
687
677
// highlight-end
688
- }
678
+ }}
689
679
>
690
680
Swap title and friends
691
681
< / Button>
@@ -730,12 +720,12 @@ function HomeScreen({ navigation: { navigate } }) {
730
720
< View style= {{ flex: 1 , alignItems: ' center' , justifyContent: ' center' }}>
731
721
< Text > This is the home screen of the app< / Text >
732
722
< Button
733
- onPress= {() =>
723
+ onPress= {() => {
734
724
navigate (' Profile' , {
735
725
friends: [' Brent' , ' Satya' , ' Michaś' ],
736
726
title: " Brent's Profile" ,
737
- })
738
- }
727
+ });
728
+ }}
739
729
>
740
730
Go to Brents profile
741
731
< / Button>
@@ -753,21 +743,20 @@ function ProfileScreen({ navigation, route }) {
753
743
< Text > {route .params .friends [1 ]}< / Text >
754
744
< Text > {route .params .friends [2 ]}< / Text >
755
745
< Button
756
- onPress= {
757
- () =>
758
- // highlight-start
759
- navigation .setParams ({
760
- friends:
761
- route .params .friends [0 ] === ' Brent'
762
- ? [' Wojciech' , ' Szymon' , ' Jakub' ]
763
- : [' Brent' , ' Satya' , ' Michaś' ],
764
- title:
765
- route .params .title === " Brent's Profile"
766
- ? " Lucy's Profile"
767
- : " Brent's Profile" ,
768
- })
746
+ onPress= {() => {
747
+ // highlight-start
748
+ navigation .setParams ({
749
+ friends:
750
+ route .params .friends [0 ] === ' Brent'
751
+ ? [' Wojciech' , ' Szymon' , ' Jakub' ]
752
+ : [' Brent' , ' Satya' , ' Michaś' ],
753
+ title:
754
+ route .params .title === " Brent's Profile"
755
+ ? " Lucy's Profile"
756
+ : " Brent's Profile" ,
757
+ });
769
758
// highlight-end
770
- }
759
+ }}
771
760
>
772
761
Swap title and friends
773
762
< / Button>
@@ -824,9 +813,9 @@ function HomeScreen() {
824
813
< View style= {{ flex: 1 , alignItems: ' center' , justifyContent: ' center' }}>
825
814
< Text > This is the home screen of the app< / Text >
826
815
< Button
827
- onPress= {() =>
828
- navigation .navigate (' Profile' , { title: " Brent's profile" })
829
- }
816
+ onPress= {() => {
817
+ navigation .navigate (' Profile' , { title: " Brent's profile" });
818
+ }}
830
819
>
831
820
Go to Profile
832
821
< / Button>
0 commit comments