You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Oct 14, 2020. It is now read-only.
Make the StatusBar height available via a constant on iOS just like on Android.
RCTSharedApplication().statusBarFrame.size.height
Why it is needed
This would make the API more consistent between the platforms. On iOS it used to be the case that the StatusBar was always 20 pt (portrait at least), this has changed since the iPhone X was introduced, since the height on such devices is 44. The problem is now similar to Android, if you want to use the StatusBar height in a calculation on iOS you need to guess it based on the full screen size. This guessing would be solved by exposing the height of the StatusBar using a constant just like the implementation for Android.
I am aware of the existence of the (internal?) getHeight callback API that is exposed by the native iOS module, however since the StatusBar height is mostly static so I think the current documented Android API is better.
Possible implementation
Just like the Android implementation: using the constant exporting feature that native modules have.
I also saw #22 and I can imagine that constant exports are actually not the best implementation for both iOS and Android. However, an async solution would not be easy to work given that this is actually part of the state of your app but still something that you want to have available in a StyleSheet for example. Since the API for Android already exists I thought it wouldn't harm to suggest this implementation anyways. Solving dynamic values can then be seen as a separate issue.
Feature Request
Make the StatusBar height available via a constant on iOS just like on Android.
RCTSharedApplication().statusBarFrame.size.height
Why it is needed
This would make the API more consistent between the platforms. On iOS it used to be the case that the StatusBar was always 20 pt (portrait at least), this has changed since the iPhone X was introduced, since the height on such devices is 44. The problem is now similar to Android, if you want to use the StatusBar height in a calculation on iOS you need to guess it based on the full screen size. This guessing would be solved by exposing the height of the StatusBar using a constant just like the implementation for Android.
I am aware of the existence of the (internal?) getHeight callback API that is exposed by the native iOS module, however since the StatusBar height is mostly static so I think the current documented Android API is better.
Possible implementation
Just like the Android implementation: using the constant exporting feature that native modules have.
Code sample
The text was updated successfully, but these errors were encountered: