Skip to content
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

Prop type warning when passing a non String value as a key #6

Open
bampisSyk opened this issue Jul 12, 2018 · 3 comments
Open

Prop type warning when passing a non String value as a key #6

bampisSyk opened this issue Jul 12, 2018 · 3 comments
Labels
bug Something isn't working

Comments

@bampisSyk
Copy link
Collaborator

Issue description

I've came across a proptype warning when passing an int as options key.
focusItem is declared as a string in App.js seems reasonable enough so i think a simple conversion is enough as a think many people may try to pass an int as the option key, my case was passing the product_id from a an api.

I know that this is against the PropTypes use but i think an exception here adds some kind of flexibility

Steps to reproduce the issue

Just pass an int as the options key, you can try it in the PlayGround.js file

What's the expected result?

I think a conversion, maybe wrong

What's the actual result?

A proptype warning

Additional details / screenshot

image

A fix maybe bampisSyk@9a987e6

@stratos-vetsos
Copy link
Owner

stratos-vetsos commented Jul 12, 2018

Very nice remark!

Is "focusedItem" the only prop related to options, that excepts a string? Or we should consider normalize all the options before we pass it down to the component?

A pull request will be really helpful!
Thanks a lot

@stratos-vetsos stratos-vetsos added the bug Something isn't working label Jul 12, 2018
@bampisSyk
Copy link
Collaborator Author

About to do some more digging... i'll post back the results

@stratos-vetsos
Copy link
Owner

Any feedback on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants