awran5 / react-simple-star-rating

A simple react component for adding a star rating to your project.
https://react-simple-star-rating.vercel.app/
MIT License
136 stars 32 forks source link

Ratings broken! #23

Open jeremyrajan opened 2 years ago

jeremyrajan commented 2 years ago

Thanks for lib :)

Just trying to implement it using floating values for 5 star rating component. Doesnt seem to work. It weird that for 5 it somehow is taking as 0.5 or less (if you look closely)

<Rating
                  className="flex"
                  ratingValue={5}
                  readonly
                  transition
                  size={20}
                  allowHalfIcon
                  fillColorArray={[
                    "#f17a45",
                    "#f19745",
                    "#f1a545",
                    "#f1b345",
                    "#f1d045",
                  ]}
                />
image

Not sure, what I am doing wrong

awran5 commented 2 years ago

Check this codesandbox it may help you . Also, please update to the latest version to avoid any possible bugs.

Also, you may need to use initialValue prop. Check this example

Let me know if still you need any help.

Thank you.