feat(heightCalculation) calculate height with getRealSize #68
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.