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

[menu-bar] Fix Popover height after putting Mac to sleep #28

Conversation

gabrieldonadel
Copy link
Member

@gabrieldonadel gabrieldonadel commented Aug 10, 2023

Why

Closes #22

It seems that there is a bug in react-native-macos when calling Dimensions.get('screen') right after unplugging a display and awaking the computer, which results in the Dimensions API returning height: 0

TODO

How

This PR adds a workaround that attempts to mitigate this problem by waiting 100ms and trying to get the screen dimensions again.

Test Plan

  1. Open the Popover on a second monitor
  2. Put your Mac to sleep from the second monitor
  3. Unplug the monitor
  4. Wake up your Mac and press the Orbit Icon on the menu bar
  5. Ensure the devices list is displayed correctly

@gabrieldonadel gabrieldonadel self-assigned this Aug 10, 2023
@gabrieldonadel gabrieldonadel marked this pull request as ready for review August 10, 2023 16:07
@gabrieldonadel gabrieldonadel changed the title [menu-bar] Fix Popover height after put Mac to sleep [menu-bar] Fix Popover height after putting Mac to sleep Aug 10, 2023
@gabrieldonadel gabrieldonadel merged commit 91cc284 into main Aug 10, 2023
@gabrieldonadel gabrieldonadel deleted the @gabrieldonadel/fix-popover-dimensions-after-unplugging-display branch August 10, 2023 16:26
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.

[Bug] - Layout breaking after going on "sleep" mode.
1 participant