ThakurBallary / react-native-radio-buttons-group

Simple, best and easy to use radio buttons for react native apps.
MIT License
248 stars 70 forks source link

when setting state in onpress the inner circle does not show- the selected one #34

Closed morelgarisi closed 2 years ago

morelgarisi commented 2 years ago

<Common.RadioGroup radioButtons={[ { id: '1', label: 'אופציה 1', value: 'option1', color: 'blue', layout: 'row', size: 24, }, { id: '2', label: 'אופציה 2', value: 'option2', layout: 'row', size: 26, }, ]} layout={'row'} onPress={arr=> { console.log('pressed group') let sel=arr.find(e => e.selected)?.value this.setState({radio_selected:sel}) }} containerStyle={{ backgroundColor: 'yellow' }} />

morelgarisi commented 2 years ago

whats the point of this line : if (!_.isEqual(radioButtons, radioButtonsLocal)) { setRadioButtonsLocal(radioButtons); } by removing it everything works

ThakurBallary commented 2 years ago

30 helps you understand the use and you can also find working example over there.