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
{{ message }}
Repository navigation
Commit 2d2169a
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: versioned_docs/version-8.x/icons.md
+67-1Lines changed: 67 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -383,6 +383,8 @@ tabBarIcon: {
383
383
}
384
384
```
385
385
386
+
To generate custom SF Symbols from SVG files, see [React Native Nano Icons](#react-native-nano-icons).
387
+
386
388
## Material Symbols
387
389
388
390
Material Symbols is a library of over 2,500 glyphs designed to integrate well with Material Design on Android.
@@ -538,10 +540,74 @@ tabBarIcon: {
538
540
}
539
541
```
540
542
541
-
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`.
543
+
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`. To generate vector drawables from SVG files, see [React Native Nano Icons](#react-native-nano-icons).
[React Native Nano Icons](https://nano-icons.swmansion.com/) provides a way to use custom SVG files as performant font-based icons.
550
+
551
+
To use it, install the `react-native-nano-icons` package, then follow the [quick start](https://github.com/software-mansion-labs/react-native-nano-icons#-quick-start) to set it up with your SVG icons.
552
+
553
+
Then you can use the icon by passing the name to the `nativeNanoSymbol` function:
Here, we use `newspaper` as the icon name, which is the filename `newspaper.svg` without extension.
564
+
565
+
It returns `{ type: 'sfSymbol', name: 'nano.newspaper' }` on iOS, and `{ type: 'image', source: { uri: 'nano_newspaper' } }` on Android, which resolves to a native vector drawable asset.
566
+
567
+
The second argument specifies how to color the symbol:
568
+
569
+
-`monochrome` (default): Single color, using the tint color.
570
+
-`multicolor`: Uses the original colors of the SVG file.
571
+
572
+
For example, to show the colors only when the tab is focused:
The generated symbols are named with the [prefix](https://github.com/software-mansion-labs/react-native-nano-icons#symbolsets-options) of the symbol set, `nano` by default, and are added to [`SFSymbolNames`](#custom-sf-symbol-names) automatically. They can also be rendered with the standalone `SFSymbol` component:
For more general usage, the library also provides a font-based `Icon` component, created with [`createNanoIconSet`](https://github.com/software-mansion-labs/react-native-nano-icons#createnanoiconset), to render the icons in your own components.
The React Native Vector Icons library provides various sets of font icons. Font icons cannot be used directly in most native navigation components such as tab bars or headers. But they can be [rasterized into images](https://github.com/oblador/react-native-vector-icons?tab=readme-ov-file#usage-as-png-imagesource-object) and used with the `type: 'image'` option.
0 commit comments