-
Notifications
You must be signed in to change notification settings - Fork 116
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
Add <Media queries> prop #69
Comments
This looks great! Following the pattern of react-router and other libraries, do you think there should just be a |
I definitely like the name |
Hi @mjackson! If you are still interested in going with this approach for next major release, I created a PR with a solution as described in this issue |
Any news about this ? |
@mjackson Any update on this? Would like to use this feature. |
@prateekgoel We've merged #72 into the |
Thank you @edorivai, Glad to hear that 😃 |
This should already be available in the prerelease of You can expect the release soon (see #123 for details)! |
This is a follow-up from #38. I removed the commits from #39 in order to ship a 1.x without deprecation warnings, and I'd like to release a 2.x that removes the
<Media query>
prop and uses<Media queries>
instead. This is a breaking change.The API should be:
Note that the value of the
queries
prop is not itself a media query, but its values are. Thechildren
callback receives an object of the same shape (i.e. has the same keys) whose values are boolean, indicating if that query matches or not. Aquery
object may be any of the following:(min-width: 100px) and (max-width: 200px)
{ minWidth: 100, maxWidth: 200 }
=>(min-width: 100px) and (max-width: 200px)
[ { screen: true, minWidth: 100 }, { handheld: true, orientation: 'landscape' } ]
=>screen and (min-width: 100px), handheld and (orientation: landscape)
At this point I'm thinking the
render
prop should probably just be removed. We can always add it back later if people find they need it.The text was updated successfully, but these errors were encountered: