DEV Community

loading...

Discussion on: Create your own radio button component in react native easily

Collapse
avs30390 profile image
avs30390

RadioButton.js

class RadioButton extends Component {
constructor(props) {
super(props)
this.state = {
value: null,
Arr: []
}
}
_renderRadioButton() {
return this.props.Arr.map((item, i) => {
return (


{item.text}


style={Styles.radioCircleStyles}
onPress={this.props.onPress}
>
{this.props.value === item.key && ()}



)
})
}

render() {
    return (
        <View style={Styles.radioButtonMainContainerStyles} >
            {this._renderRadioButton()}
        </View>


    )
}

}

APP.jS

this._handleRadioButton(item)} value ={this.state.value}/>

Please find the screenshot for the error
Or Send me your email-id i will share you my code.