React Native Material UI Button Example

04-Apr-2023

.

Admin

React Native Material UI Button Example

Hi Guys,

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

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

Step 1 - Create project


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

expo init MaterialUiButton

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

const MyComponent = () => (

<Button mode="contained" onPress={() => console.log('Pressed')} style = {styles.item}>

Save

</Button>

);

export default MyComponent;

const styles = StyleSheet.create ({

item: {

marginTop: 300,

marginLeft: 40,

marginRight: 40,

backgroundColor : "teal"

}

})

Step 4 - Run project

In the last step run your project using bellow command.

npm start

Output

It will help you...

#React Native