react-native-checkbox-plus

0.1.0 • Public • Published

react-native-checkbox-plus

NPM version react-native react node version npm download

Simple customizable react-native checkbox Edit

Getting Started

Installation

npm i react-native-checkbox-plus --save

Basic Usage

import React, { Component } from 'react'
import { AppRegistry, View } from 'react-native'
import Checkbox from 'react-native-checkbox-plus'

class Example extends Component {
  ...
  constructor(props) {
    super(props)
    this.state = {
      isChecked: false,
      isChecked_ShortHand: false
    }
  }
  ...
  render() {
    return (
        <View style={{flex: 1}}>
          /* Normal Case */
          <View style={{flexWrap: 'wrap', flexDirection: 'row'}}>
            <Checkbox 
              isChecked={this.state.isChecked}
              action={() =>  this.setState({ isChecked: !this.state.isChecked }) }
            />
            <View style={{justifyContent:'center'}}>
              <Text>Check It now!</Text>
            </View>
          </View>
          /* ShortHand Case */
          <Checkbox
            useRipple={false}
            isAccessContext
            rightContext={<Text>What !?</Text>}
            isChecked={this.state.isChecked_ShortHand}
            action={() =>  this.setState({ isChecked_ShortHand: !this.state.isChecked_ShortHand })}
          />
        </View>
    )}
}

AppRegistry.registerComponent('Example', () => Example)

Properties


Props Type Default Description
isChecked bool(Required) false checkbox status
action func(Required) () => { } use action while press
useRipple bool(Required) true use effect while press
size number(Required) false size of ripple
checkedCustomIcon string - use custom icon on checked status
unCheckedCustomIcon string - use custom icon on unchecked status
isAccessContext bool false access to use rightContext
rightContext element null use custom in right context

License

react-native-checkbox-plus is released under the MIT license.

Package Sidebar

Install

npm i react-native-checkbox-plus

Weekly Downloads

1

Version

0.1.0

License

MIT

Last publish

Collaborators

  • zondezatera