Skip to content

Commit 7b8389e

Browse files
authored
fix: patch showModal call in zone (#83)
1 parent 1be9c3a commit 7b8389e

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

packages/zone-js/dist/events.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,23 @@ Zone.__load_patch('nativescript_dispatchToMainThread', (global, zone, api) => {
4747
);
4848
});
4949

50+
Zone.__load_patch('nativescript_showModal', (global, zone, api) => {
51+
api.patchMethod(
52+
View.prototype,
53+
'showModal',
54+
(delegate, delegateName, name) =>
55+
function (self, args) {
56+
if (args.length === 2) {
57+
const options = args[1];
58+
if (options.closeCallback) {
59+
options.closeCallback = Zone.current.wrap(options.closeCallback, 'NS showModal patch');
60+
}
61+
} else if (args.length > 3) {
62+
args[3] = Zone.current.wrap(args[3], 'NS showModal patch');
63+
}
64+
return delegate.apply(self, args);
65+
}
66+
);
67+
});
68+
5069
//! queueMacroTask should never be patched! We should consider it as a low level API to queue macroTasks which will be patched separately by other patches.

0 commit comments

Comments
 (0)