1.0.1 • Published 1 year ago

react-native-radio-check v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

react-native-radio-check

  • Support Android and IOS
  • Similar to RadioButton and CheckBox int Android

Install

$ yarn add react-native-radio-check

or

$ npm install react-native-radio-check --save

Import

import { CheckBox, RadioButton, RadioGroup } from "react-native-radio-check"

Props

RadioButton

PropsTypeDescDefault
styleStylePropSets the style of button.undefined
iconRadioIconSets normal and checked icons.undefined
iconStyleStylePropSets the style of icon .undefined
textstringSets the text of buttonundefined
textStyleStylePropSets the style of textundefined
textCheckedStyleStylePropSets the style of text when checked.undefined
idnumberSets the id of button, this prop needs to be used with RadioGroup.undefined
valueanyThis prop needs to be used with RadioGroup,you can set a added value.undefined
checkedbooleanSets checked state of button.undefined
disabledbooleanif true, user not to tap the button.undefined
onCheckedfunctionHandler to be called when changing checked state.undefined

RadioGroup

PropsTypeDescDefault
styleStylePropSets the style of component.undefined
iconRadioIconSets normal and checked icons of sub RadioButton.undefined
iconStyleStylePropSets icon style of sub RadioButton.undefined
textStyleStylePropSets text style of sub RadioButton.undefined
textCheckedStyleStylePropSets text style of sub RadioButton when checked.undefined
checkedIdnumberSets the id of current checked sub RadioButton.undefined
onCheckedfunctionHandler to be called when changing checked state.undefined

CheckBox

Refer to RadioButton

Example

<RadioButton
  icon={{
    ormal: require('./icon/ic_normal.png'),
    checked: require("./icon/ic_radio_check.png")
   }}
   textStyle={{ marginLeft: 5 }}
   text="AA"
   onChecked={(checked, pressed) => {

   }} />

<RadioGroup
  style={{ flexDirection: 'row', marginTop: 10 }}
  checkedId={this.state.index}
  icon={{
    normal: require('./icon/ic_normal.png'),
    checked: require("./icon/ic_radio_check.png")
  }}
  textStyle={{ marginLeft: 5 }}
  onChecked={(id, value) => {
    console.info("Group===", id)
    console.info("Value===", value)
  }}>
  <RadioButton
    text="AAA"
    value={1} />
  <RadioButton
    style={{ marginLeft: 20 }}
    text="BBB"
    value={2} />
</RadioGroup>

<CheckBox
  checked={this.state.check}
  icon={{
    normal: require('./icon/ic_normal.png'),
    checked: require("./icon/ic_check.png")
  }}
  textStyle={{ marginLeft: 5 }}
  text="A"
  onChecked={(checked, pressed) => {

  }} />

npm.io