Javatpoint Logo
Javatpoint Logo

React Native Vector Icons

React Native Vector Icons are the most popular custom icons of NPM GitHub library. It has more than 3K (3000) icons collection in it. All these icons are free to use. The React Native Vector icons come with complete customization such as icon size, icon color, and it also supports multiple styling.

Following are the list of icons category available in React Native Vector Icons. You can also visit at https://oblador.github.io/react-native-vector-icons/ for these icons.

  • AntDesign by AntFinance (297 icons)
  • Entypo by Daniel Bruce (411 icons)
  • EvilIcons by Alexander Madyankin & Roman Shamin (v1.10.1, 70 icons)
  • Feather by Cole Bemis & Contributors (v4.21.0, 279 icons)
  • FontAwesome by Dave Gandy (v4.7.0, 675 icons)
  • FontAwesome 5 by Fonticons, Inc. (v5.7.0, 1500 (free) 5082 (pro) icons)
  • Fontisto by Kenan Gndo?an (v3.0.4, 615 icons)
  • Foundation by ZURB, Inc. (v3.0, 283 icons)
  • Ionicons by Ben Sperry (v4.2.4, 696 icons)
  • MaterialIcons by Google, Inc. (v3.0.1, 932 icons)
  • MaterialCommunityIcons by MaterialDesignIcons.com (v3.6.95, 3695 icons)
  • Octicons by Github, Inc. (v8.4.1, 184 icons)
  • Zocial by Sam Collins (v1.0, 100 icons)
  • SimpleLineIcons by Sabbir & Contributors (v2.4.1, 189 icons)

Installation of React Native Vector Icons

1. Open your react native project folder in command prompt and execute the below code:


React Native Vector Icons

After successful execution of the above code, it adds the react-native-vector-icons library.

React Native Vector Icons

2. Open your_react_native_project->android -> app -> build.gradle file and put below code of line inside it.

3. Again open your_react_native_project -> android -> app -> build.gradle file and put the below code inside the dependency block.

your_react_native_project->android -> app -> build.gradle

After adding the above code, the build.gradle file looks like as:

4. Open your_react_native_project-> android-> settings.gradle file and add the below code:

your_react_native_project-> android-> settings.gradle

5. Open your_react_native_project -> android -> app -> src -> main -> java-> com-> your_project_name -> MainApplication.java file and import vector icons package using below line of code.

6. In the MainApplication.java file, call the react native vector icons below package name inside the return Arrays.asList() block.

MainApplication.java

Linking of Dependency

After installing the above code, we need to link it with our project.


React Native Vector Icons

In the App.js file, create two constant named as facebook_button and twitter_button inside the render block. We call these constant directly into the TouchableOpacity component. The props of Icon.Button are given below:

Props Description
name=" " In this prop, we pass the name of the icon.
backgroundColor=" " It is used to set the color of the button.
size={} It sets the size of the button.
onPress={} It reprsents the onPress event on button.
color It sets the color of Text and Icon.

Create two another constant of Icon named as android_icon and music_icon inside render block.

Props Description
name=" " In this prop, we pass the name of the icon.
size={} It sets the size of Icon.
color=" " It sets the color of the Icon.
onPress={} It is the onPress event on button.

App.js

Output:

React Native Vector Icons React Native Vector Icons





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA