diff --git a/packages/zone-js/dist/events.ts b/packages/zone-js/dist/events.ts index 5250e3e..824c5b6 100644 --- a/packages/zone-js/dist/events.ts +++ b/packages/zone-js/dist/events.ts @@ -47,4 +47,23 @@ Zone.__load_patch('nativescript_dispatchToMainThread', (global, zone, api) => { ); }); +Zone.__load_patch('nativescript_showModal', (global, zone, api) => { + api.patchMethod( + View.prototype, + 'showModal', + (delegate, delegateName, name) => + function (self, args) { + if (args.length === 2) { + const options = args[1]; + if (options.closeCallback) { + options.closeCallback = Zone.current.wrap(options.closeCallback, 'NS showModal patch'); + } + } else if (args.length > 3) { + args[3] = Zone.current.wrap(args[3], 'NS showModal patch'); + } + return delegate.apply(self, args); + } + ); +}); + //! 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.