Why does my Nativescript-vue app crash when using the hardware back button before a modal is rendered?

I have an app built in Nativescript-Vue where detail pages are shown in modals.

I use the method $showModal() to open a modal, but when I press the hardware back button on an Android device before the modal is rendered, the app crashes and it's giving me the following error.

If I wait a second, it works just fine.

TypeError: Cannot read property 'nativeView' of undefined

Should I override the back functionality to wait before the modal is fully rendered?

Read more here: https://stackoverflow.com/questions/62790035/why-does-my-nativescript-vue-app-crash-when-using-the-hardware-back-button-befor

Content Attribution

This content was originally published by Hans at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: