React Native Vector Icons Example

Jan 04, 2023 . Admin

Here, I will show you react native app icon size. I would like to share with you how to link react native vector icons. if you want to see example of react native Ionicons icons then you are a right place. In this article, we will implement a react native vector icons example. follow bellow step for react native vector icons color.

In this example, We will install vector icons in react native.you can easy and simply insall your project.below's this example.

Step 1: Download Project

In the first step run the following command to create a project.

expo init ExampleApp
Step 2: Download Library

In this step run the following command to create a project.

npm i react-native-vector-icons
Step 3: App.js

In this step, You will open the App.js file and put the code.

import React from 'react';
import { StyleSheet, Text, View} from 'react-native';
import Icon from 'react-native-vector-icons/Ionicons';

export default function App() {
    return (
      <View style={styles.container}>
        <View style={{ margin: 10 }}>
          <Icon name='home' size={40} color='red'/><Text>Home</Text>
        </View>
        <View style={{ margin: 10 }}>
          <Icon name='cart' size={40} color='red'/><Text>Cart</Text>
        </View>
      </View>
    );
}

const styles = StyleSheet.create({
  container: {
    flexDirection:'row',
    backgroundColor: '#fff',
    justifyContent: 'center',
    marginTop: 50
  },
});
Step 4: Run Project

In the last step run your project using the below command.

expo start

You can QR code scan in Expo Go Application on mobile.

Output:

It will help you...

#React Native