04-Apr-2023
.
Admin
Hi Guys,
In this blog, I will explain you how to create material ui flat chip in react native. You can easily create material ui flat chip in react native. First i will import stylesheet namespace from react-native-paper, after I will make material ui flat chip using in react native.
Here, I will give you full example for simply display material ui flat chip using react native as bellow.
Step 1 - Create project
In the first step Run the following command for create project.
expo init MaterialUIFlatChip
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, View } from 'react-native';
import { Chip } from 'react-native-paper';
const ChipExample = () => {
return (
Cricket
Hockey
Baseball
Basketball
);
};
export default ChipExample;
const styles = StyleSheet.create({
view: {
flex: 1,
alignItems: 'center',
justifyContent: 'center',
},
cricket: {
width : 110,
marginBottom:15,
backgroundColor: '#deb887'
},
hockey: {
width : 110,
marginBottom:15,
backgroundColor: '#5f9ea0'
},
baseball: {
width : 110,
marginBottom:15,
backgroundColor: '#cd5c5c'
},
basketball: {
width : 110,
backgroundColor: '#90ee90'
}
});
Step 4 - Run project
In the last step run your project using bellow command.
npm start
Output
It will help you...
#React Native