From 48b4ad4c4d5aa2feef905899d3f78c733dc64ddc Mon Sep 17 00:00:00 2001 From: Drew Bartlett Date: Tue, 24 Mar 2020 11:02:06 -0500 Subject: [PATCH 1/2] fix: add minor fix to allow target being passed to --- platform/nativescript/plugins/modal-plugin.js | 18 ++-- samples/app/modals-on-top-of-modals.js | 86 +++++++++++++++++++ 2 files changed, 98 insertions(+), 6 deletions(-) create mode 100644 samples/app/modals-on-top-of-modals.js diff --git a/platform/nativescript/plugins/modal-plugin.js b/platform/nativescript/plugins/modal-plugin.js index b3ad00da..ae15052f 100644 --- a/platform/nativescript/plugins/modal-plugin.js +++ b/platform/nativescript/plugins/modal-plugin.js @@ -65,14 +65,20 @@ export default { } // build options object with defaults - options = Object.assign({}, options, { - context: null, - closeCallback: closeCb - }) + options = Object.assign( + { + target: this.$root + }, + options, + { + context: null, + closeCallback: closeCb + } + ) const navEntryInstance = new Vue({ name: 'ModalEntry', - parent: this.$root, + parent: options.target, methods: { closeCb }, @@ -85,7 +91,7 @@ export default { const modalPage = navEntryInstance.$mount().$el.nativeView updateDevtools() - this.$root.nativeView.showModal(modalPage, options) + options.target.nativeView.showModal(modalPage, options) }) } } diff --git a/samples/app/modals-on-top-of-modals.js b/samples/app/modals-on-top-of-modals.js new file mode 100644 index 00000000..ec513057 --- /dev/null +++ b/samples/app/modals-on-top-of-modals.js @@ -0,0 +1,86 @@ +const Vue = require('nativescript-vue') +// const VueDevtools = require('nativescript-vue-devtools') + +// Vue.use(VueDevtools) + +Vue.config.debug = true +Vue.config.silent = false + +const SecondaryModal = { + name: 'SecondaryModalComponent', + template: ` + + + + +