Description
Solution to many open issues with edge-to-edge mode compatibility of this library - this is more of a fix than an issue
I had this problem that my application drew over the navigation bar like many of the currently open issues.
The solution is to not use initialWindowMetrics.frame as it is incorrectly derived from Dimensions.get('window') (this might be a bug in Android API level 35+?)
Instead utilize the correct initialWindowMetrics.insets.bottom and initialWindowMetrics.insets.top alongside Dimensions.get('screen') to calculate application window dimensions manually
Example:
const applicationWindowHeight = Dimensions.get('screen').height - initialWindowMetrics.insets.bottom - initialWindowMetrics.insets.top
Steps to reproduce
- use initialWindowMetrics.frame
- observe correctness in Android API 35 and less
- observe incorrectness in Android API 35+
Snack or a link to a repository
https://example.com
Safe Area Context version
5.7.0
React Native version
0.84.0
Platforms
Android
Architecture
Fabric (New Architecture)
Build type
Release mode
Device
Real device
Device model
No response
Acknowledgements
Yes
Description
Solution to many open issues with edge-to-edge mode compatibility of this library - this is more of a fix than an issue
I had this problem that my application drew over the navigation bar like many of the currently open issues.
The solution is to not use initialWindowMetrics.frame as it is incorrectly derived from Dimensions.get('window') (this might be a bug in Android API level 35+?)
Instead utilize the correct initialWindowMetrics.insets.bottom and initialWindowMetrics.insets.top alongside Dimensions.get('screen') to calculate application window dimensions manually
Example:
const applicationWindowHeight = Dimensions.get('screen').height - initialWindowMetrics.insets.bottom - initialWindowMetrics.insets.topSteps to reproduce
Snack or a link to a repository
https://example.com
Safe Area Context version
5.7.0
React Native version
0.84.0
Platforms
Android
Architecture
Fabric (New Architecture)
Build type
Release mode
Device
Real device
Device model
No response
Acknowledgements
Yes