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>
)
}
}
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With