diff --git a/apps/app/ui-tests-app/modal-view/login-page.xml b/apps/app/ui-tests-app/modal-view/login-page.xml index c4de55839..431027d0d 100644 --- a/apps/app/ui-tests-app/modal-view/login-page.xml +++ b/apps/app/ui-tests-app/modal-view/login-page.xml @@ -1,4 +1,6 @@ - + diff --git a/tns-core-modules/ui/core/view/view.android.ts b/tns-core-modules/ui/core/view/view.android.ts index a96090764..10e647043 100644 --- a/tns-core-modules/ui/core/view/view.android.ts +++ b/tns-core-modules/ui/core/view/view.android.ts @@ -142,11 +142,15 @@ function initializeDialogFragment() { this.setStyle(android.app.DialogFragment.STYLE_NO_TITLE, 0); const dialog = new DialogImpl(this, this.getActivity(), this.getTheme()); - - // adjust alignment based on fullscreen value. - this.owner.horizontalAlignment = this._fullscreen ? "stretch" : "center"; - this.owner.verticalAlignment = this._fullscreen ? "stretch" : "middle"; + // do not override alignment unless fullscreen modal will be shown; + // otherwise we might break component-level layout: + // https://github.com/NativeScript/NativeScript/issues/5392 + if (this._fullscreen) { + this.owner.horizontalAlignment = "stretch"; + this.owner.verticalAlignment = "stretch"; + } + return dialog; } @@ -154,8 +158,8 @@ function initializeDialogFragment() { const owner = this.owner; owner._setupAsRootView(this.getActivity()); owner._isAddedToNativeVisualTree = true; - - return this.owner.nativeViewProtected; + + return owner.nativeViewProtected; } public onStart(): void {