How to Create Social Icons in React Native?

04-Apr-2023

.

Admin

How to Create Social Icons in React Native?

Hi Guys,

This tutorial will provide example of how to add social icons in react native. This article will give you simple example of how to create social icons in react native. This post will give you simple example of social icons example in react native. We will use how to implement social icons in react native. You just need to some step to done react native social icons example.

Let's start following example:

Step 1: Download Project


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

expo init ExampleApp

Step 2: Install and Setup

In this step, you can install react-native-elements:

npm install react-native-elements

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 { SocialIcon } from 'react-native-elements';

const App = () => {

return (

<View style={styles.container}>

<View style={styles.iconContainer}>

<View>

<SocialIcon type="facebook" />

<Text style={styles.iconTitle}>facebook</Text>

</View>

<View>

<SocialIcon type="github-alt" />

<Text style={styles.iconTitle}>

github-alt

</Text>

</View>

<View>

<SocialIcon type="github" />

<Text style={styles.iconTitle}>github</Text>

</View>

<View>

<SocialIcon type="gitlab" />

<Text style={styles.iconTitle}>gitlab</Text>

</View>

<View>

<SocialIcon type="linkedin" />

<Text style={styles.iconTitle}>linkedin</Text>

</View>

</View>

<View style={styles.iconContainer}>

<View>

<SocialIcon type="instagram" />

<Text style={styles.iconTitle}>

instagram

</Text>

</View>

<View>

<SocialIcon type="youtube" />

<Text style={styles.iconTitle}>youtube</Text>

</View>

<View>

<SocialIcon type="twitter" />

<Text style={styles.iconTitle}>twitter</Text>

</View>

<View>

<SocialIcon type="pinterest" />

<Text style={styles.iconTitle}>

pinterest

</Text>

</View>

<View>

<SocialIcon type="medium" />

<Text style={styles.iconTitle}>medium</Text>

</View>

</View>

</View>

);

}

const styles = StyleSheet.create({

container: {

flex: 1,

alignItems: 'center',

justifyContent: 'center',

padding: 16,

},

iconTitle: {

textAlign: 'center',

},

iconContainer: {

flexDirection: 'row',

},

});

export default App;

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