radio-button-react-native

1.1.6 • Public • Published

radio-button-react-native

Simple Radio Button component for React Native

Demo

alt tag

Installation

in Cli

npm i radio-button-react-native --save

Getting started

import RadioButton from 'radio-button-react-native';
 
export default class Example extends Component {
constructor (props){
    super(props)
      this.state = {
            value: 0
        }
    
}
 
 
handleOnPress(value){
    this.setState({value:value})
}
 
render(){
    return(
        <View>
               <RadioButton currentValue={this.state.value} value={0} onPress={this.handleOnPress.bind(this)}>
                <Text>Button1</Text>
                 </RadioButton>
                      
                 <RadioButton currentValue={this.state.value} value={1} onPress={this.handleOnPress.bind(this)}>
                 <Text>Button2</Text>
                 </RadioButton>
                 
                 <RadioButton currentValue={this.state.value} value={2} onPress={this.handleOnPress.bind(this)}>
                 <Text>Button3</Text>
                 </RadioButton>
                 
        </View>
    );
}
 

Basic

<RadioForm
currentValue={this.state.value}
 value={0}
 onPress={this.handleOnPress.bind(this)}
 outerCircleColor:'gray'
 outerCircleSize:{24}
 outerCircleWidth:{2}
 innerCircleColor:'red'
 innerCircleSize:{12}
/>

assign a unique value to each radio button in 'value'

Props

RadioButton Component

outerCircleSize[Default:{24}]

give the size of outer Circle of Button.

outerCircleWidth[Default:{2}]

give the width of outer Circle of Button.

outerCircleColor[Default:'#9eacb4']

give the color of outer Circle of Button.

innerCircleSize[Default:{12}]

give the size of inner Circle of Button

innerCircleColor[Default:'#ff6624']

give the color of inner Circle.

Package Sidebar

Install

npm i radio-button-react-native

Weekly Downloads

24

Version

1.1.6

License

ISC

Last publish

Collaborators

  • abhay2152