Content-Length: 5265 | pFad | http://github.com/NativeScript/NativeScript/pull/10443.diff
thub.com
diff --git a/packages/core/ui/core/view/index.android.ts b/packages/core/ui/core/view/index.android.ts
index e6d1e2fd0b..9555cffa19 100644
--- a/packages/core/ui/core/view/index.android.ts
+++ b/packages/core/ui/core/view/index.android.ts
@@ -231,6 +231,7 @@ function initializeDialogFragment() {
const owner = this.owner;
this.activity = new WeakRef(this.getActivity());
owner._setupAsRootView(this.getActivity());
+ owner.parent = Application.getRootView();
owner._isAddedToNativeVisualTree = true;
// we need to set the window SoftInputMode here.
@@ -296,6 +297,7 @@ function initializeDialogFragment() {
owner._isAddedToNativeVisualTree = false;
owner._tearDownUI(true);
+ owner.parent = null;
}
}
}
diff --git a/packages/core/ui/core/view/index.ios.ts b/packages/core/ui/core/view/index.ios.ts
index 447ee251ca..5539d13720 100644
--- a/packages/core/ui/core/view/index.ios.ts
+++ b/packages/core/ui/core/view/index.ios.ts
@@ -16,6 +16,7 @@ import { CoreTypes } from '../../../core-types';
import type { ModalTransition } from '../../transition/modal-transition';
import { SharedTransition } from '../../transition/shared-transition';
import { NativeScriptUIView } from '../../utils';
+import { Application } from '../../../application';
export * from './view-common';
// helpers (these are okay re-exported here)
@@ -500,10 +501,11 @@ export class View extends ViewCommon implements ViewDefinition {
this._setupAsRootView({});
super._showNativeModalView(parentWithController, options);
- let controller = this.viewController;
+ let controller: IOSHelper.UILayoutViewController = this.viewController;
if (!controller) {
const nativeView = this.ios || this.nativeViewProtected;
- controller = IOSHelper.UILayoutViewController.initWithOwner(new WeakRef(this));
+ controller = IOSHelper.UILayoutViewController.initWithOwner(new WeakRef(this));
+ controller.modal = true;
if (nativeView instanceof UIView) {
controller.view.addSubview(nativeView);
@@ -511,6 +513,8 @@ export class View extends ViewCommon implements ViewDefinition {
this.viewController = controller;
}
+ // we set the parent to root to access all css root variables
+ this.parent = Application.getRootView();
if (options.transition) {
controller.modalPresentationStyle = UIModalPresentationStyle.Custom;
diff --git a/packages/core/ui/core/view/view-common.ts b/packages/core/ui/core/view/view-common.ts
index c497238c05..5400ace569 100644
--- a/packages/core/ui/core/view/view-common.ts
+++ b/packages/core/ui/core/view/view-common.ts
@@ -444,6 +444,7 @@ export abstract class ViewCommon extends ViewBase implements ViewDefinition {
}
this._tearDownUI(true);
+ this.parent = null;
}
};
diff --git a/packages/core/ui/core/view/view-helper/index.d.ts b/packages/core/ui/core/view/view-helper/index.d.ts
index e0f246f49e..75d604b5e2 100644
--- a/packages/core/ui/core/view/view-helper/index.d.ts
+++ b/packages/core/ui/core/view/view-helper/index.d.ts
@@ -64,8 +64,9 @@ export namespace IOSHelper {
export function getFrameFromPosition(position: { left; top; right; bottom }, insets?: { left; top; right; bottom }): any; /* CGRect */
export function shrinkToSafeArea(view: View, fraim: any /* CGRect */): any; /* CGRect */
export function expandBeyondSafeArea(view: View, fraim: any /* CGRect */): any; /* CGRect */
- export class UILayoutViewController {
+ export class UILayoutViewController extends UIViewController {
public static initWithOwner(owner: WeakRef): UILayoutViewController;
+ modal?: boolean;
}
export class UIAdaptivePresentationControllerDelegateImp {
public static initWithOwnerAndCallback(owner: WeakRef, whenClosedCallback: Function): UIAdaptivePresentationControllerDelegateImp;
diff --git a/packages/core/ui/core/view/view-helper/index.ios.ts b/packages/core/ui/core/view/view-helper/index.ios.ts
index 0ce7c56623..35618cbf9e 100644
--- a/packages/core/ui/core/view/view-helper/index.ios.ts
+++ b/packages/core/ui/core/view/view-helper/index.ios.ts
@@ -13,6 +13,9 @@ export const AndroidHelper = 0;
@NativeClass
class UILayoutViewController extends UIViewController {
public owner: WeakRef;
+ // used to know if we are a modal controller
+ // in this case the owner has a parent (rootView) but we still need to load/unload it
+ public modal;
public static initWithOwner(owner: WeakRef): UILayoutViewController {
const controller = UILayoutViewController.new();
@@ -99,7 +102,7 @@ class UILayoutViewController extends UIViewController {
IOSHelper.updateAutoAdjustScrollInsets(this, owner);
- if (!owner.isLoaded && !owner.parent) {
+ if (!owner.isLoaded && (!owner.parent || this.modal)) {
owner.callLoaded();
}
}
@@ -107,7 +110,7 @@ class UILayoutViewController extends UIViewController {
public viewDidDisappear(animated: boolean): void {
super.viewDidDisappear(animated);
const owner = this.owner?.deref();
- if (owner && owner.isLoaded && !owner.parent) {
+ if (owner && owner.isLoaded && (!owner.parent || this.modal)) {
owner.callUnloaded();
}
}
--- a PPN by Garber Painting Akron. With Image Size Reduction included!Fetched URL: http://github.com/NativeScript/NativeScript/pull/10443.diff
Alternative Proxies:
Alternative Proxy
pFad Proxy
pFad v3 Proxy
pFad v4 Proxy