-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
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
Hidden does not work after window.addEventListener('resize', this.resizeEvent). #12798
Comments
@Taz742 Please provide a full reproduction test case. This would help a lot 👷 . |
@oliviertassinari https://codesandbox.io/s/yqnzq2jk31 |
@Taz742 It's exactly the same issue than with #12288. The fix is the same in - <EventListener target="window" onResize={this.handleResize}>
- <Component {...more} />
- </EventListener>
+ <React.Fragment>
+ <Component {...more} />
+ <EventListener target="window" onResize={this.handleResize} />
+ </React.Fragment> |
@Taz742 Do you want to work on it? |
@oliviertassinari I need to install https://www.npmjs.com/package/react-event-listener ? |
@oliviertassinari Yes sure, i want to work on it. Thanks! |
@Taz742 The problem is that you are calling setState, it's rerendering the React tree, unsubscribing and resubscribing to the resize event. In the process, we miss the event. By pruning the rerendering of EventListener, we can respond to the event. |
Hello, i want to use a Hidden property, but when I'm using window.addEventListener('resize', this.resizeEvent) inside my component Hidden does not work... Any idea how can I use both of them?
The text was updated successfully, but these errors were encountered: