-
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 onChange callback #95
Add onChange callback #95
Conversation
modules/Media.js
Outdated
|
||
const { onQueryStateChange } = this.props; | ||
if (onQueryStateChange) { | ||
this.mediaQueryList.addListener(onQueryStateChange); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We already have a listener registered in updateMatches
. We should call the onChange
callback there instead of registering it as a separate listener.
modules/Media.js
Outdated
@@ -16,7 +16,8 @@ class Media extends React.Component { | |||
]).isRequired, | |||
render: PropTypes.func, | |||
children: PropTypes.oneOfType([PropTypes.node, PropTypes.func]), | |||
targetWindow: PropTypes.object | |||
targetWindow: PropTypes.object, | |||
onQueryStateChange: PropTypes.func |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
9738a31
to
8b5e738
Compare
@mjackson just made your suggested changes and I'm happy with the final result. The |
This LGTM, I went ahead and merged it in! @mjackson let me know if you want some stuff tweaked afterwards. |
This closes #94.
Sorry I couldn't wait for confirmation on #94, but I needed this feature. I'm using my fork for the time being, but I'd prefer to go back to using the original pkg once (and if) this is merged here.
Thanks! 😄