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-8.x/bottom-tab-navigator.md
+2-9Lines changed: 2 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -300,7 +300,7 @@ function MyTabBar({ navigation }) {
300
300
}
301
301
```
302
302
303
-
Also see [icons documentation](icons.md)to use system icons such as [`SF Symbols`](https://developer.apple.com/sf-symbols/) and [Material Design Icons](https://material.io/resources/icons/) in your custom tab bar.
303
+
Also see [Icons](icons.md)for supported icon formats such as [SF Symbols](https://developer.apple.com/sf-symbols/), [Material Symbols](https://fonts.google.com/icons), and [images](icons.md#images) in your custom tab bar.
304
304
305
305
### Options
306
306
@@ -575,14 +575,7 @@ The icon object can be one of the following types:
575
575
576
576
It's necessary to provide icons for multiple screen densities (1x, 2x, 3x), e.g.: `icon.png`, `icon@2x.png`, `icon@3x.png` etc. as icons are not scaled automatically on iOS for the `native` implementation.
577
577
578
-
It also supports [drawable resource](https://developer.android.com/guide/topics/resources/drawable-resource) on Android, [xcasset](https://developer.apple.com/documentation/xcode/adding-images-to-your-xcode-project) on iOS:
579
-
580
-
```js
581
-
tabBarIcon: {
582
-
type:'image',
583
-
source: { uri:'icon_name' },
584
-
}
585
-
```
578
+
See [Icons](icons.md#images) for more details.
586
579
587
580
A `tinted` property can be used to control whether the icon should be tinted with the active/inactive color:
Copy file name to clipboardExpand all lines: versioned_docs/version-8.x/customizing-bottom-tabs.md
+6-8Lines changed: 6 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,9 +12,9 @@ This is similar to how you would customize a stack navigator — there are s
12
12
13
13
Icons can be specified using the [`tabBarIcon`](bottom-tab-navigator.md#tabbaricon) option. The format of the icon varies based on the platform:
14
14
15
-
-Local image - all platforms
16
-
- SF Symbols name - iOS
17
-
-Custom drawable name - Android
15
+
-[Images](icons.md#images) - all platforms
16
+
-[SF Symbols](icons.md#sf-symbols) name - iOS
17
+
-[Material Symbols](icons.md#material-symbols) name - Android
18
18
19
19
```js name="Tab bar icons" static2dynamic
20
20
import*asReactfrom'react';
@@ -105,15 +105,13 @@ Let's dissect this:
105
105
106
106
-[`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.
107
107
-`tabBarIcon` is an object specifying the icon to display.
108
-
- 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`.
110
-
- 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`.
108
+
- For iOS, you can use [SF Symbols](icons.md#sf-symbols) by setting `type: 'sfSymbol'` and providing the symbol `name`.
109
+
- For Android, you can use [Material Symbols](icons.md#material-symbols) by setting `type: 'materialSymbol'` and providing the symbol `name`.
110
+
- For other platforms, use [`type: 'image'`](icons.md#images) 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`.
111
111
-[`Platform.select`](https://reactnative.dev/docs/platform#select) can be used to provide different icons based on the platform.
112
112
- 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.
113
113
- Read the [full API reference](bottom-tab-navigator.md) for further information on `createBottomTabNavigator` configuration options.
114
114
115
-
See [Icons](icons.md) for more details on different icon types and how to use them with React Navigation.
116
-
117
115
### Different icons for active and inactive states
118
116
119
117
You can also provide different icons for active and inactive states by using a function for the `tabBarIcon` option:
See [Icons](icons.md#material-symbols) for more details.
341
-
342
-
-`sfSymbol` (iOS only)
343
-
344
-
```js
345
-
drawerIcon: {
346
-
type:'sfSymbol',
347
-
name:'heart',
331
+
type:'image',
332
+
source:require('./path/to/icon.png'),
348
333
}
349
334
```
350
335
351
-
See [Icons](icons.md#sf-symbols) for more details.
336
+
See [Icons](icons.md#images) for more details.
352
337
353
-
-`image`
338
+
A `tinted` property can be used to control whether the icon should be tinted with the active/inactive color:
354
339
355
340
```js
356
341
drawerIcon: {
357
342
type:'image',
358
343
source:require('./path/to/icon.png'),
344
+
tinted:false,
359
345
}
360
346
```
361
347
362
-
It also supports [drawable resource](https://developer.android.com/guide/topics/resources/drawable-resource) on Android, [xcasset](https://developer.apple.com/documentation/xcode/adding-images-to-your-xcode-project) on iOS:
348
+
Set `tinted` to `false` if the image has its own colors that you want to preserve.
349
+
350
+
The image is tinted by default.
351
+
352
+
-[SF Symbols](https://developer.apple.com/sf-symbols/) name - Supported on iOS
363
353
364
354
```js
365
355
drawerIcon: {
366
-
type:'image',
367
-
source: { uri:'icon_name' },
356
+
type:'sfSymbol',
357
+
name:'heart',
368
358
}
369
359
```
370
360
371
-
A `tinted` property can be used to control whether the icon should be tinted with the active/inactive color:
361
+
See [Icons](icons.md#sf-symbols) for more details.
362
+
363
+
-[Material Symbols](https://fonts.google.com/icons) name - Supported on Android
372
364
373
365
```js
374
366
drawerIcon: {
375
-
type:'image',
376
-
source:require('./path/to/icon.png'),
377
-
tinted:false,
367
+
type:'materialSymbol',
368
+
name:'favorite',
378
369
}
379
370
```
380
371
381
-
Set `tinted` to `false` if the image has its own colors that you want to preserve.
372
+
It also supports the following optional properties:
See [Icons](icons.md#material-symbols) for more details.
384
377
385
378
In addition to the icon object, you can also provide a function which returns an icon object or a React element. It receives `focused`, `color`, and `size` in its argument object:
Also see [icons documentation](icons.md)to use system icons such as [`SF Symbols`](https://developer.apple.com/sf-symbols/) and [Material Design Icons](https://material.io/resources/icons/) in your custom header.
693
+
Also see [Icons](icons.md)for supported icon formats such as [SF Symbols](https://developer.apple.com/sf-symbols/), [Material Symbols](https://fonts.google.com/icons), and [images](icons.md#images) in your custom header.
701
694
702
695
To set a custom header for all the screens in the navigator, you can specify this option in the `screenOptions` prop of the navigator.
703
696
@@ -748,7 +741,7 @@ headerLeft: (props) => (
748
741
);
749
742
```
750
743
751
-
See [Icons](icons.md) documentation on how to use [SF Symbols](icons.md#sf-symbols) and [Material Symbols](icons.md#material-symbols).
744
+
See [Icons](icons.md) documentation on how to use [SF Symbols](icons.md#sf-symbols), [Material Symbols](icons.md#material-symbols), and [images](icons.md#images).
Copy file name to clipboardExpand all lines: versioned_docs/version-8.x/elements.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -671,7 +671,7 @@ Usage:
671
671
672
672
#### Custom back icon
673
673
674
-
The `icon` prop accepts an icon object for SF Symbols on iOS, Material Symbols on Android and image source on all platforms:
674
+
The `icon` prop accepts an icon object for [SF Symbols](icons.md#sf-symbols) on iOS, [Material Symbols](icons.md#material-symbols) on Android, and [image sources](icons.md#images) on all platforms:
Copy file name to clipboardExpand all lines: versioned_docs/version-8.x/icons.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -441,9 +441,7 @@ The component accepts the following props:
441
441
442
442
The available weights depend on which weights are included in the bundle. If the specified weight is not included, it will throw an error.
443
443
444
-
## Other sources
445
-
446
-
### Images
444
+
## Images
447
445
448
446
React Navigation also supports using images as icons. It supports the same formats as React Native's [`Image`](https://reactnative.dev/docs/image) component.
449
447
@@ -473,6 +471,8 @@ tabBarIcon: {
473
471
474
472
Here `icon_name` is the resource name without the file extension. On Android, this can refer to a bitmap drawable such as `res/drawable/icon_name.png` or a vector drawable such as `res/drawable/icon_name.xml`. On iOS, this can refer to an image in an asset catalog, such as an image set named `icon_name`.
The React Native Vector Icons library provides a large set of icons. However, these icons are rendered using custom fonts, which are not supported in most native navigation components such as tab bars or headers.
Copy file name to clipboardExpand all lines: versioned_docs/version-8.x/material-top-tab-navigator.md
+24-31Lines changed: 24 additions & 31 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -340,7 +340,7 @@ function MyTabBar({ navigation }) {
340
340
}
341
341
```
342
342
343
-
Also see [icons documentation](icons.md)to use system icons such as [`SF Symbols`](https://developer.apple.com/sf-symbols/) and [Material Design Icons](https://material.io/resources/icons/) in your custom tab bar.
343
+
Also see [Icons](icons.md)for supported icon formats such as [SF Symbols](https://developer.apple.com/sf-symbols/), [Material Symbols](https://fonts.google.com/icons), and [images](icons.md#images) in your custom tab bar.
344
344
345
345
### Options
346
346
@@ -441,65 +441,58 @@ Whether the tab label should be visible. Defaults to `true`.
441
441
442
442
Icon object to display or a function that given `{ focused: boolean, color: string, size: number }` returns an icon to display in the tab bar.
443
443
444
-
It supports the following types:
444
+
The icon object can be one of the following types:
445
445
446
-
-`materialSymbol` (Android only)
446
+
-Local image - Supported on all platforms
447
447
448
448
```js
449
449
tabBarIcon: {
450
-
type:'materialSymbol',
451
-
name:'favorite',
452
-
}
453
-
```
454
-
455
-
It also supports the following optional properties:
See [Icons](icons.md#material-symbols) for more details.
460
-
461
-
-`sfSymbol` (iOS only)
462
-
463
-
```js
464
-
tabBarIcon: {
465
-
type:'sfSymbol',
466
-
name:'heart',
450
+
type:'image',
451
+
source:require('./path/to/icon.png'),
467
452
}
468
453
```
469
454
470
-
See [Icons](icons.md#sf-symbols) for more details.
455
+
See [Icons](icons.md#images) for more details.
471
456
472
-
-`image`
457
+
A `tinted` property can be used to control whether the icon should be tinted with the active/inactive color:
473
458
474
459
```js
475
460
tabBarIcon: {
476
461
type:'image',
477
462
source:require('./path/to/icon.png'),
463
+
tinted:false,
478
464
}
479
465
```
480
466
481
-
It also supports [drawable resource](https://developer.android.com/guide/topics/resources/drawable-resource) on Android, [xcasset](https://developer.apple.com/documentation/xcode/adding-images-to-your-xcode-project) on iOS:
467
+
Set `tinted` to `false` if the image has its own colors that you want to preserve.
468
+
469
+
The image is tinted by default.
470
+
471
+
-[SF Symbols](https://developer.apple.com/sf-symbols/) name - Supported on iOS
482
472
483
473
```js
484
474
tabBarIcon: {
485
-
type:'image',
486
-
source: { uri:'icon_name' },
475
+
type:'sfSymbol',
476
+
name:'heart',
487
477
}
488
478
```
489
479
490
-
A `tinted` property can be used to control whether the icon should be tinted with the active/inactive color:
480
+
See [Icons](icons.md#sf-symbols) for more details.
481
+
482
+
-[Material Symbols](https://fonts.google.com/icons) name - Supported on Android
491
483
492
484
```js
493
485
tabBarIcon: {
494
-
type:'image',
495
-
source:require('./path/to/icon.png'),
496
-
tinted:false,
486
+
type:'materialSymbol',
487
+
name:'favorite',
497
488
}
498
489
```
499
490
500
-
Set `tinted` to `false` if the image has its own colors that you want to preserve.
491
+
It also supports the following optional properties:
See [Icons](icons.md#material-symbols) for more details.
503
496
504
497
In addition to the icon object, you can also provide a function which returns an icon object or a React element. It receives `focused`, `color`, and `size` in its argument object:
To set a custom header for all the screens in the navigator, you can specify this option in the `screenOptions` prop of the navigator.
1224
1226
1225
-
Also see [icons documentation](icons.md) to use system icons such as [`SF Symbols`](https://developer.apple.com/sf-symbols/) and [Material Design Icons](https://material.io/resources/icons/) in your custom header.
1227
+
Also see [Icons](icons.md) for supported icon formats such as [SF Symbols](https://developer.apple.com/sf-symbols/), [Material Symbols](https://fonts.google.com/icons), and [images](icons.md#images) in your custom header.
1226
1228
1227
1229
Note that if you specify a custom header, the native functionality such as large title, search bar etc. won't work.
1228
1230
@@ -1711,14 +1713,7 @@ Common properties:
1711
1713
1712
1714
It's necessary to provide icons for multiple screen densities (1x, 2x, 3x), e.g.: `icon.png`, `icon@2x.png`, `icon@3x.png` etc. as icons are not scaled automatically.
1713
1715
1714
-
It also supports [xcasset](https://developer.apple.com/documentation/xcode/adding-images-to-your-xcode-project):
1715
-
1716
-
```js
1717
-
icon: {
1718
-
type:'image',
1719
-
source: { uri:'icon_name' },
1720
-
}
1721
-
```
1716
+
See [Icons](icons.md#images) for more details.
1722
1717
1723
1718
A `tinted` property can be used to control whether the icon should be tinted with the active/inactive color:
1724
1719
@@ -1741,6 +1736,8 @@ Common properties:
1741
1736
}
1742
1737
```
1743
1738
1739
+
See [Icons](icons.md#sf-symbols) for more details.
1740
+
1744
1741
- `variant`: Visual variant of the button. Supported values:
To set a custom header for all the screens in the navigator, you can specify this option in the `screenOptions` prop of the navigator.
296
296
297
-
Also see [icons documentation](icons.md)to use system icons such as [`SF Symbols`](https://developer.apple.com/sf-symbols/) and [Material Design Icons](https://material.io/resources/icons/) in your custom header.
297
+
Also see [Icons](icons.md)for supported icon formats such as [SF Symbols](https://developer.apple.com/sf-symbols/), [Material Symbols](https://fonts.google.com/icons), and [images](icons.md#images) in your custom header.
298
298
299
299
When using a custom header, there are 2 things to keep in mind:
300
300
@@ -387,6 +387,8 @@ It supports the following types:
387
387
}
388
388
```
389
389
390
+
See [Icons](icons.md#images) for more details.
391
+
390
392
In addition to the icon object, you can also provide a function which returns a React Element to display as the back icon. It receives `tintColor` in its argument object:
0 commit comments