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
135 stars 31 forks source link

Rating is loading 10 stars on refresh then quickly returning to 5 stars #49

Open ZalwayJH opened 1 year ago

ZalwayJH commented 1 year ago
                  <Rating
                      iconsCount={5}
                      size={25}
                      ratingValue={0}
                      transition
                      allowFraction
                      readonly
                      initialValue={element}
                      fillColor="#D32748"
                    />

element is a tempory value just to see it working but it ranges from anywhere between 1 and 4, but it always loads as 5 out of 10 stars no matter what for a split second which messes up the layout with the increased height then quickly fixes itself. Any ideas what im doing wrong?

digvijaySinghTntra commented 1 year ago

Did you find any solution? I am facing the same issue.

briancaow commented 1 year ago

Im also facing the same issue

YuriyYM commented 1 year ago

Try to add your custom class with "display:none" property to fillClassName property of the Rating component. It works for me

chmcphoy commented 10 months ago

Possibly a hydration issue, try seeing if it works on incognito - did for me.

If it works, upgrading to React 18.3.x or a framework specific solution could help, e.g this.

james-deee commented 7 months ago

@YuriyYM that did not work for me. Here's what i have

            <Rating
              allowFraction={true}
              readonly={true}
              initialValue={book.overall_rating}
              size={20}
              SVGclassName={"inline-block"}
              fillClassName="display:none"
            />
shroommm commented 4 months ago

I tried display: none with taillwindcss class (hidden) in fillClassName and it works.