`StatusBar.currentHeight` gives incorrect height on Google Pixel 5a (Android 12)
See original GitHub issueDescription
StatusBar.currentHeight
provides an incorrect value for the height of the status bar on a Google Pixel 5a with Android 12. From basic testing, this does not seem to be an issue on other devices or on an older OS (Android 11)
Screenshot when using StatusBar.currentHeight
as the top margin
Expected:
Version
0.66.0
Output of npx react-native info
example on Expo, this is occurring in multiple versions of react native, notably tested on 0.66.0
and 0.64.2
Steps to reproduce
- use
StatusBar.currentHeight
- compare calculated height on Google Pixel 5a (Android 12) to other Android devices - the height for Pixel 5a Android 12 does not match the full height as it appears on the device while other devices do still work
Snack, code example, screenshot, or link to a repository
Issue Analytics
- State:
- Created a year ago
- Reactions:10
- Comments:11 (3 by maintainers)
Top Results From Across the Web
Pixel 6 & 6 Pro 'incorrect status bar height relative to camera ...
Many Pixel 6 and 6 Pro users are now reporting that the level of the status bar has moved up relative to the...
Read more >How to find height of status bar in Android through React ...
HEIGHT will give you the current height of the Status Bar on Android. import { Platform, NativeModules } from 'react-native'; const { StatusBarManager...
Read more >Statusbar Size Fix | XDA Forums
Here's a workaround on getting a smaller statusbar area if you have root. Flash the attached zip in magisk manager. Go to developer...
Read more >TextureView - Android Developers
Boolean internal attribute to adjust view layout based on system windows such as the status bar. If true, adjusts the padding of this...
Read more >The status bar on the pixel 5 is way too tall - Reddit
It shifts the position of the hole punch, it's size, and its padding. You end up with more usable screen, but it looks...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Not just Pixel 5a, but many devices that may have a notch.
Hi ! We quick fixed it statically until we have time to tackle it properly or it gets fixed. It look like this:
The
initialWindowMetrics?.insets.top
actually returns the correct insets. (Obviously it would be better to use auseInsets
and the context to be sure to have it updated in case it change dynamically)Let me know if it’s unclear !