1
我是NativeScript的新手,但希望能夠阻止我從用戶點擊背景(特別是Android設備)時關閉而創建的自定義模式。Nativescript角度防止模式關閉背景水龍頭
當使用NativeScript提供的對話框時,我可以很容易地實現這一點,即對於操作對話框,只需在提供的選項中將cancelable
設置爲false即可。
let options: ActionOptions = {
title: "Sticky Dialog",
message: "Will not disappear if background tapped",
cancelable: false,
actions: ["Cancel", "OK"]
};
dialogs.action(options).then(result => {
console.log(result);
});
但顯示我的自定義模式使用ModalDialogService
有可以在選項中設置沒有這樣的屬性時,目前我有
let modalOptions: ModalDialogOptions = {
context: {},
fullscreen: false,
viewContainerRef: this.vcRef,
};
this.modalService.showModal(DeviceRegistrationComponent, modalOptions)
.then(result => {
if (result != null) {
this.handleDeviceOtpEntry(result.otp);
}
});
有沒有辦法做到這一點?我不介意設置特定的原生android屬性,但似乎無法獲取顯示的實際模態的句柄。