diff --git a/tns-core-modules/ui/core/view/view.android.ts b/tns-core-modules/ui/core/view/view.android.ts index e73b613b3..eb8f5a457 100644 --- a/tns-core-modules/ui/core/view/view.android.ts +++ b/tns-core-modules/ui/core/view/view.android.ts @@ -44,6 +44,7 @@ let DialogFragment: DialogFragment; interface DialogOptions { owner: View; fullscreen: boolean; + animated: boolean; stretched: boolean; cancelable: boolean; shownCallback: () => void; @@ -137,6 +138,7 @@ function initializeDialogFragment() { class DialogFragmentImpl extends androidx.fragment.app.DialogFragment { public owner: View; private _fullscreen: boolean; + private _animated: boolean; private _stretched: boolean; private _cancelable: boolean; private _shownCallback: () => void; @@ -153,6 +155,7 @@ function initializeDialogFragment() { const options = getModalOptions(ownerId); this.owner = options.owner; this._fullscreen = options.fullscreen; + this._animated = options.animated; this._cancelable = options.cancelable; this._stretched = options.stretched; this._dismissCallback = options.dismissCallback; @@ -178,6 +181,16 @@ function initializeDialogFragment() { this.owner.verticalAlignment = "stretch"; } + // set the modal window animation + // https://github.com/NativeScript/NativeScript/issues/5989 + if (this._animated) { + dialog + .getWindow() + .setWindowAnimations( + android.R.style.Animation_Dialog + ); + } + dialog.setCanceledOnTouchOutside(this._cancelable); return dialog; @@ -629,6 +642,7 @@ export class View extends ViewCommon { const dialogOptions: DialogOptions = { owner: this, fullscreen: !!options.fullscreen, + animated: !!options.animated, stretched: !!options.stretched, cancelable: options.android ? !!options.android.cancelable : true, shownCallback: () => this._raiseShownModallyEvent(), @@ -1131,4 +1145,4 @@ createNativePercentLengthProperty({ createNativePercentLengthProperty({ setter: "_setMinHeightNative", get setPixels() { return org.nativescript.widgets.ViewHelper.setMinHeight; } -}); +}); \ No newline at end of file