ThakurBallary / react-native-radio-buttons-group

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

`onPress` of `RadioButtonProps` is always ignored. #73

Closed Haschikeks closed 7 months ago

Haschikeks commented 7 months ago

Hey,

I just noticed that, when you supply a onPress in the RadioButtonProps, it is always overwritten from the RadioGroup.

        <RadioButton
          {...button}
          key={button.id}
          labelStyle={labelStyle}
          selected={button.id === selectedId}
          onPress={() => handlePress(button.id)}
        />

In a previous version the onPress looked like this

onPress={(id: string) => {
  handlePress(id);
  if (button.onPress && typeof button.onPress === 'function') {
    button.onPress(id);
  }
}}

which I would prefer.

ThakurBallary commented 7 months ago

@Haschikeks thanks for writing. Fix is released in v3.0.8

Haschikeks commented 7 months ago

Hey @ThakurBallary thank you for the quick fix. I also just noticed that the same "problem" is with the selected prop. Although I'm not sure, this is as easily fixed.

For my project, I was able to use the RadioGroup.selectedId.