react-native-simple-radio-button icon indicating copy to clipboard operation
react-native-simple-radio-button copied to clipboard

How to set state to initial properties

Open amitpadmani opened this issue 7 years ago • 3 comments

Hello,

I have 3 radio button in from male.female and other. after submitting from when user select edit from option, i went select button form state. state is contain value 0,1,2.

How can i resolved ? please give suggestions.

Thanks,

amitpadmani avatar Sep 12 '17 08:09 amitpadmani

Hey, did you have any success? I bumped on the same issue here.

tiagodprovenzano avatar Nov 15 '17 16:11 tiagodprovenzano

Yes, bro i done... please check below code,

//UI <RadioForm radio_props={radio_props_gender} initial={this.state.gender} labelStyle={{padding:10}} formHorizontal={true} selectedButtonColor={'#0CB72E'} onPress={(value) => {this.setState({gender:value})}} buttonColor={'#0CB72E'}/>

// radio button props for gender const radio_props_gender = [ {label: 'Male', value: 0 }, {label: 'Female', value: 1 }, {label: 'Unknown', value: 2 } ];

//constructor for state of gender constructor(props) { super(props); this.state = { gender:0, // can change here... 0 | 1 | 2 }

ap050492 avatar Nov 16 '17 12:11 ap050492

Please help me, i am having same problem here

ghost avatar Mar 09 '18 11:03 ghost