Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7625d6c

Browse files
MartoYankovmanoldonev
authored andcommitted
fix-next: handle view controller nesting in ng (NativeScript#6472)
1 parent 448936d commit 7625d6c

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

tns-core-modules/ui/core/view/view.ios.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -889,7 +889,15 @@ export namespace ios {
889889
// The TabView itself is handled by the OS, so we check the TabView's parent (usually a Page, but can be a Layout).
890890
const tabViewItem = owner.parent;
891891
const tabView = tabViewItem && tabViewItem.parent;
892-
const parent = tabView && tabView.parent;
892+
let parent = tabView && tabView.parent;
893+
894+
// Handle Angular scenario where TabView is in a ProxyViewContainer
895+
// Not using instanceof ProxyViewContainer to avoid circular dependency
896+
// TODO: Try moving UILayoutViewController out of view module
897+
if (parent && !parent.nativeViewProtected) {
898+
parent = parent.parent;
899+
}
900+
893901
if (parent) {
894902
const parentPageInsetsTop = parent.nativeViewProtected.safeAreaInsets.top;
895903
const currentInsetsTop = this.view.safeAreaInsets.top;

tns-core-modules/ui/page/page.ios.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,15 @@ class UIViewControllerImpl extends UIViewController {
224224
// If the Page is nested, cross check safe area insets on top and bottom with Frame parent.
225225
const frame = owner.parent;
226226
// There is a legacy scenario where Page is not in a Frame - the root of a Modal View, so it has no parent.
227-
const frameParent = frame && frame.parent;
227+
let frameParent = frame && frame.parent;
228+
229+
// Handle Angular scenario where TabView is in a ProxyViewContainer
230+
// Not using instanceof ProxyViewContainer to avoid circular dependency
231+
// TODO: Try moving UIViewControllerImpl out of page module
232+
if (frameParent && !frameParent.nativeViewProtected) {
233+
frameParent = frameParent.parent;
234+
}
235+
228236
if (frameParent) {
229237
const parentPageInsetsTop = frameParent.nativeViewProtected.safeAreaInsets.top;
230238
const currentInsetsTop = this.view.safeAreaInsets.top;

0 commit comments

Comments
 (0)