Thanks to visit codestin.com
Credit goes to github.com

Skip to content

TypeError: Cannot read properties of null (reading 'unmount') crash on Android when going from background to foreground #1091

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
dangrima90 opened this issue Mar 6, 2025 · 3 comments · Fixed by #1092

Comments

@dangrima90
Copy link

I found this issue whilst investigating this NativeScript issue: NativeScript/NativeScript#8126.

The issue happens after a navigation with clearHistory: true occurs and then the user proceeds to exiting the application via the back button. I noticed that this issue seemed to only happen on Android 11 or lower, testing with Android 12 did not result in the issue.

Showcase:

418283966-822d88c6-bc85-4626-8e90-1bdc16af4b06.mov

Code of the above showcase can be found here: https://github.com/dangrima90/android-navigation-issue.

From my investigation the issue seems to be coming from here: https://github.com/nativescript-vue/nativescript-vue/blob/main/src/plugins/navigation.ts#L85-L88

Locally I managed to workaround the issue by changing the code linked above,

From:

if (!isReloading) {
  view.unmount();
  view = null;
}

To:

if (!isReloading && view) {
  view.unmount();
  view = null;
}

I could apply the fix myself, however I'm not fully aware of what this part of the code is doing so I'm hesitant to assume that just checking whether view has a value handles all use cases.

@vallemar
Copy link
Contributor

vallemar commented Mar 6, 2025

@dangrima90 I think this is related to this core PR

CC @CatchABus

@CatchABus
Copy link
Contributor

@dangrima90 I think this is related to this core PR

CC @CatchABus

Actually, we used the same app to reproduce those but they are two different bugs.
This one needs a small correction on Vue side!

@dangrima90
Copy link
Author

@dangrima90 I think this is related to this core PR

CC @CatchABus

Indeed it's two separate bugs. When I tested the sample application above with the draft fix in the linked PR I still replicate the Vue issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

3 participants