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
To customize the icon, you can use the `icon` prop of `DrawerToggleButton` component. It can be a function that returns a React Element or an icon object:
The `sfSymbol` and `materialSymbol` types use the respective system icon libraries on each platform. The `image` type allows you to use a custom image as an icon on any platform.
17
47
18
48
## SF Symbols
19
49
@@ -180,7 +210,7 @@ tabBarIcon: {
180
210
}
181
211
```
182
212
183
-
The behavior differs depending on the weights and variants included in the bundle. If there is a single variant and weight included, it will be used by default. You don't need to specify the variant or weight in the icon object.
213
+
The behavior differs depending on the weights and variants included in the bundle. If there is a single variant and weight included, it will be used by default. You don't need to specify the variant or weight in the icon object. The built-in icons such as icons in the header will also use the included variant and weight automatically.
184
214
185
215
If there are multiple variants or weights included, you can specify the `variant` and `weight` properties in the icon object to choose which one to use:
Copy file name to clipboardExpand all lines: versioned_docs/version-8.x/upgrading-from-7.x.md
+42-4Lines changed: 42 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -633,6 +633,26 @@ If you don't want to enable deep linking, you can set `linking.enabled` to `fals
633
633
>
634
634
```
635
635
636
+
#### `HeaderBackButton` and `DrawerToggleButton` components now accept an `icon` prop
637
+
638
+
Previously, the `HeaderBackButton` and `DrawerToggleButton` components accepted `backImage` and `imageSource` props respectively. In order to support the new icons such as [Material Symbols](https://fonts.google.com/icons) and [SF Symbols](https://developer.apple.com/sf-symbols/), these props have been replaced with a new `icon` prop.
639
+
640
+
If you're using a custom back image with `imageSource`, you can update your code as follows:
See [HeaderBackButton](elements.md#headerbackbutton) and [DrawerToggleButton](elements.md#drawertogglebutton) for more details.
655
+
636
656
#### Some exports are removed from `@react-navigation/elements`
637
657
638
658
The `@react-navigation/elements` package has exported some components that were primarily intended for internal usage. These components have been removed from the public API:
@@ -663,7 +683,20 @@ The `@react-navigation/elements` package has exported some components that were
663
683
664
684
You can copy the implementation from the [source code](https://github.com/react-navigation/react-navigation/blob/main/packages/elements/src/MissingIcon.tsx) if you need a placeholder icon.
665
685
666
-
Some of these components are still available and exported at `@react-navigation/elements/internal`, so you can continue using them if you really need. However, since they are not part of the public API, they don't follow semver and may change without warning in future releases.
686
+
-`Assets`
687
+
688
+
This was an array of assets to preload with `expo-asset`. However since the built-in icons now render [Material Symbols](https://fonts.google.com/icons) on Android and [SF Symbols](https://developer.apple.com/sf-symbols/) on iOS instead of images, this is no longer needed.
689
+
690
+
If you were using this, you can remove it from your code:
691
+
692
+
```diff lang=js
693
+
- import { Assets } from '@react-navigation/elements';
694
+
- import { Asset } from 'expo-asset';
695
+
-
696
+
- Asset.loadAsync(Assets);
697
+
```
698
+
699
+
Some of these exports are still available and exported at `@react-navigation/elements/internal`, so you can continue using them if you really need. However, since they are not part of the public API, they don't follow semver and may change without warning in future releases.
667
700
668
701
#### The `getDefaultHeaderHeight` utility now accepts an object instead of positional arguments
669
702
@@ -909,8 +942,11 @@ Various navigators and components now support using [Material Symbols](https://f
909
942
910
943
For example,
911
944
912
-
- The `headerBackIcon` option in Stack and Native Stack Navigators
913
-
- The `tabBarIcon` option in Bottom Tab Navigator
945
+
-[`tabBarIcon`](bottom-tab-navigator.md#tabbaricon) option in Bottom Tab Navigator
946
+
-[`headerBackIcon`](native-stack-navigator.md#headerbackicon) option in Native Stack Navigator
947
+
-[`headerBackIcon`](stack-navigator.md#headerbackicon) option in Stack Navigator
948
+
-[`icon`](elements.md#headerbackbutton) prop in `HeaderBackButton` component
949
+
-[`icon`](drawer-navigator.md#headerleft) option in `DrawerToggleButton` component
914
950
915
951
Usage:
916
952
@@ -927,7 +963,9 @@ tabBarIcon: Platform.select({
927
963
}),
928
964
```
929
965
930
-
In addition, new `SFSymbol` and `MaterialSymbol` components are exported from `@react-navigation/native` to render these icons directly. See [Icons](icons.md) for more details.
966
+
In addition, new `SFSymbol` and `MaterialSymbol` components are exported from `@react-navigation/native` to render these icons directly.
967
+
968
+
See [Icons](icons.md) for more details.
931
969
932
970
### `react-native-tab-view` now supports a `renderAdapter` prop for custom adapters
0 commit comments