| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -81,6 +81,12 @@ export interface ShowModalOptions { | |||
| 81 | 81 | */ | |
| 82 | 82 | presentationStyle: any /* UIModalPresentationStyle */ | |
| 83 | 83 | } | |
| 84 | + android?: { | ||
| 85 | + /** | ||
| 86 | + * An optional parameter specifying whether the modal view can be dismissed when not in full-screen mode. | ||
| 87 | + */ | ||
| 88 | + cancelable?: boolean | ||
| 89 | + } | ||
| 84 | 90 | } | |
| 85 | 91 | ||
| 86 | 92 | export abstract class ViewBase extends Observable { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -37,6 +37,7 @@ interface DialogOptions { | |||
| 37 | 37 | owner: View; | |
| 38 | 38 | fullscreen: boolean; | |
| 39 | 39 | stretched: boolean; | |
| 40 | + cancelable: boolean; | ||
| 40 | 41 | shownCallback: () => void; | |
| 41 | 42 | dismissCallback: () => void; | |
| 42 | 43 | } | |
@@ -117,6 +118,7 @@ function initializeDialogFragment() { | |||
| 117 | 118 | public owner: View; | |
| 118 | 119 | private _fullscreen: boolean; | |
| 119 | 120 | private _stretched: boolean; | |
| 121 | + private _cancelable: boolean; | ||
| 120 | 122 | private _shownCallback: () => void; | |
| 121 | 123 | private _dismissCallback: () => void; | |
| 122 | 124 | ||
@@ -130,6 +132,7 @@ function initializeDialogFragment() { | |||
| 130 | 132 | const options = getModalOptions(ownerId); | |
| 131 | 133 | this.owner = options.owner; | |
| 132 | 134 | this._fullscreen = options.fullscreen; | |
| 135 | + this._cancelable = options.cancelable; | ||
| 133 | 136 | this._stretched = options.stretched; | |
| 134 | 137 | this._dismissCallback = options.dismissCallback; | |
| 135 | 138 | this._shownCallback = options.shownCallback; | |
@@ -155,6 +158,7 @@ function initializeDialogFragment() { | |||
| 155 | 158 | this.owner.verticalAlignment = "stretch"; | |
| 156 | 159 | } | |
| 157 | 160 | ||
| 161 | + dialog.setCanceledOnTouchOutside(this._cancelable); | ||
| 158 | 162 | return dialog; | |
| 159 | 163 | } | |
| 160 | 164 | ||
@@ -589,7 +593,7 @@ export class View extends ViewCommon { | |||
| 589 | 593 | ||
| 590 | 594 | return result | (childMeasuredState & layout.MEASURED_STATE_MASK); | |
| 591 | 595 | } | |
| 592 | - protected _showNativeModalView(parent: View, options: ShowModalOptions) { //context: any, closeCallback: Function, fullscreen?: boolean, animated?: boolean, stretched?: boolean, iosOpts?: any) { | ||
| 596 | + protected _showNativeModalView(parent: View, options: ShowModalOptions) { | ||
| 593 | 597 | super._showNativeModalView(parent, options); | |
| 594 | 598 | if (!this.backgroundColor) { | |
| 595 | 599 | this.backgroundColor = new Color("White"); | |
@@ -606,6 +610,7 @@ export class View extends ViewCommon { | |||
| 606 | 610 | owner: this, | |
| 607 | 611 | fullscreen: !!options.fullscreen, | |
| 608 | 612 | stretched: !!options.stretched, | |
| 613 | + cancelable: options.android ? !!options.android.cancelable : true, | ||
| 609 | 614 | shownCallback: () => this._raiseShownModallyEvent(), | |
| 610 | 615 | dismissCallback: () => this.closeModal() | |
| 611 | 616 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -370,7 +370,7 @@ export class View extends ViewCommon { | |||
| 370 | 370 | return this._suspendCATransaction || this._suspendNativeUpdatesCount; | |
| 371 | 371 | } | |
| 372 | 372 | ||
| 373 | - protected _showNativeModalView(parent: View, options: ShowModalOptions) { //context: any, closeCallback: Function, fullscreen?: boolean, animated?: boolean, stretched?: boolean, iosOpts?: any) { | ||
| 373 | + protected _showNativeModalView(parent: View, options: ShowModalOptions) { | ||
| 374 | 374 | const parentWithController = ios.getParentWithViewController(parent); | |
| 375 | 375 | if (!parentWithController) { | |
| 376 | 376 | traceWrite(`Could not find parent with viewController for ${parent} while showing modal view.`, | |
| Back | FazBrowse Home | New Git URL |
0 commit comments