Skip to content

fix(application): rootView undefined on resume #10345

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

Merged
merged 1 commit into from
Jul 18, 2023

Conversation

jcassidyav
Copy link
Contributor

PR Checklist

What is the current behavior?

The commit ab5fa94 seems to have broken the resume of the app in some situations, e.g. when switching back from nativescript-inappbrowser. As illustrated by this repo.

On closing the browser you get a crash on android with the stack:

  TNS.Native: setRootViewCSSClasses(file: app/webpack:/testpopcrash/node_modules/@nativescript/core/application/application-common.js:151:0)
  TNS.Native:   at initRootView(file: app/webpack:/testpopcrash/node_modules/@nativescript/core/application/application-common.js:221:0)
  TNS.Native:   at setActivityContent(file: app/webpack:/testpopcrash/node_modules/@nativescript/core/ui/frame/index.android.js:1190:19)
  TNS.Native:   at onCreate(file: app/webpack:/testpopcrash/node_modules/@nativescript/core/ui/frame/index.android.js:1003:0)
  TNS.Native:   at onCreate(file: app/webpack:/testpopcrash/node_modules/@nativescript/core/ui/frame/activity.android.js:21:0)

The reason is that the application.foregroundActivity is undefined, and the startActivity is a chromeManagerActivity, and the code then fails to resolve the rootView.

What is the new behavior?

This change modifies initRootView to accept a root view, since all calling code seems to already have the rootView and can pass it in.

@jcassidyav jcassidyav requested a review from rigor789 July 18, 2023 15:06
@cla-bot cla-bot bot added the cla: yes label Jul 18, 2023
@rigor789 rigor789 merged commit bd8e1b8 into NativeScript:main Jul 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants