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

Stars appearing vertically #53

Open HarkiratShopism1 opened 1 year ago

HarkiratShopism1 commented 1 year ago

I am using tailwind css in my project and after I installed tailwind I am experiencing a vertical alignment of stars

*

Can someone help me sort this out.

baydisng13 commented 1 year ago

I am also facing the same issue in my Next.js and Tailwind projects. image when I pass the props emptyClassName="flex" no change but when I pass the props emptyStyle={{display:"flex"}} will render horizontally but not function as it should be Specifically, even if I select multiple stars, only the first star shows as filled. See the screenshot below for an example where I selected 4 stars but only the first star is filled: image

henaorth16 commented 1 year ago

Make the wrapper div flex flex-col h-auto

HarkiratShopism1 commented 1 year ago

Make the wrapper div flex flex-col h-auto I tried to implement the above mentioned suggestion the stars are aligned horizontally after implementing but when I try to select multiple stars, only the first star shows as filled.

Tallal64 commented 11 months ago

@baydisng13 pass the prop "SVGclassName={inline-block}" instead of "emptyStyle={{display:"flex"}}" and hopefully it will fix the problem.

real

m-lyon commented 10 months ago

@Tallal64 this does not resolve the issue for me. Instead, i set SVGstyle={{ display: 'inline-block' }} which resolved the issue.

undermad commented 9 months ago

Hey, That works for me

<Rating
            SVGclassName={'inline-block'}
            initialValue={4}
            readonly={true}/>
zaadevofc commented 7 months ago

I am also facing the same issue in my Next.js and Tailwind projects. image when I pass the props emptyClassName="flex" no change but when I pass the props emptyStyle={{display:"flex"}} will render horizontally but not function as it should be Specifically, even if I select multiple stars, only the first star shows as filled. See the screenshot below for an example where I selected 4 stars but only the first star is filled: image

thanks its work for me

KhaliLounis commented 4 months ago

none of the fixes above worked for me anything new ?

agusdwimilniadi commented 4 months ago

none of the fixes above worked for me anything new ? i worked with https://github.com/awran5/react-simple-star-rating/issues/53#issuecomment-1826594718

pantharshit007 commented 4 months ago

Explanation of how problem is getting solved:

I spent some time twerking in dev tools on the browser, and that's when I found this:

image and changing here block to inline fixed the problem now all that's left is to check how to change SVG class properties which you can find in the Rating.d.ts file.

image and after that when I checked the issue @Tallal64 already fixed that.

thanks, mate

image

jkmuku commented 2 months ago

The above solutions don't work when using custom icon

jack-song commented 1 month ago

The above solutions don't work when using custom icon

@jkmuku dunno if you figured this out, but on my custom icon i just set inline-block directly in the icon component and it works

akarshshri commented 1 month ago

I'm using version 5.1.7.

Okay so none of the above solution worked. Passing emptyStyle={{display:"flex"}} as prop worked but filling the star was only working for 1 star.

Next solution, passing SVGclassName={inline-block} as a prop didn't working. I was getting error in typescript. I'm finally able to solve this issue by manually overriding the css.

.react-simple-star-rating :where(img, svg, video, canvas, audio, iframe, embed, object){
    display: inline !important;
}
Smartech-git commented 1 week ago

@baydisng13 pass the prop "SVGclassName={inline-block}" instead of "emptyStyle={{display:"flex"}}" and hopefully it will fix the problem.

real

This worked for me 💯