# react-native-check-box

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

Latest version **2.1.7** (published 2018-12-13) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-native-check-box
pnpm add react-native-check-box
yarn add react-native-check-box
bun add react-native-check-box
```

## Health

**Score 23/100 (F)** — status: abandoned.

Positive: has types package; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.1.7 |
| Published | 2018-12-13 |
| First published | 2016-09-03 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | separate (@types/react-native-check-box) |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 12 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 525 |
| Author | crazycodeboy |
| Maintainers | crazycodeboy |
| Keywords | react-native, react-native-component, react-native-checkbox, check-box, check, box, react-component, ios, android |

## Links

- npm: https://www.npmjs.com/package/react-native-check-box
- Repository: https://github.com/crazycodeboy/react-native-check-box
- Homepage: https://github.com/crazycodeboy/react-native-check-box#readme
- Issues: https://github.com/crazycodeboy/react-native-check-box/issues
- npm.io page: https://npm.io/package/react-native-check-box

## Dependencies (1)

- [prop-types](https://npm.io/package/prop-types.md) ^15.5.7

## Alternatives

- [react-native-root-siblings](https://npm.io/package/react-native-root-siblings.md) — 102.9K weekly downloads
- [@praxisui/dialog](https://npm.io/package/@praxisui/dialog.md) — 2.0K weekly downloads
- [easy-toggle-state](https://npm.io/package/easy-toggle-state.md) — 350 weekly downloads
- [ngx-lightbox-evp](https://npm.io/package/ngx-lightbox-evp.md) — 19 weekly downloads
- [react-native-modal-translucent-axton](https://npm.io/package/react-native-modal-translucent-axton.md) — 4 weekly downloads

## Recent versions

- 2.1.7 (latest) — 2018-12-13
- 2.1.6 — 2018-10-20
- 2.1.5 — 2018-10-16
- 2.1.3 — 2018-08-23
- 2.1.2 — 2018-08-23
- 2.1.1 — 2018-08-23
- 2.1.0 — 2018-03-13
- 2.0.2 — 2017-10-10
- 2.0.1 — 2017-08-26
- 2.0.0 — 2017-07-22
- 1.0.4 — 2016-12-12
- 1.0.3 — 2016-12-08
- 1.0.2 — 2016-11-09
- 1.0.1 — 2016-10-26
- 1.0.0 — 2016-09-03

## README

# react-native-check-box

[ ![release](https://img.shields.io/github/release/crazycodeboy/react-native-check-box.svg?maxAge=2592000?style=flat-square)](https://github.com/crazycodeboy/react-native-check-box/releases)
[ ![PRs Welcome](https://img.shields.io/badge/PRs-Welcome-brightgreen.svg)](https://github.com/crazycodeboy/react-native-check-box/pulls)
[ ![NPM version](http://img.shields.io/npm/v/react-native-check-box.svg?style=flat)](https://www.npmjs.com/package/react-native-check-box)
[![License MIT](http://img.shields.io/badge/license-MIT-orange.svg?style=flat)](https://raw.githubusercontent.com/crazycodeboy/react-native-check-box/master/LICENSE)



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

## Content

- [Installation](#installation)
- [Demo](#demo)
- [Getting started](#getting-started)
- [API](#api)
- [Contribution](#contribution)

## Changes

For React Native >= 0.54 use v2.1.2+, for React Native < 0.4.4 use v1.0.4

## Installation

* 1.Run `npm i react-native-check-box --save`
* 2.`import CheckBox from 'react-native-check-box'`    

## Demo  
* [Examples](https://github.com/crazycodeboy/react-native-check-box/tree/master/examples)

![Screenshots](https://raw.githubusercontent.com/crazycodeboy/react-native-check-box/master/examples/Screenshots/react-native-check-box-screenshots.gif)

## Getting started  

Add `react-native-check-box` to your js file.   

`import CheckBox from 'react-native-check-box'`  

Inside your component's render method, use CheckBox:   

```javascript
<CheckBox
    style={{flex: 1, padding: 10}}
    onClick={()=>{
      this.setState({
          isChecked:!this.state.isChecked
      })
    }}
    isChecked={this.state.isChecked}
    leftText={"CheckBox"}
/>
```

Then you can use it like this:   


### Basic usage  

```javascript
<CheckBox
    style={{flex: 1, padding: 10}}
    onClick={()=>{
      this.setState({
          isChecked:!this.state.isChecked
      })
    }}
    isChecked={this.state.isChecked}
    leftText={"CheckBox"}
/>
 ```

### Custom CheckBox   

```javascript
renderCheckBox(data) {
    var leftText = data.name;
    return (
        <CheckBox
            style={{flex: 1, padding: 10}}
            onClick={()=>{
                 this.setState({
                     isChecked:!this.state.isChecked
                 })
               }}
            isChecked={this.state.isChecked}
            checkedImage={<Image source={require('../../page/my/img/ic_check_box.png')} style={this.props.theme.styles.tabBarSelectedIcon}/>}
            unCheckedImage={<Image source={require('../../page/my/img/ic_check_box_outline_blank.png')} style={this.props.theme.styles.tabBarSelectedIcon}/>}
        />);
}
```

**More Usage:**    

[GitHubPopular](https://github.com/crazycodeboy/GitHubPopular/blob/develop/js/page/my/CustomKeyPage.js)



## API


Props              | Type     | Optional | Default     | Description
----------------- | -------- | -------- | ----------- | -----------
style  | ViewPropTypes.style  | true |   |   Custom style checkbox
leftText | PropTypes.string |true |   | Custom left Text
leftTextStyle  |  Text.propTypes.style | true |  | Custom left Text style
rightText | PropTypes.string |true |   | Custom right Text
rightTextView | PropTypes.element | true |   | Custom right TextView
rightTextStyle  | Text.propTypes.style | true |  | Custom right Text style
checkedImage  |  PropTypes.element  | true  | Default image | Custom  checked Image
unCheckedImage  |  PropTypes.element  | true  |  Default image  | Custom  unchecked Image
isChecked  |  PropTypes.bool |  false  |  false  | checkbox checked state
onClick   |  PropTypes.func.isRequired |  false  |  | callback  function
disabled  |  PropTypes.bool            | true  |  false | Disable the checkbox button
checkBoxColor | PropTypes.string | true |   | Tint color of the checkbox image (this props is for both checked and unchecked state)
checkedCheckBoxColor | PropTypes.string | true |   | Tint color of the checked state checkbox image (this prop will override value of `checkBoxColor` for checked state)
uncheckedCheckBoxColor | PropTypes.string | true |   | Tint color of the unchecked state checkbox image (this prop will override value of `checkBoxColor` for unchecked state)

## Contribution

Issues are welcome. Please add a screenshot of bug and code snippet. Quickest way to solve issue is to reproduce it on one of the examples.

Pull requests are welcome. If you want to change API or making something big better to create issue and discuss it first.

---

**MIT Licensed**

---
_Source: https://npm.io/package/react-native-check-box · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
