• Stars
    star
    513
  • Rank 83,226 (Top 2 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created over 7 years ago
  • Updated about 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

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

react-native-check-box

release PRs Welcome NPM version License MIT

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

Content

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

Screenshots

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:

<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

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

Custom CheckBox

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

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

More Repositories

1

TakePhoto

一款用于在Android设备上获取照片(拍照或从相册、文件中选择)、裁剪图片、压缩图片的开源工具库
Java
7,233
star
2

react-native-splash-screen

A splash screen for react-native, hide when application loaded ,it works on iOS and Android.
Java
5,481
star
3

RNStudyNotes

React Native 研究与实践
Objective-C
3,999
star
4

awesome-flutter-cn

一个很棒的Flutter学习资源,官方教程,插件,工具,文章,App,视频教程等的资源列表
2,883
star
5

GitHubPopular

这是一个用来查看GitHub最受欢迎与最热项目的App,它基于React Native支持Android和iOS双平台。#适配RN最新版在这里☞#
JavaScript
2,880
star
6

react-native-awesome

React Native 学习资源精选仓库(汇聚知识,分享精华)汇集了各类react-native学习资料、工具、组件、开源App、资源下载、以及相关新闻等,只求精不求全。
1,737
star
7

react-native-easy-toast

A react native module to show toast like android, it works on iOS and Android.
JavaScript
1,093
star
8

flutter_splash_screen

A splash screen for flutter, hide when application loaded ,it works on iOS and Android.
Java
116
star
9

GroupListView

仿支付宝账单列表效果
Java
64
star
10

react-native-event-bus

Event bus for react native, cross-interface communication solution, it works on iOS and Android.
JavaScript
46
star
11

GitHubTrending

This is a library for fetch object data from "https://github.com/trending".
JavaScript
38
star
12

flutter_color_plugin

A color parse package for flutter,it works on iOS and Android.
Dart
22
star
13

IncrementalUpdate

Android省流量更新、增量更新、补丁生成与应用
C
21
star
14

HeadSetControl

耳机线控实例,蓝牙耳机按钮监听
Java
21
star
15

hijson

HiJson is a lightweight JSON parsing library that can be used for HarmonyOS, Android, and Java
Java
16
star
16

Ios-HomeUI

基于AutoLayout的Ios首页导航框架,支持滑动切换,TabBar切换,侧拉栏菜单等
Objective-C
14
star
17

BreakPointUploadUtil

Java断点上传工具
Java
13
star
18

crazycodeboy.github.io

https://crazycodeboy.github.io/
HTML
11
star
19

WaitScreen

Android页面加载遮罩
Java
9
star
20

ListViewPlus

带有上拉加载下拉刷新的ListView
Java
9
star
21

openai_flutter

A openai library for flutter,it works on iOS,Android,Web,macOS and Windows.
Dart
7
star
22

underline_indicator

A underline indicator
Dart
7
star
23

awesome-harmonyos

一个很棒的HarmonyOS学习资源,官方教程,插件,工具,文章,App,视频教程等的资源列表
6
star
24

PUtils

Android,Http,orm...
Java
4
star
25

KeyboardObserver

Ios键盘输入框自适应
Objective-C
4
star
26

flutter_overlay

A transparent floating layer for flutter which can programmatically show and close the child. Works on iOS,Android and Web.
Dart
3
star
27

react-native-safe-area-plus

A flexible way to handle safe area, also works on Android and iOS
JavaScript
2
star
28

flutter_hi_cache

A cache manager based on shared_preferences. Works on iOS,Android and Web.
Dart
2
star
29

gitbook-plugin-single-page

JavaScript
1
star
30

react-native-take-photo

React Native版TakePhoto@https://github.com/crazycodeboy/TakePhoto
1
star
31

react-native-navbar-plus

A react native module to show navbar,it works on iOS and Android.
JavaScript
1
star
32

flutter_nested

Lists that support nested scrolling can customize the header and the number of lines displayed per line.
Dart
1
star
33

DigitalTimer

自定义数字时钟
Java
1
star
34

react-native-isiphonex-device

A react native module to replace DeviceInfo.isIPhoneX_deprecated.
TypeScript
1
star