Oct 31, 2020
.
Admin
Hi Guys,
In this blog, I will explain you how to create material ui avatar icon in react native. You can easily create material ui avatar icon in react native. First i will import stylesheet namespace from react-native-paper, after I will make material ui avatar icon using in react native.
Here, I will give you full example for simply display material ui avatar icon using react native as bellow.
Step 1 - Create project
In the first step Run the following command for create project.
expo init MaterialUIAvatarIcon
Step 2 - Install Package
In the step,I will install npm i react-native-paper package .
npm i react-native-paper
Step 3 - App.js
In this step, You will open App.js file and put the code.
import * as React from 'react';
import { Avatar } from 'react-native-paper';
import { View,StyleSheet } from 'react-native';
const AvatarExample = () => {
return (
<View style={styles.view}>
<Avatar.Icon size={45} icon="facebook" style={styles.facebook}/>
<Avatar.Icon size={45} icon="google-plus" style={styles.googlePlus}/>
<Avatar.Icon size={45} icon="instagram" style={styles.instagram}/>
<Avatar.Icon size={45} icon="linkedin" style={styles.linkedin}/>
</View>
);
};
export default AvatarExample;
const styles = StyleSheet.create ({
view : {
flexDirection: "row",
marginTop : 180,
marginLeft : 60
},
facebook: {
backgroundColor : "#4867AA",
marginRight : 10
},
googlePlus: {
backgroundColor : "#DD5144",
marginRight : 10
},
instagram: {
backgroundColor : "#8739CA",
marginRight : 10
},
linkedin: {
backgroundColor : "#3678B5"
}
})
Step 4 - Run project
In the last step run your project using bellow command.
npm start
Output
It will help you...
#React Native