React Native Flexi Radio Button
Simple and flexible Radio button for React Native App
Installation
npm i react-native-flexi-radio-button --save
Usage
Basic Example
import RadioGroup RadioButton from 'react-native-flexi-radio-button' { this} { return <View => <RadioGroup = > <RadioButton = > <Text>This is item #1</Text> </RadioButton> <RadioButton => <Text>This is item #2</Text> </RadioButton> <RadioButton => <Text>This is item #3</Text> </RadioButton> </RadioGroup> <Text =>thisstatetext</Text> </View> }
Custom Example
modify in render()
<RadioGroup = = ='#9575b2' ='#ccc8b9' = = > <RadioButton = ='Yo!! I am a cat.' > <Image = = /> </RadioButton> <RadioButton ='index1' > <Text>Start from item index #1</Text> </RadioButton> <RadioButton ='red color' ='red' > <Text>Red Dot</Text> </RadioButton> <RadioButton ='green color' ='green' > <Text>Green Dot</Text> </RadioButton> <RadioButton ='blue color' ='blue' > <Text>Blue Dot</Text> </RadioButton></RadioGroup>
Configuration
Radio Group:
Property | Type | Default | Description |
---|---|---|---|
size | number | 20 | Size of the radio button |
thickness | number | 1 | width of radio button border |
color | string | '#007AFF' | color of radio button |
activeColor | string | null | color of radio button when selected |
highlightColor | string | null | background of radio button after selected |
selectedIndex | number | null | default selected index of radio group, can be changed to new value or to null for clear selection |
style | object | null | Custom styles to be applied if supplied |
onSelect | function(index, value) | null | function to be invoked when radio button is selected |
Radio Button:
Property | Type | Default | Description |
---|---|---|---|
value | any | null | value will be passed on callback onSelect as second argument |
style | object | null | Styles to be applied on 'RadioButton' component |
color | string | same as 'RadioGroup' component | color of radio dot |
disabled | bool | false | If true, disable all interactions for this component. |