-
Notifications
You must be signed in to change notification settings - Fork 94
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to show rating value on full/rating symbol. #31
Comments
I am not sure to understand what you mean... Are your Do you mean having a rating where the symbols correspond to the rate number they represent? For example, a rating of 4 would be something like this:
Then, for example, selecting 3 rate would appear like this:
Or just changing the color of the rate to another color. |
No, just my custom components
yes At the moment I already checked the source and unfortunately did not found this feature "from the box". As quick and very dirty workaround I created an array of my components
It is working, but now I have console warning.
|
You can pass an array of symbols to I suppose you meant: var emptyArr = [<EmptyRating index={1}/>, <EmptyRating index={2}>]
<Rating
empty = {emptyArr}
/> Mind the BTW: <Rating start={0} stop={4}
empty={[1,2,3,4].map(n => <span className="icon-text">{n}</span>)}
full={[1,2,3,4].map(n => <span className="icon-text icon-selected">{n}</span>)}
/> Check the jsfiddle |
Ah! And regarding the warning:
This is probably because of how Should not be an issue because it is only a propTypes complain. I will look into it later. If you want you can play around with React.PropTypes. The part where types are defined is here. |
Yeah, misstyped)
It is ok cause it works, but It seems kinda clumsy for me. I expected corresponding rate to be passed into react component.
It is a bit more complicated in my case, but thanks for help)
Yes, there is React.PropTypes.element |
This warning was revealed in issue #31.
Yep, it works because this is the way it was designed to work. For your use case it might seem clumsy because you are using exactly the same symbol with different rates. But, you could use a completely different symbol for each rate, regardless the rate. I mean a star, a heart, a circle, and a thumb up. All them in the same rating. Another thing is that we could add a way to make it easier to solve this use case, that might be more frequent than having a mix of different ones. Or even better. We could move this decission to the user through a function. I mean, passing a function to the |
I want to create a rating labelled with numbers of corresponding rate.
Something like this: [1][2][3][4]
"empty" and "full" elements are custom React components, so I am using component this way:
But I cant figure out how to access corresponding rate number from my "EmptyRating" and "FullRating" components.
Is there any way to achieve it?
The text was updated successfully, but these errors were encountered: