-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Use debounce for onDimensionChange in withWindowDimensions HOC #2799
Use debounce for onDimensionChange in withWindowDimensions HOC #2799
Conversation
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.
I think it'd be good to include a comment explaining why we're debouncing this (like you've explained in the issue) with a link to the react-native issue. Since this should be a temporary fix, it's good to have some context if we choose to remove this in the future because the bug is fixed.
Other than that, the changes look good to me, and I was able to test them as well, nice job!
Thanks for the review @jasperhuangg, added comments and updated the PR 👍 |
Great explanation! Thanks :) |
🚀 Deployed to staging in version: 1.0.43-1🚀
|
🚀 Deployed to production in version: 1.0.44-0🚀
|
cc @deetergp
Details
React native has a bug where it calls onDimensionChange callback with swapped dimensions for a very short time before it's called with correct dimensions. facebook/react-native#29290
When this happens, a bug in react-navigation causes left menu to be positioned in the center instead of left side. We're fixing this issue by using debounce to prevent onDimensionChange callback from being called multiple times within 100ms to let react-navigation to complete its animations and positioning elements properly.
Fixed Issues
Fixes #2180
Tests
Verified that left menu is not shown in the center when the app is loaded from background on iPad devices.
QA Steps
Tested On
Screenshots
iOS
Screen.Recording.2021-05-11.at.18.35.16.420p.mov