@amazon-devices/react-native-vector-icons library provides support on Vega for react-native-vector-icons. The library provides customizable vector icons ideal for embellishing buttons, logos, and navigation or tab bars that seamlessly integrate into your projects. Their versatility makes extension and styling effortless.
This library is system-deployed and available to React Native for Vega apps without a separate installation process. The library is deployed as an autolinking library, which your app links to at runtime. The library is guaranteed to be compatible only with the version of React Native for Vega for which it’s built.
When you uplevel your app’s version of React Native for Vega, consider the best practice of upleveling its library dependencies.
For more information about this library and its API, see the README.md in the GitHub repo.
Installation
- Add this JavaScript library dependency in the package.json file. Select the tab for your React Native version.
- React Native 0.72
- React Native 0.83
-
Reinstall the dependencies using the
npm installcommand. -
Add your font files to
<app_package_root>/assets/fonts.
Upgrading
Upgrade the font files linked to your projects when you upgrade this package. If the automatic linking works for you, running it again should update the fonts. Otherwise, follow the steps outlined in the installation section.Examples
IconExplorer
Try the IconExplorer project in packages/icon-explorer in the GitHub react-native-vector-icons repo. There you can also search for any icon.
Basic Example
A basic example of returning an icon:TabBar
The following following example shows how to implement a TabBar. The folloing example taken fromreact-navigation:
API support
Icon Component
Either use one of the icons that comes with the library (the following example uses the icon from FontAwesome.js) or create your own custom font.Properties
Use any Text property and the following props:Static Methods
Styling
Icon builds on top of the Text component, therefore most style properties work as expected.
Try these properties:
backgroundColorborderWidthborderColorborderRadiuspaddingmargincolorfontSize


Icon.Button Component
A convenience component for creating buttons with an icon on the left side.
Properties
You can useText, TouchableHighlight, or the TouchableWithoutFeedback property, as well as the following properties.
Usage as PNG image/source object
Use with other components that rely on bitmap images rather than scalable vector icons. Takes the argumentsname, size, and color as described previously.
Icon.getImageSourceSync to avoid rendering glitches. Keep in mind that this method is blocking and might incur performance penalties. Subsequent calls will use cache however.
Multistyle fonts
Thereact-native-vector-icons library supports multistyle fonts like FontAwesome 5. The usage is similar to the standard Icon component:
Static methods
All static methods fromIcon are supported by multistyled fonts.
Components
Icon.Button is supported. The usage is just like Icon:
Custom Fonts
createIconSet(glyphMap, fontFamily[, fontFile])
Returns your own custom font based on theglyphMap. The key is the icon name and the value is either a UTF-8 character or its character code. The name of the font is fontFamily, however this is not the name of the filename. Open the font in Font Book.app or similar to learn the name.
createIconSetFromFontello(config[, fontFamily[, fontFile]])
You can create a custom font based on a fontello config file. Don’t forget to import the font as described previously and place the config.json somewhere convenient in your project.createIconSetFromIcoMoon(config[, fontFamily[, fontFile]])
.json file that’s included in the .zip you downloaded. Import the .ttf font file into your project, following the previous instructions.
createMultiStyleIconSet(styles [, options])
Animation
React Native comes with an animation library calledAnimated. To use it with an icon, create an animated component with this code: const AnimatedIcon = Animated.createAnimatedComponent(Icon).

