Skip to content

Commit 6be4964

Browse files
committed
Document materialSymbol icons
1 parent d9e18a7 commit 6be4964

File tree

2 files changed

+40
-20
lines changed

2 files changed

+40
-20
lines changed

versioned_docs/version-8.x/bottom-tab-navigator.md

Lines changed: 31 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -146,15 +146,6 @@ When using native tabs, some options behave differently:
146146
- `tabBarLabel` only accepts a `string`
147147
- `tabBarIcon` accepts a function that returns an icon object
148148

149-
:::note
150-
151-
- The `native` implementation uses `UITabBarController` on iOS and `BottomNavigationView` on Android.
152-
- Liquid Glass effect on iOS 26+ requires your app to be built with Xcode 26 or above.
153-
- On Android, at most 5 tabs are supported with `native` implementation. This is a limitation of the underlying native component.
154-
- The `native` implementation requires React Native 0.79 or above. If you're using [Expo](https://expo.dev/), it requires SDK 53 or above.
155-
156-
:::
157-
158149
#### `backBehavior`
159150

160151
This controls what happens when `goBack` is called in the navigator. This includes pressing the device's back button or back gesture on Android.
@@ -448,10 +439,16 @@ const HomeTabs = createBottomTabNavigator({
448439
Home: {
449440
screen: HomeScreen,
450441
options: {
451-
tabBarIcon: {
452-
type: 'sfSymbol',
453-
name: 'house',
454-
},
442+
tabBarIcon: Platform.select({
443+
ios: {
444+
type: 'sfSymbol',
445+
name: 'house',
446+
},
447+
android: {
448+
type: 'materialSymbol',
449+
name: 'home',
450+
},
451+
}),
455452
},
456453
},
457454
Search: {
@@ -532,15 +529,16 @@ Example:
532529

533530
#### `tabBarIcon`
534531

535-
Function that given `{ focused: boolean, color: string, size: number }` returns a React.Node, to display in the tab bar.
532+
Function that given `{ focused: boolean, color: string, size: number }` returns an icon to display in the tab bar. It can be one of the following:
536533

537-
With `native` implementation, you can pass an icon object directly instead of a function. A React element is only supported with `custom` implementation.
534+
- An icon object with both `native` and `custom` implementations
535+
- A React element with `custom` implementation only
538536

539537
It overrides the icon provided by [`tabBarSystemItem`](#tabbarsystemitem) on iOS.
540538

541-
The icon can be of following types with `native` implementation:
539+
The icon object can be one of the following types:
542540

543-
- Local image - Supported on iOS and Android
541+
- Local image - Supported on all platforms
544542

545543
```js
546544
tabBarIcon: {
@@ -574,6 +572,15 @@ The icon can be of following types with `native` implementation:
574572
}
575573
```
576574

575+
- [Material Symbols](https://fonts.google.com/icons) name - Supported on Android
576+
577+
```js
578+
tabBarIcon: {
579+
type: 'materialSymbol',
580+
name: 'favorite',
581+
}
582+
```
583+
577584
- [Drawable resource](https://developer.android.com/guide/topics/resources/drawable-resource) name - Supported on Android
578585

579586
```js
@@ -583,7 +590,7 @@ The icon can be of following types with `native` implementation:
583590
}
584591
```
585592

586-
To render different icons for active and inactive states with `native` implementation, you can use a function:
593+
To render different icons for active and inactive states, you can use a function:
587594

588595
```js
589596
tabBarIcon: ({ focused }) => {
@@ -605,8 +612,12 @@ tabBarIcon: Platform.select({
605612
name: 'heart',
606613
},
607614
android: {
608-
type: 'drawableResource',
609-
name: 'heart_icon',
615+
type: 'materialSymbol',
616+
name: 'favorite',
617+
},
618+
default: {
619+
type: 'image',
620+
source: require('./path/to/icon.png'),
610621
},
611622
});
612623
```

versioned_docs/version-8.x/customizing-bottom-tabs.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@ const RootTabs = createBottomTabNavigator({
5757
type: 'sfSymbol',
5858
name: 'house',
5959
},
60+
android: {
61+
type: 'materialSymbol',
62+
name: 'home',
63+
},
6064
default: {
6165
type: 'image',
6266
source: require('./path/to/home-icon.png'),
@@ -74,6 +78,10 @@ const RootTabs = createBottomTabNavigator({
7478
type: 'sfSymbol',
7579
name: 'gear',
7680
},
81+
android: {
82+
type: 'materialSymbol',
83+
name: 'settings',
84+
},
7785
default: {
7886
type: 'image',
7987
source: require('./path/to/settings-icon.png'),
@@ -98,6 +106,7 @@ Let's dissect this:
98106
- [`tabBarIcon`](bottom-tab-navigator.md#tabbaricon) is a supported option in bottom tab navigator. So we know we can use it on our screen components in the `options` prop.
99107
- `tabBarIcon` is an object specifying the icon to display.
100108
- For iOS, you can use SF Symbols by setting `type: 'sfSymbol'` and providing the symbol `name`.
109+
- For Android, you can use Material Symbols by setting `type: 'materialSymbol'` and providing the symbol `name`.
101110
- For other platforms, use `type: 'image'` with a `source` pointing to your image file. Image files must be provided for multiple screen densities (1x, 2x, 3x), e.g.: `home-icon.png`, `home-icon@2x.png`, `home-icon@3x.png`.
102111
- [`Platform.select`](https://reactnative.dev/docs/platform#select) can be used to provide different icons based on the platform.
103112
- The `tabBarActiveTintColor` and `tabBarInactiveTintColor` options in `screenOptions` control the icon and label colors. These default to the iOS platform defaults, but you can change them as shown above.

0 commit comments

Comments
 (0)