-
Notifications
You must be signed in to change notification settings - Fork 24.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update window size when the in-call status bar is toggled #19919
Conversation
But in-call status bar does not reduces window height. Same as normal status bar, it draws over application window, but not changes it's size. References:
|
@vovkasm I haven’t tested on all iOS versions but on iOS 11 it does resize the window by 20pt when the in call status bar is toggled. I assume apple did this to make it easier to manage since you can assume the status bar always covers 20pt at the top of the screen, instead of having to consider that it sometimes cover 40pt when the in call status bar is on. |
@janicduplessis I just did some tests:
I'm as a developer can set any constraints in UIViewController and make RCTRootView do not relayout on in-call status bar. Right? |
I think what you want to use |
With the default RN setup, window size should be the same as the rootview. You can always get the real screen size using “screen”. In this case I am just measuring the root VC so if you decide to remove thr default 20 top constraint it would still return the right value. |
Screen - is totally different thing... Do not mix it with window please.
And again, why you can't get size of root view with onLayout event? It will work always - for rotations, for split view, for custom layout logic in custom view controller, etc... |
@janicduplessis I tried to find reviewers for this pull request and wanted to ping them to take another look. However, based on the blame information for the files in this pull request I couldn't find any reviewers. This sometimes happens when the files in the pull request are new or don't exist on master anymore. Is this pull request still relevant? If yes could you please rebase? In case you know who has context on this code feel free to mention them in a comment (one person is fine). Thanks for reading and hope you will continue contributing to the project. |
Alright, let's leave this as is. I'm working on a new api to get the root view layout metrics instead. |
When the in-call status bar is toggled, the Dimensions module window doesn't resize properly. The current code assumes that window and screen is always the same on iOS but it is not the case for when the in-call status bar is on. The viewport size is reduced by 20px in that case.
This results in the following behaviour changes:
Dimensions
modulechange
event is now triggered when the in-call status bar is toggledwindow
andscreen
values of theDimensions
module are not always the same on iOS, currently only different when the in-call status bar is opened.Dimensions
modulechange
event is now triggered when the status bar is shown / hidden. Right now this is not ideal but I'm planning to addsafeAreaInsets
to theDimensions
module and in that case the change event will be meaningful.RCTKeyWindow().rootViewController.view.bounds
seemed the best way I found to get the proper value for when the in-call status bar is on. Might want to verify this also work properly in non-pure RN apps.Test Plan:
Dimensions.get('window')
still fits properly when the in-call status bar is on.Dimensions
module values are still updated properly on screen rotation (and only once). Also works if the status bar is hidden.Release Notes:
[IOS] [BREAKING] [Dimensions] - Update window size when the in-call status bar is toggled