@@ -318,10 +318,6 @@ Object containing the initial height and width of the screens. Passing this will
318
318
319
319
Used to override default value of pager's overScroll mode. Can be ` auto ` , ` always ` or ` never ` (Android only).
320
320
321
- ##### ` sceneContainerStyle `
322
-
323
- Style to apply to the view wrapping each screen. You can pass this to override some default styles such as overflow clipping:
324
-
325
321
##### ` pagerStyle `
326
322
327
323
Style to apply to the pager view wrapping all the scenes.
@@ -358,105 +354,6 @@ return (
358
354
359
355
#### TabBar Props
360
356
361
- ##### Options
362
-
363
- Options describe how each tab should be rendered. There are 2 ways to specify options:
364
-
365
- - ` commonOptions ` : Options that apply to all tabs.
366
- - ` options ` : Options that apply to specific tabs. It has the route key as the key and the object with options.
367
-
368
- Example:
369
-
370
- ``` js
371
- < TabBar
372
- commonOptions= {{
373
- icon : ({ route, focused, color }) => (
374
- < Icon name= {route .icon } color= {color} / >
375
- ),
376
- }}
377
- options= {{
378
- albums: {
379
- labelText: ' Albums' ,
380
- },
381
- profile: {
382
- labelText: ' Profile' ,
383
- },
384
- }}
385
- / >
386
- ```
387
-
388
- The following options are available:
389
-
390
- ###### ` accessibilityLabel `
391
-
392
- Accessibility label for the tab button. Uses ` route.accessibilityLabel ` by default if specified, otherwise uses the route title.
393
-
394
- ###### ` accessible `
395
-
396
- Whether to mark the tab as ` accessible ` . Defaults to ` true ` .
397
-
398
- ###### ` testID `
399
-
400
- Test ID for the tab button. Uses ` route.testID ` by default.
401
-
402
- ###### ` labelText `
403
-
404
- Label text for the tab button. Uses ` route.title ` by default.
405
-
406
- ###### ` labelAllowFontScaling `
407
-
408
- Whether label font should scale to respect Text Size accessibility settings. Defaults to ` true ` .
409
-
410
- ###### ` href `
411
-
412
- URL to use for the anchor tag for the tab button on the Web.
413
-
414
- ###### ` label `
415
-
416
- A function that returns a custom React Element to be used as a label. The function receives an object with the following properties:
417
-
418
- - ` route ` - The route object for the tab.
419
- - ` labelText ` - The label text for the tab specified in the ` labelText ` option or the ` route title ` .
420
- - ` focused ` - Whether the label is for the focused state.
421
- - ` color ` - The color of the label.
422
- - ` allowFontScaling ` - Whether label font should scale to respect Text Size accessibility settings.
423
- - ` style ` - The style object for the label.
424
-
425
- ``` js
426
- label : ({ route, labelText, focused, color }) => (
427
- < Text style= {{ color, margin: 8 }}> {labelText ?? route .name }< / Text >
428
- );
429
- ` ` `
430
-
431
- ###### ` icon`
432
-
433
- A function that returns a custom React Element to be used as an icon. The function receives an object with the following properties:
434
-
435
- - ` route` - The route object for the tab.
436
- - ` focused` - Whether the icon is for the focused state.
437
- - ` color` - The color of the icon.
438
- - ` size` - The size of the icon.
439
-
440
- ` ` ` js
441
- icon: ({ route, focused, color }) => (
442
- < Icon name= {focused ? ' albums' : ' albums-outlined' } color= {color} / >
443
- );
444
- ` ` `
445
-
446
- ###### ` badge`
447
-
448
- A function that returns a custom React Element to be used as a badge. The function receives an object with the following properties:
449
-
450
- - ` route` - The route object for the tab.
451
-
452
- ` ` ` js
453
- badge: ({ route }) => (
454
- < View
455
- style= {{ backgroundColor: ' red' , width: 20 , height: 20 , borderRadius: 10 }}
456
- / >
457
- );
458
- ` ` `
459
-
460
357
##### ` renderTabBarItem `
461
358
462
359
Function which takes a ` TabBarItemProps ` object and returns a custom React Element to be used as a tab button.
@@ -548,6 +445,109 @@ Spacing between the tab items.
548
445
549
446
Test ID for the tab bar. Can be used for scrolling the tab bar in tests
550
447
448
+ #### Options
449
+
450
+ Options describe how each tab should be configured. There are 2 ways to specify options:
451
+
452
+ - ` commonOptions ` : Options that apply to all tabs.
453
+ - ` options ` : Options that apply to specific tabs. It has the route key as the key and the object with options.
454
+
455
+ Example:
456
+
457
+ ``` js
458
+ < TabView
459
+ commonOptions= {{
460
+ icon : ({ route, focused, color }) => (
461
+ < Icon name= {route .icon } color= {color} / >
462
+ ),
463
+ }}
464
+ options= {{
465
+ albums: {
466
+ labelText: ' Albums' ,
467
+ },
468
+ profile: {
469
+ labelText: ' Profile' ,
470
+ },
471
+ }}
472
+ / >
473
+ ```
474
+
475
+ The following options are available:
476
+
477
+ ##### ` accessibilityLabel `
478
+
479
+ Accessibility label for the tab button. Uses ` route.accessibilityLabel ` by default if specified, otherwise uses the route title.
480
+
481
+ ##### ` accessible `
482
+
483
+ Whether to mark the tab as ` accessible ` . Defaults to ` true ` .
484
+
485
+ ##### ` testID `
486
+
487
+ Test ID for the tab button. Uses ` route.testID ` by default.
488
+
489
+ ##### ` labelText `
490
+
491
+ Label text for the tab button. Uses ` route.title ` by default.
492
+
493
+ ##### ` labelAllowFontScaling `
494
+
495
+ Whether label font should scale to respect Text Size accessibility settings. Defaults to ` true ` .
496
+
497
+ ##### ` href `
498
+
499
+ URL to use for the anchor tag for the tab button on the Web.
500
+
501
+ ##### ` label `
502
+
503
+ A function that returns a custom React Element to be used as a label. The function receives an object with the following properties:
504
+
505
+ - ` route ` - The route object for the tab.
506
+ - ` labelText ` - The label text for the tab specified in the ` labelText ` option or the ` route title ` .
507
+ - ` focused ` - Whether the label is for the focused state.
508
+ - ` color ` - The color of the label.
509
+ - ` allowFontScaling ` - Whether label font should scale to respect Text Size accessibility settings.
510
+ - ` style ` - The style object for the label.
511
+
512
+ ``` js
513
+ label : ({ route, labelText, focused, color }) => (
514
+ < Text style= {{ color, margin: 8 }}> {labelText ?? route .name }< / Text >
515
+ );
516
+ ` ` `
517
+
518
+ ##### ` icon`
519
+
520
+ A function that returns a custom React Element to be used as an icon. The function receives an object with the following properties:
521
+
522
+ - ` route` - The route object for the tab.
523
+ - ` focused` - Whether the icon is for the focused state.
524
+ - ` color` - The color of the icon.
525
+ - ` size` - The size of the icon.
526
+
527
+ ` ` ` js
528
+ icon: ({ route, focused, color }) => (
529
+ < Icon name= {focused ? ' albums' : ' albums-outlined' } color= {color} / >
530
+ );
531
+ ` ` `
532
+
533
+ ##### ` badge`
534
+
535
+ A function that returns a custom React Element to be used as a badge. The function receives an object with the following properties:
536
+
537
+ - ` route` - The route object for the tab.
538
+
539
+ ` ` ` js
540
+ badge: ({ route }) => (
541
+ < View
542
+ style= {{ backgroundColor: ' red' , width: 20 , height: 20 , borderRadius: 10 }}
543
+ / >
544
+ );
545
+ ` ` `
546
+
547
+ ##### ` sceneStyle`
548
+
549
+ Style to apply to the view wrapping each screen. You can pass this to override some default styles such as overflow clipping.
550
+
551
551
## Optimization Tips
552
552
553
553
### Avoid unnecessary re-renders
0 commit comments