Simple Radio Button component for React Native
in Cli
npm i radio-button-react-native --save
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)}/>
<RadioButton currentValue={this.state.value} value={1} onPress={this.handleOnPress.bind(this)}/>
<RadioButton currentValue={this.state.value} value={2} onPress={this.handleOnPress.bind(this)}/>
</View>
);
}
<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'
give the size of outer Circle of Button.
give the width of outer Circle of Button.
give the color of outer Circle of Button.
give the size of inner Circle of Button
give the color of inner Circle.