Skip to content

All topics  /  React Native

React Native Material UI Checkbox Example

React Native ·

When “React Native Material UI Checkbox Example” moves through design, development and browser testing, the official Monitask overview can clarify hand-offs and time spent on revisions while leaving code quality, accessibility and released behaviour as the real measures of success.

For API changes, browser support and current usage patterns, compare the snippet with the React Native project before adopting it in production.

Hi Guys,

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

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

Step 1 - Create project

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

expo init materialuicheckbox 

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, Text } from 'react-native';
import { Checkbox } from 'react-native-paper';
const CheckBoxExample = () => {
  const [checked, setChecked] = React.useState(false);
  return (
    <View style={styles.container}>
      <View style={styles.checkboxInput}>
        <Checkbox
          status={checked ? 'checked' : 'unchecked'}
          onPress={() => {
            setChecked(!checked);
          }}
          color={'blue'}
        />
        <Text style={styles.label}>Do You Play Hockey?</Text>
      </View>
    </View>
  );
};
const styles = StyleSheet.create({
  container: {
    flex: 1,
    alignItems: "center",
    justifyContent: "center",
  },
  checkboxInput: {
    flexDirection: "row",
  },
  label: {
    margin: 8,
  }
});
export default CheckBoxExample;

Step 4 - Run project

In the last step run your project using bellow command.

npm start

Output

It will help you...

# React Native