Open minimalistech opened 5 years ago
You can assign the prop 'default value' to a state For example defaultRating={this.state.rating} Now reset your state to 0 or whatever initial value you want
@appielife How can i use this on custom type? https://github.com/Monte9/react-native-ratings/issues/89
I believe that this fail comes down to these lines of code; the component internally sets itself to n stars but the value of props.defaultRating
, when trying to "reset" it, is the same as before, so nothing updates. I hacked around it by temporarily setting defaultRating
to something else, and then back, but it's not a very satisfactory solution. I'd offer up a PR (and maybe still will), but I'm not sure about the motivation for getDerivedStateFromProps
and fear that I would break some clever animation thing if I did it more conventionally (going fully controlled or fully uncontrolled by props
). The advice here may be relevant.
You can assign the prop 'default value' to a state For example defaultRating={this.state.rating} Now reset your state to 0 or whatever initial value you want
not working
Hi, I am showing images and using AirbnbRating to let users rate the images. I am not finding an easy way to set the rating to the default values after the user rates the first image. I wan to clear the yellow stars and show them all grey.