1.1.6 • Published 7 years ago
radio-button-react-native v1.1.6
radio-button-react-native
Simple Radio Button component for React Native
Demo
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
outerCircleSizeDefault:{24}
give the size of outer Circle of Button.
outerCircleWidthDefault:{2}
give the width of outer Circle of Button.
outerCircleColorDefault:'#9eacb4'
give the color of outer Circle of Button.
innerCircleSizeDefault:{12}
give the size of inner Circle of Button
innerCircleColorDefault:'#ff6624'
give the color of inner Circle.