Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

React Native CheckBox is not working

I am new to react native and trying to add a check box in the view but I am unable to get check box in the view of react native.

Thanks in advance.

import React from 'react';
import {View, CheckBox } from 'react-native';

export default class SimpleCheckBox extends React.Component{
   constructor(){
     super();
   }

  render(){
     return(
        <View>
         <CheckBox value={true} onValueChange={() => console.log("value might change")}/> 
        </View>
     )
  }
}
like image 893
Kumar Avatar asked Sep 16 '26 21:09

Kumar


1 Answers

CheckBox has only been added into React-Native in version 0.49, and only for Android. Which means that if you are developing for iOS or aren't able to upgrade your app version - you will need to use a custom checkbox component.

You can check out all the changes that this new version introduced at: https://github.com/facebook/react-native/releases/tag/v0.49.0

like image 184
linasmnew Avatar answered Sep 19 '26 12:09

linasmnew