voronianski / react-star-rating-component

Basic React component for star (or any other icon based) rating elements
http://voronianski.github.io/react-star-rating-component/example
MIT License
380 stars 77 forks source link

why stars are overlapping if the rating value=1.5, 2.5 , 3.5 and it's working fine for 4.5 and above rating. How to resolve this issue? #64

Closed srikanthpathlavath closed 5 years ago

srikanthpathlavath commented 5 years ago

Screenshot (62)

srikanthpathlavath commented 5 years ago

please help me to resolve this issue.

srikanthpathlavath commented 5 years ago

If anyone has the same issue, please follow the below steps:

renderStarIconHalf={(index,value) => {

return (
            <span className={`${(value === 0.5 || value === 1.5 || value === 2.5 || value === 3.5)
               ? "cst-half-star" :  ""}`}>
                 <span style={{ position:"absolute"}} >
                       <i className="far fa-star" />
                 </span>
                 <span>
                       <i className="fas fa-star-half" />
                 </span>
            </span>
 );

}}


CSS style:

.cst-half-star { margin-right: 10px; }