Skip to content

feat(heightCalculation) calculate height with getRealSize#68

Merged
paufau merged 1 commit intopaufau:mainfrom
wendyprogramic:feature/heightCalculation
Jan 28, 2026
Merged

feat(heightCalculation) calculate height with getRealSize#68
paufau merged 1 commit intopaufau:mainfrom
wendyprogramic:feature/heightCalculation

Conversation

@wendyprogramic
Copy link
Contributor

This PR simplifies the logic used to determine the screen dimensions for the Modal host on Android.

Motivation

The previous implementation attempted to manually calculate the window size by combining getCurrentSizeRange, getSize, and a manually resolved status bar height.

This logic grew brittle across different Android manufacturers and OS versions.
Specifically, it led to inconsistencies where the bottom navigation bar (soft keys) was sometimes double-counted or excluded incorrectly, causing the Modal background to either fall short of the bottom edge or extend too far.
Manually resolving windowFullscreen themes and status_bar_height resources is often unreliable in modern edge-to-edge Android layouts.
The Solution:
I have replaced the complex calculation with display.getRealSize().

This method returns the actual raw pixel size of the display, including the system decorations (status bar and navigation bar).
This ensures the Modal always covers the entire physical screen, providing a consistent canvas.
Recommendation for Consumers:
With this change, the Modal will span the full screen. To handle padding for the Status Bar and Bottom Navigation Bar, consumers should rely on standard libraries like react-native-safe-area-context within their JavaScript/React components. This delegates insets handling to the UI layer where it belongs, rather than hardcoding assumptions in the native module layer.

Changes
Removed manual status bar height calculation and getCurrentSizeRange logic.
Implemented display.getRealSize(SIZE_POINT) to reliably get the full physical screen dimensions.
Test Plan
Open the app on an Android device with a software navigation bar (e.g., Pixel).
Open a Modal.
Verify the modal background covers the entire screen, including behind the status bar and navigation bar.
Verify on a device with gesture navigation enabled.

WhatsApp Image 2026-01-23 at 14 33 18

@paufau paufau merged commit b130e22 into paufau:main Jan 28, 2026
1 check passed
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