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

Allow Node as placeholder #3436

Merged
merged 2 commits into from
Apr 16, 2019
Merged

Conversation

eemeli
Copy link
Contributor

@eemeli eemeli commented Feb 20, 2019

Fixes #1378

Even though Placeholder accepts Node children, the placeholder prop on Select expects string type. This causes an unnecessary dev mode warning when using e.g. a React element as a placeholder, even though it already works.

This PR relaxes the prop type to allow any node as placeholder. I also fixed the placeholder tests to actually test what they say they test.

@Rall3n
Copy link
Collaborator

Rall3n commented Feb 20, 2019

#1378 (comment)

Original issue was for version 1.x. In version 2.x you can replace every component that react-select uses. So this merge request is pretty unnecessary imo.

@eemeli
Copy link
Contributor Author

eemeli commented Feb 21, 2019

@Rall3n Custom components don't really help with the restricting prop type on Select. Yes, they technically allow for an alternative way of producing a custom placeholder, but the ergonomics of doing that are really rather clumsy, especially when compared to what's possible already with the default Placeholder -- provided that you ignore the prop type warning that I'm seeking to get rid of here.

@eemeli
Copy link
Contributor Author

eemeli commented Mar 11, 2019

@gwyneplaine Any chance of getting this looked at? It's literally a single-line fix, plus associated tests.

@eemeli
Copy link
Contributor Author

eemeli commented Mar 12, 2019

Rebased on latest master.

@JedWatson
Copy link
Owner

I can't really see any downside to this. Thanks @eemeli 👍

@JedWatson JedWatson merged commit a51d5ea into JedWatson:master Apr 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow placeholder to be a node
3 participants