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] Improve popover height calculations when using multiple displays #140

Merged
merged 2 commits into from
Jan 17, 2024

Conversation

gabrieldonadel
Copy link
Member

Why

We always had issues with resizing the Popover height accurately, but after upgrading react-native-macos to 0.73 this has become more apparent, often cropping the "Quit" button on the UI

How

In react-native-macos to 0.73 Dimensions.get('screen') no longer returns the actual screen size on the first few renders (microsoft/react-native-macos@d1ed53d), so instead of relying on multiple retries this PR refactor useSafeDisplayDimensions to not use the Dimensions API.

By exporting the initial screen size as a constant in MenuBarModule and including the screen size in the body of the popoverFocused event we can ensure that the screen size data is always up to date.

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 merged commit 697cab7 into main Jan 17, 2024
1 check passed
@gabrieldonadel gabrieldonadel deleted the @gabrieldonadel/fix-menu-bar-height branch January 17, 2024 14:56
This pull request was closed.
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.

2 participants