From bd8e1b8e79f95335d4e813a6ab283b43e1a8d6e0 Mon Sep 17 00:00:00 2001 From: Jason Cassidy <47318351+jcassidyav@users.noreply.github.com> Date: Tue, 18 Jul 2023 16:47:50 +0100 Subject: [PATCH] fix(application): explicitly pass rootView to initRootView (#10345) fixes occasional crashes when resuming the app. --- packages/core/application/application-common.ts | 4 ++-- packages/core/application/application.ios.ts | 4 ++-- packages/core/ui/frame/index.android.ts | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/core/application/application-common.ts b/packages/core/application/application-common.ts index 292fca32a..8ee5aaf23 100644 --- a/packages/core/application/application-common.ts +++ b/packages/core/application/application-common.ts @@ -364,8 +364,8 @@ export class ApplicationCommon { // rest of implementation is platform specific } - initRootView() { - this.setRootViewCSSClasses(this.getRootView()); + initRootView(rootView: View) { + this.setRootViewCSSClasses(rootView); initAccessibilityCssHelper(); initAccessibilityFontScale(); } diff --git a/packages/core/application/application.ios.ts b/packages/core/application/application.ios.ts index 1a61b7a97..a83d77b6f 100644 --- a/packages/core/application/application.ios.ts +++ b/packages/core/application/application.ios.ts @@ -157,7 +157,7 @@ export class iOSApplication extends ApplicationCommon implements IiOSApplication visibleVC.presentViewControllerAnimatedCompletion(controller, true, null); } - this.initRootView(); + this.initRootView(rootView); this.notifyAppStarted(); } @@ -349,7 +349,7 @@ export class iOSApplication extends ApplicationCommon implements IiOSApplication this._window.makeKeyAndVisible(); } - this.initRootView(); + this.initRootView(rootView); rootView.on(IOSHelper.traitCollectionColorAppearanceChangedEvent, () => { const userInterfaceStyle = controller.traitCollection.userInterfaceStyle; diff --git a/packages/core/ui/frame/index.android.ts b/packages/core/ui/frame/index.android.ts index 6d7b988ea..340604e53 100644 --- a/packages/core/ui/frame/index.android.ts +++ b/packages/core/ui/frame/index.android.ts @@ -1378,7 +1378,7 @@ class ActivityCallbacksImplementation implements AndroidActivityCallbacks { this._rootView = rootView; // sets root classes once rootView is ready... - Application.initRootView(); + Application.initRootView(rootView); } }