1.0.3 • Published 3 years ago

react-native-multi-radio v1.0.3

Weekly downloads
12
License
MIT
Repository
github
Last release
3 years ago

Basics Usage

npm.io npm.io

Import

import  { RadioGroup }  from 'react-native-multi-radio';

State Example

this.state = {
    options: [{
        label: 'English',
        value: 'english',
      },
      {
        label: 'Chinese',
        value: 'chinese',
      },
      {
        label: 'French',
        value: 'french',
      }],
    options1: ['English', 'Chinese', 'French'],
    //options2: { 'english' : true, 'chinese': true } Does't Support
}

Pass state option/option1 to RadioGroup options props, array and array of object both supported.

Function on value change

radioChange = (val) => {
    console.log('radioChange', val);
}

Render

<RadioGroup 
    name="Language"
    options={options} 
    textLeft={true} 
    onChange={this.radioChange} 
    size={20} color={'#eb383a'}
    //value={'EXAMPLE'}
    viewStyle={{flexDirection: 'column'}}
    radioContainer={{justifyContent: 'space-evenly'}}
    radioText={{ color: '#eb383a' }}
    radioDot={{ backgroundColor:"#db943d" }}
/>
  • pass name to get the value by name makes the radio group unique ex. { "key": "Language", "value": "chinese", }

Props

KeyType (Default)Value(example)
nameStringlanguage
optionsarray/array of objects'English', 'Chinese', 'French'
textLeftbool (true)true/false
onChangefunctionthis.radioChange
sizenumber (22)18
colorhex(#1976D2)#eb383a
viewStyleStyleSheet{{flexDirection: 'column'}}
radioContainerStyleSheet{{justifyContent: 'space-evenly'}}
radioTextStyleSheet{{ color: '#eb383a' }}
radioDotStyleSheet{{ backgroundColor:"#db943d" }}

License

MIT

Free Package, Hell Yeah!