Skip to content

Commit f3bd2e9

Browse files
bradmartinSvetoslavTsenov
authored andcommitted
closes #5989 (#7686)
1 parent b6ff4d3 commit f3bd2e9

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

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

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ let DialogFragment: DialogFragment;
4444
interface DialogOptions {
4545
owner: View;
4646
fullscreen: boolean;
47+
animated: boolean;
4748
stretched: boolean;
4849
cancelable: boolean;
4950
shownCallback: () => void;
@@ -137,6 +138,7 @@ function initializeDialogFragment() {
137138
class DialogFragmentImpl extends androidx.fragment.app.DialogFragment {
138139
public owner: View;
139140
private _fullscreen: boolean;
141+
private _animated: boolean;
140142
private _stretched: boolean;
141143
private _cancelable: boolean;
142144
private _shownCallback: () => void;
@@ -153,6 +155,7 @@ function initializeDialogFragment() {
153155
const options = getModalOptions(ownerId);
154156
this.owner = options.owner;
155157
this._fullscreen = options.fullscreen;
158+
this._animated = options.animated;
156159
this._cancelable = options.cancelable;
157160
this._stretched = options.stretched;
158161
this._dismissCallback = options.dismissCallback;
@@ -178,6 +181,16 @@ function initializeDialogFragment() {
178181
this.owner.verticalAlignment = "stretch";
179182
}
180183

184+
// set the modal window animation
185+
// https://github.com/NativeScript/NativeScript/issues/5989
186+
if (this._animated) {
187+
dialog
188+
.getWindow()
189+
.setWindowAnimations(
190+
android.R.style.Animation_Dialog
191+
);
192+
}
193+
181194
dialog.setCanceledOnTouchOutside(this._cancelable);
182195

183196
return dialog;
@@ -629,6 +642,7 @@ export class View extends ViewCommon {
629642
const dialogOptions: DialogOptions = {
630643
owner: this,
631644
fullscreen: !!options.fullscreen,
645+
animated: !!options.animated,
632646
stretched: !!options.stretched,
633647
cancelable: options.android ? !!options.android.cancelable : true,
634648
shownCallback: () => this._raiseShownModallyEvent(),
@@ -1131,4 +1145,4 @@ createNativePercentLengthProperty({
11311145
createNativePercentLengthProperty({
11321146
setter: "_setMinHeightNative",
11331147
get setPixels() { return org.nativescript.widgets.ViewHelper.setMinHeight; }
1134-
});
1148+
});

0 commit comments

Comments
 (0)