Repository navigation
fix(core): iOS app not responding after rotation - #9931
NathanWalker merged 2 commits into
Conversation
|
@dgmachado It seems this change causes other issues similar to the one you described. It seems there are cases that Is it possible that you post an app sample with your case? Perhaps, we can fix this using another approach. |
This reverts commit aee1d05.
|
@CatchABus I found out last week that my change doesn't fix the infinite loop even for my scenario. It's just a lot harder to reproduce the issue. Let me share with you an app sample with my case testPopover_tabBar5.zip And about your comment "It seems there are cases that additionalSafeAreaInsets receive new values over and over resulting in calling viewSafeAreaInsetsDidChange and ending up in an infinite loop." that's exactly the same thing I was getting frequently before my change. Is it possible you also share an app sample with your case? |
Thank you very much for this! I'll also use your sample and see what I can find. |
|
@CatchABus I just tested your app using the "@nativescript/core@8.2.4" and "@nativescript/core@8.2.0" to ensure the #9931 wasn't included and I could reproduce this same issue using simulator iPhone 8 (iOS 15.2). Video showing the infinite loop (Obs: it's an intermittent bug) @NathanWalker could confirm but I'm almost sure the #9931 was merged into the 8.2.5 version only. |
I believe this is a different case. So reverting this patch helped solve that RangeError (using iPhone 12 simulator) but I understand it still left your case unsolved. |
|
@dgmachado Thanks for the app, it was really useful. After lots of tests, I came up with my first attempt to solve this which I'd like you to try. Please modify this line: https://github.com/NativeScript/NativeScript/blob/main/packages/core/ui/core/view/index.ios.ts#L291 And update it to look like this: // View controllers that need insets calculate it on their own
if (this.viewController || this.iosIgnoreSafeArea) {
return frame;
}This small change has a big impact as it enforces a rule that we should not expand or shrink insets to views with view controllers by default. EDITED: Another solution which may be more accurate (haven't tested this one yet): // Check if insets are set by view controller
if (this.viewController && this.viewController.additionalSafeAreaInsets &&
(this.viewController.additionalSafeAreaInsets.top != 0 || this.viewController.additionalSafeAreaInsets.bottom != 0)) {
return frame;
}
if (this.iosIgnoreSafeArea) {
return frame;
}This covers the cases of NS I did few tests in the sample app and infinite loop seems to be gone. If possible, please leave some feedback regarding the efficiency of this fix until we find a better solution. |
PR Checklist
What is the current behavior?
The iOS app isn't responding after rotation. The issue is only reproducible on the iOS phone. Cannot be reproduced on an iOS tablet.
The issue can be reproduced immediately (after the first rotation) on the nested tabs scenario.
Could be reproduced on tabs scenario as well after multiple rotations and switch tabs in between.
When the issue happens, the UI appears to be cut into half and it's not responding at all.
iphone_tabs_issue_after_rotate.mov
What is the new behavior?
Fix the infinite loop that was occurring after successive rotations of the app so now the app is no longer getting stuck.