A React Native checkbox with all the features, flexibility & Very easy to Use.
Not so much complex & unnecessary thing Exists. All those basics functionality which everyone Needs.
Everything with clear & simple!
As this module depends on nothing means no dependency require
so, just 1 below step require to install it.
npm install react-native-checkedbox
or
yarn add react-native-checkedbox
import CheckBox from 'react-native-checkedbox';
import React from 'react';
const someComponent = props => {
const [isChecked, setIsChecked] = useState(false);
const handleOnPress = val => { //true | false
setIsChecked(val);
}
// You can also handle in this way below;
//const handleOnPress = () => { //true | false
// setIsChecked(!isChecked);
//}
return (
<CheckBox
value={isChecked} // Telling CheckBox if it should be ticked or not!!!
onPress={handleOnPress} // Function called when user presses CheckBox
/>
);
}
export default someComponent;
CheckBox component accepts following props.
Name | Type | Default | Is Require | What Value? |
---|---|---|---|---|
value | bool | false | Yes | true or false |
onPress | func | - | Yes | only func |
disabled | bool | false | No | true or false |
tickColor | string | white | No | hex/rgb/color |
backgroundColor | string | blue | No | hex/rgba/color |
disabled={isDisabled} // Turn it to true if you want to disable checkBox.
tickColor={'yellow'} // Any String Value for CheckBox Tick
backgroundColor={'red'} // Any String Value for CheckBox background
Any one can Contribute & in case of any issue, open the issue Forum!