Skip to content

Commit 48b5ea1

Browse files
Replace removed labelVisible with displayMode. (#1384)
* Update elements.md * Update upgrading-from-6.x.md * [autofix.ci] apply automated fixes * Update upgrading-from-6.x.md --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
1 parent 0a7bf61 commit 48b5ea1

File tree

2 files changed

+29
-2
lines changed

2 files changed

+29
-2
lines changed

versioned_docs/version-7.x/elements.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,10 @@ It receives an object containing following properties:
233233
- `tintColor`: The color of the icon and label.
234234
- `pressColor`: The color of the material ripple (Android >= 5.0 only).
235235
- `pressOpacity`: The opacity of the button when it's pressed (Android < 5.0, and iOS).
236-
- `labelVisible`: Whether the label text is visible. Defaults to `true` on iOS and `false` on Android.
236+
- `displayMode`: How the element displays icon and title. Defaults to `default` on iOS and `minimal` on Android. Possible values:
237+
- `default`: Displays one of the following depending on the available space: previous screen's title, generic title (e.g. 'Back') or no title (only icon).
238+
- `generic`: Displays one of the following depending on the available space: generic title (e.g. 'Back') or no title (only icon). iOS >= 14 only, falls back to "default" on older iOS versions.
239+
- `minimal`: Always displays only the icon without a title.
237240
- `href`: The URL to open when the button is pressed on the Web.
238241

239242
You can use it to implement your custom left button, for example:
@@ -637,7 +640,10 @@ A component used to show the back button header. It's the default for [`headerLe
637640
- `tintColor` - Tint color for the header.
638641
- `label` - Label text for the button. Usually the title of the previous screen. By default, this is only shown on iOS.
639642
- `truncatedLabel` - Label text to show when there isn't enough space for the full label.
640-
- `labelVisible` - Whether the label text is visible. Defaults to `true` on iOS and `false` on Android.
643+
- `displayMode`: How the back button displays icon and title. Defaults to `default` on iOS and `minimal` on Android. Possible values:
644+
- `default`: Displays one of the following depending on the available space: previous screen's title, generic title (e.g. 'Back') or no title (only icon).
645+
- `generic`: Displays one of the following depending on the available space: generic title (e.g. 'Back') or no title (only icon). iOS >= 14 only, falls back to "default" on older iOS versions.
646+
- `minimal`: Always displays only the icon without a title.
641647
- `labelStyle` - Style object for the label.
642648
- `allowFontScaling` - Whether label font should scale to respect Text Size accessibility settings.
643649
- `onLabelLayout` - Callback to trigger when the size of the label changes.

versioned_docs/version-7.x/upgrading-from-6.x.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,27 @@ If you're using Drawer Navigator on the Web, it'll now use CSS transitions inste
372372

373373
See [Drawer Navigator](drawer-navigator.md) for usage.
374374

375+
### Changes to elements
376+
377+
#### `labelVisible` is removed in favor of `displayMode` in `headerLeft` and `HeaderBackButton` elements
378+
379+
Previously, `labelVisible` could be used to control whether the back button title is shown in the header. It's now removed in favor of `displayMode` which provides more flexibility.
380+
381+
The new possible values are:
382+
383+
- `default`: Displays one of the following depending on the available space: previous screen's title, generic title (e.g. 'Back') or no title (only icon).
384+
- `generic`: Displays one of the following depending on the available space: generic title (e.g. 'Back') or no title (only icon). iOS >= 14 only, falls back to "default" on older iOS versions.
385+
- `minimal`: Always displays only the icon without a title.
386+
387+
The previous behavior can be achieved by setting `displayMode` to `default` or `generic` for showing and `minimal` for hiding the back button title respectively:
388+
389+
```diff lang=js
390+
<HeaderBackButton
391+
- labelVisible={false}
392+
+ displayMode="minimal"
393+
/>
394+
```
395+
375396
### Deprecations and removals
376397

377398
#### Material Bottom Tab Navigator now lives in `react-native-paper` package

0 commit comments

Comments
 (0)