You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: versioned_docs/version-5.x/bottom-tab-navigator.md
+4Lines changed: 4 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -265,6 +265,10 @@ Title string of a tab displayed in the tab bar or a function that given `{ focus
265
265
266
266
Text to show in a badge on the tab icon. Accepts a `string` or a `number`.
267
267
268
+
#### `tabBarBadgeStyle`
269
+
270
+
Style for the badge on the tab icon. You can specify a background color or text color here.
271
+
268
272
#### `tabBarButton`
269
273
270
274
Function which returns a React element to render as the tab bar button. It wraps the icon and label and implements `onPress`. Renders `TouchableWithoutFeedback` by default. `tabBarButton: props => <TouchableOpacity {...props} />` would use `TouchableOpacity` instead.
Copy file name to clipboardExpand all lines: versioned_docs/version-5.x/drawer-navigator.md
+90Lines changed: 90 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -370,6 +370,96 @@ Swipe gesture is not supported on Web.
370
370
371
371
Whether you can use gestures to open or close the drawer. Setting this to `false` disables swipe gestures as well as tap on overlay to close. See `swipeEnabled` to disable only the swipe gesture.
372
372
373
+
#### `header`
374
+
375
+
Function that returns a React Element to display as a header. It accepts an object containing the following properties as the argument:
376
+
377
+
-`layout` - Dimensions of the screen
378
+
-`scene` - This contains 2 properties:
379
+
-`route` - The route object for the header
380
+
-`descriptor` - The descriptor containing the `navigation` prop and `options` for the screen
To set a custom header for all the screens in the navigator, you can specify this option in the `screenOptions` prop of the navigator.
409
+
410
+
#### `headerShown`
411
+
412
+
Whether to show or hide the header for the screen. The header is shown by default. Setting this to `false` hides the header.
413
+
414
+
#### `headerTitle`
415
+
416
+
String or a function that returns a React Element to be used by the header. Defaults to scene `title`. When a function is specified, it receives an object containing `allowFontScaling`, `style` and `children` properties. The `children` property contains the title string.
417
+
418
+
#### `headerTitleAlign`
419
+
420
+
How to align the header title. Possible values:
421
+
422
+
-`left`
423
+
-`center`
424
+
425
+
Defaults to `center` on iOS and `left` on Android.
426
+
427
+
#### `headerTitleAllowFontScaling`
428
+
429
+
Whether header title font should scale to respect Text Size accessibility settings. Defaults to false.
430
+
431
+
#### `headerTitleStyle`
432
+
433
+
Style object for the header title component.
434
+
435
+
#### `headerLeft`
436
+
437
+
Function which returns a React Element to display on the left side of the header. By default, a button to toggle the drawer is shown.
438
+
439
+
#### `headerLeftAccessibilityLabel`
440
+
441
+
Accessibility label for the header left button.
442
+
443
+
#### `headerRight`
444
+
445
+
Function which returns a React Element to display on the right side of the header.
446
+
447
+
#### `headerPressColorAndroid`
448
+
449
+
Color for material ripple (Android >= 5.0 only).
450
+
451
+
#### `headerTintColor`
452
+
453
+
Tint color for the header.
454
+
455
+
#### `headerStyle`
456
+
457
+
Style object for the header. You can specify a custom background color here, for example.
458
+
459
+
#### `headerStatusBarHeight`
460
+
461
+
Extra padding to add at the top of header to account for translucent status bar. By default, it uses the top value from the safe area insets of the device. Pass 0 or a custom value to disable the default behavior, and customize the height.
462
+
373
463
#### `unmountOnBlur`
374
464
375
465
Whether this screen should be unmounted when navigating away from it. Unmounting a screen resets any local state in the screen as well as state of nested navigators in the screen. Defaults to `false`.
### Parent navigator's UI is rendered on top of child navigator
94
94
95
-
For example, when you nest a stack navigator inside a drawer navigator, you'll see that the drawer appears above the stack navigator's header. However, if you nest the drawer navigator inside a stack, the drawer will appear below the header. This is an important point to consider when deciding how to nest your navigators.
95
+
For example, when you nest a stack navigator inside a drawer navigator, you'll see that the drawer appears above the stack navigator's header. However, if you nest the drawer navigator inside a stack, the drawer will appear below the header of the stack. This is an important point to consider when deciding how to nest your navigators.
96
96
97
97
In your app, you will probably use these patterns depending on the behavior you want:
98
98
99
-
- Stack navigators nested inside each screen of drawer navigator - The drawer appears over the header from the stack.
100
99
- Tab navigator nested inside the initial screen of stack navigator - New screens cover the tab bar when you push them.
100
+
- Drawer navigator nested inside the initial screen of stack navigator with the initial screen's stack header hidden - The drawer can only be opened from the first screen of the stack.
101
+
- Stack navigators nested inside each screen of drawer navigator - The drawer appears over the header from the stack.
101
102
- Stack navigators nested inside each screen of tab navigator - The tab bar is always visible. Usually pressing the tab again also pops the stack to top.
102
103
103
104
## Navigating to a screen in a nested navigator
@@ -192,9 +193,9 @@ navigation.navigate('Root', {
192
193
193
194
It's sometimes useful to nest multiple stack navigators, for example, to have [some screens in a modal stack and some in regular stack](modal.md).
194
195
195
-
When nesting multiple stacks, headers from both child and parent stack navigators would be shown. However, usually it's more desirable to show the header in the child stack navigator and hide the header in the parent stack navigator.
196
+
When nesting multiple stacks or drawers, headers from both child and parent navigators would be shown. However, usually it's more desirable to show the header in the child navigator and hide the header in the stack navigator.
196
197
197
-
To achieve this, you can hide the header in the screen containing the stack using the `headerShown: false` option.
198
+
To achieve this, you can hide the header in the screen containing the navigator using the `headerShown: false` option.
Copy file name to clipboardExpand all lines: versioned_docs/version-5.x/stack-navigator.md
+16-7Lines changed: 16 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -90,7 +90,21 @@ String that can be used as a fallback for `headerTitle`.
90
90
91
91
#### `header`
92
92
93
-
Function that given `HeaderProps` returns a React Element, to display as a header. Make sure to set `headerMode` to `screen` as well when using a custom header (see below for more details).
93
+
94
+
95
+
Function that returns a React Element to display as a header. It accepts an object containing the following properties as the argument:
96
+
97
+
-`mode` - Mode of the header - `float` or `screen`
98
+
-`layout` - Dimensions of the screen
99
+
-`insets` - Safe area insets to use in the header
100
+
-`scene` - This contains 2 properties:
101
+
-`route` - The route object for the header
102
+
-`descriptor` - The descriptor containing the `navigation` prop and `options` for the screen
103
+
-`previous` - The `scene` object of the previous screen, will be undefined if there's no previous screen
104
+
-`navigation` prop for the header
105
+
-`styleInterpolator` - Function which returns interpolated styles for various elements in the header.
106
+
107
+
Make sure to set `headerMode` to `screen` as well when using a custom header (see below for more details).
94
108
95
109
Example:
96
110
@@ -157,12 +171,7 @@ Note that this style is not applied to the header by default since you control t
157
171
158
172
#### `headerShown`
159
173
160
-
Whether to show or hide the header for the screen. The header is shown by default unless:
161
-
162
-
- The `headerMode` prop on the navigator was set to `none`.
163
-
- The screen is in a stack nested in another stack navigator's screen which has a header.
164
-
165
-
Setting this to `false` hides the header. When the header is hidden in a nested stack, you can explicitly set it to `true` to show it.
174
+
Whether to show or hide the header for the screen. The header is shown by default unless the `headerMode` prop on the navigator was set to `none`. Setting this to `false` hides the header.
0 commit comments