React Native Material UI Icon Button Example

React Native

Nicesnippets

80

18-11-2020


React Native Material UI Icon Button Example

Hi Guys,

In this blog, I will explain you how to create material ui icon button in react native. You can easily create material ui icon button in react native. First i will import stylesheet namespace from react-native-paper, after I will make material ui icon button using in react native.

Here, I will give you full example for simply display material ui icon button using react native as bellow.

Step 1 - Create project


In the first step Run the following command for create project.

expo init MaterialUiIconButton

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

import { IconButton, Colors } from 'react-native-paper';

const IconButtonExample = () => (

<IconButton icon="account-plus" color={Colors.cadetblue500} size={50} onPress={() => alert('Pressed')} style = {styles.item}/>

);

export default IconButtonExample;

const styles = StyleSheet.create ({

item: {

marginTop: 280,

marginLeft: 140,

marginRight: 40,

}

})

Step 4 - Run project

In the last step run your project using bellow command.

npm start

Output

It will help you...