1.0.3 • Published 6 years ago

react-native-checkbox-component v1.0.3

Weekly downloads
4
License
MIT
Repository
github
Last release
6 years ago

react-native-checkbox-component

release NPM version PRs Welcome License MIT

Checkbox component for react native, it works on iOS and Android.

Content

Demo

Screenshots

Installation

  • 1.Run npm i react-native-checkbox-component --save
  • 2.import CheckBox from 'react-native-checkbox-component'

Getting started

Add react-native-checkbox-component to your js file.

import CheckBox from 'react-native-checkbox-component'

Inside your component's render method, use CheckBox:

Basic usage

<CheckBox
    style={{flex: 1, padding: 10}}
    onClick={()=>this.onClick(data)}
    isChecked={data.checked}
    leftText={leftText}
/>;

Custom CheckBox

renderCheckBox(data) {
    var leftText = data.name;
    return (
    <CheckBox
        style={{flex: 1, padding: 10}}
        onClick={()=>this.onClick(data)}
        isChecked={data.checked}
        leftText={leftText}
        checkedComponent={<Text>1</Text>}
        unCheckedComponent={<Text>0</Text>}
    />);
}

API

PropsTypeOptionalDefaultDescription
styleViewPropTypes.styletrueCustom style checkbox
leftTextPropTypes.stringtrueCustom left Text
leftTextStyleText.propTypes.styletrueCustom left Text style
rightTextPropTypes.stringtrueCustom right Text
rightTextViewPropTypes.elementtrueCustom right TextView
rightTextStyleText.propTypes.styletrueCustom right Text style
checkedComponentPropTypes.elementtrueIconCustom checked Component
unCheckedComponentPropTypes.elementtrueIconCustom unchecked Component
isCheckedPropTypes.boolfalsefalsecheckbox checked state
onClickPropTypes.funcfalsecallback function
indexPropTypes.numberfalsekey to return in onClick callback
disabledPropTypes.booltruefalseDisable the checkbox button
checkBoxColorPropTypes.stringtrueTint color of the checkbox image (this props is for both checked and unchecked state)
checkedCheckBoxColorPropTypes.stringtrueTint color of the checked state checkbox image (this prop will override value of checkBoxColor for checked state)
uncheckedCheckBoxColorPropTypes.stringtrueTint color of the unchecked state checkbox image (this prop will override value of checkBoxColor for unchecked state)

MIT Licensed