René's URL Explorer Experiment


Title: fix(android): keep the root view when an activity replaces another by herefishyfish · Pull Request #11624 · NativeScript/NativeScript · GitHub

Open Graph Title: fix(android): keep the root view when an activity replaces another by herefishyfish · Pull Request #11624 · NativeScript/NativeScript

X Title: fix(android): keep the root view when an activity replaces another by herefishyfish · Pull Request #11624 · NativeScript/NativeScript

Description: PR Checklist The PR title follows our guidelines: https://github.com/NativeScript/NativeScript/blob/master/tools/notes/CONTRIBUTING.md#commit-messages. There is an issue for the bug/feature this PR is for. #11615 You have signed the CLA. All existing tests are passing: https://github.com/NativeScript/NativeScript/blob/master/tools/notes/DevelopmentWorkflow.md#unit-testing. (One CSS tokenizer spec fails on my Windows checkout. It failed the same way on a clean tree at an older base.) Tests for the changes are included - https://github.com/NativeScript/NativeScript/blob/master/tools/notes/WritingUnitTests.md. What is the current behavior? Android can start a new activity before the old one stops. When both activities use the same root view, the screen goes blank. Android logs this order: create:NEW start:NEW stop:OLD destroy:OLD The new activity adopts the root view, and the old activity then unloads it. If the old activity is finishing, it also destroys the view. The view also keeps the old activity's FragmentManager, so the frame does not create a fragment in the new activity. An app reaches this state when it reuses one root view, for example with Application.run({ create }) returning the same view. Reopening right after leaving with Back triggers it. So does a launch with the multi-task flag. Routing is not required. What is the new behavior? The change is 12 added lines in packages/core/ui/frame/index.android.ts: onStop, onDestroy, and onSaveInstanceState act only on a root view that the activity shows. A new activity unloads the root view from the previous activity before it adopts the view. This clears the cached FragmentManager. An activity takes the root view back when it starts again, so returning to an older activity works. Closes #11615. I reduced this PR after review. An earlier version also changed startActivity, the back press paths, and apps with no main entry. Those changes are not needed for #11615, so I removed them. Not covered Apps with no main entry still go blank on a quick reopen. exit has not fired, so launch does not fire, and nothing supplies a root view. #11631 tracks this. A reopen after exit needs #11573. A back press on a window with no root view crashes with a TypeError in onBackPressed. The same crash happens on main without this PR. With two visible activities and one root view, such as split screen, the activity that starts last gets the view. Taking the root view back fires initRootView and contentLoaded again for that view. Embedded mode is not tested. Verification Tested on an API 36 emulator with key presses and launch flags, on main at 07e84ec58. Reused root view, with the main.ts from #11615: Steps Without this PR With this PR Back with an immediate reopen Blank in 5 of 5 Page shown in 10 of 10 Second activity with -f 0x08000000 Blank in 5 of 5 Page shown Back from the second activity to the first Blank Page shown Second activity, night mode change, Back Not run Page shown Back, wait 5 seconds, reopen Page shown in 3 of 3 Page shown Clear-task launch Not run Page shown The stock toolbox app shows its page on all of these paths with this PR. An app with no main entry still shows the blank screens and the back press crash listed above. I reproduced the crash on main without this PR. Unit tests: 650 passed, 1 failed, 1 skipped. The failure is the CSS spec above. Five of the eight new specs fail without the fix. Not tested: real Angular, Vue, or Solid apps, a physical device, iOS, and TabView roots. The new specs use fake views, so they check the order of calls and not real fragment behavior. There is no apps/automated test.

Open Graph Description: PR Checklist The PR title follows our guidelines: https://github.com/NativeScript/NativeScript/blob/master/tools/notes/CONTRIBUTING.md#commit-messages. There is an issue for the bug/feature this...

X Description: PR Checklist The PR title follows our guidelines: https://github.com/NativeScript/NativeScript/blob/master/tools/notes/CONTRIBUTING.md#commit-messages. There is an issue for the bug/feature this...

Opengraph URL: https://github.com/NativeScript/NativeScript/pull/11624

X: @github

direct link

Domain: github.com

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:b6df54c4-98d1-acec-a1bc-a3569b6956a4
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idE10A:305B07:161BE66:1D2BB76:6B013040
html-safe-noncec3a80faff536f390c985e4b57835d2d8fa9e556739e9416e88a6ecd5eed3efb4
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFMTBBOjMwNUIwNzoxNjFCRTY2OjFEMkJCNzY6NkIwMTMwNDAiLCJ2aXNpdG9yX2lkIjoiNzI2NjMzNDYzNjQ4ODMzOTUyMCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmacb8c9a2ecc03412a1ad4adef0e868bdd44795cbe50eac777674900a01dd3fc2a7
hovercard-subject-tagpull_request:5211292396
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/NativeScript/NativeScript/pull/11624/files
twitter:imagehttps://avatars.githubusercontent.com/u/46717769?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/46717769?s=400&v=4
og:image:altPR Checklist The PR title follows our guidelines: https://github.com/NativeScript/NativeScript/blob/master/tools/notes/CONTRIBUTING.md#commit-messages. There is an issue for the bug/feature this...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
Nonecc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/NativeScript/NativeScript git https://github.com/NativeScript/NativeScript.git
octolytics-dimension-user_id7392261
octolytics-dimension-user_loginNativeScript
octolytics-dimension-repository_id31492490
octolytics-dimension-repository_nwoNativeScript/NativeScript
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id31492490
octolytics-dimension-repository_network_root_nwoNativeScript/NativeScript
turbo-body-classeslogged-out env-production page-responsive full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release8c77c9e8439031ad54c75a250694842892f693e1
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/NativeScript/NativeScript/pull/11624/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FNativeScript%2FNativeScript%2Fpull%2F11624%2Ffiles
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FNativeScript%2FNativeScript%2Fpull%2F11624%2Ffiles
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=NativeScript%2FNativeScript
Reloadhttps://github.com/NativeScript/NativeScript/pull/11624/files
Reloadhttps://github.com/NativeScript/NativeScript/pull/11624/files
Reloadhttps://github.com/NativeScript/NativeScript/pull/11624/files
NativeScripthttps://github.com/NativeScript
NativeScripthttps://github.com/NativeScript/NativeScript
Codehttps://github.com/NativeScript/NativeScript
Issues231 (231)https://github.com/NativeScript/NativeScript/issues
Pull requests107 (107)https://github.com/NativeScript/NativeScript/pulls
Discussionshttps://github.com/NativeScript/NativeScript/discussions
Actionshttps://github.com/NativeScript/NativeScript/actions
Projectshttps://github.com/NativeScript/NativeScript/projects
Wikihttps://github.com/NativeScript/NativeScript/wiki
Security and qualityhttps://github.com/NativeScript/NativeScript/security
Insightshttps://github.com/NativeScript/NativeScript/insights
Sign up for GitHub https://github.com/signup?return_to=%2FNativeScript%2FNativeScript%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2FNativeScript%2FNativeScript%2Fissues%2Fnew%2Fchoose
herefishyfishhttps://github.com/herefishyfish
NativeScript:mainhttps://github.com/NativeScript/NativeScript/tree/main
herefishyfish:fix/android-blank-screen-on-reopenhttps://github.com/herefishyfish/NativeScript/tree/fix/android-blank-screen-on-reopen
Conversation 4 https://github.com/NativeScript/NativeScript/pull/11624
Commits 2 https://github.com/NativeScript/NativeScript/pull/11624/commits
Checks 6 https://github.com/NativeScript/NativeScript/pull/11624/checks
Files changed 2 https://github.com/NativeScript/NativeScript/pull/11624/files
fix(android): keep the root view when an activity replaces another https://github.com/NativeScript/NativeScript/pull/11624/files#top
Show all changes 2 commits https://github.com/NativeScript/NativeScript/pull/11624/files
e1ea59b test(core): cover a root view shared between Android activities herefishyfish Nov 10, 2026 https://github.com/NativeScript/NativeScript/pull/11624/commits/e1ea59b692b34ecf7b906cc724afd0dffa40d637
129b25a fix(android): keep the root view when an activity replaces another herefishyfish Nov 10, 2026 https://github.com/NativeScript/NativeScript/pull/11624/commits/129b25ac4fefa2e831417ff36af74aefba2cc239
Clear filters https://github.com/NativeScript/NativeScript/pull/11624/files
Please reload this pagehttps://github.com/NativeScript/NativeScript/pull/11624/files
Please reload this pagehttps://github.com/NativeScript/NativeScript/pull/11624/files
activity-callbacks.android.spec.ts https://github.com/NativeScript/NativeScript/pull/11624/files#diff-93edefa3bf18e29a07837d6e677605266d56498e4df437898ad02eb327bac2c1
index.android.ts https://github.com/NativeScript/NativeScript/pull/11624/files#diff-aac2c6e11b65a628114bb7df638ed7e629e2cbe6d160c2172f37b2a7a9ef3e69
packages/core/ui/frame/activity-callbacks.android.spec.tshttps://github.com/NativeScript/NativeScript/pull/11624/files#diff-93edefa3bf18e29a07837d6e677605266d56498e4df437898ad02eb327bac2c1
View file https://github.com/NativeScript/NativeScript/blob/129b25ac4fefa2e831417ff36af74aefba2cc239/packages/core/ui/frame/activity-callbacks.android.spec.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/NativeScript/NativeScript/pull/11624/{{ revealButtonHref }}
packages/core/ui/frame/index.android.tshttps://github.com/NativeScript/NativeScript/pull/11624/files#diff-aac2c6e11b65a628114bb7df638ed7e629e2cbe6d160c2172f37b2a7a9ef3e69
View file https://github.com/NativeScript/NativeScript/blob/129b25ac4fefa2e831417ff36af74aefba2cc239/packages/core/ui/frame/index.android.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/NativeScript/NativeScript/pull/11624/{{ revealButtonHref }}
https://github.com/NativeScript/NativeScript/pull/11624/files#diff-aac2c6e11b65a628114bb7df638ed7e629e2cbe6d160c2172f37b2a7a9ef3e69
https://github.com/NativeScript/NativeScript/pull/11624/files#diff-aac2c6e11b65a628114bb7df638ed7e629e2cbe6d160c2172f37b2a7a9ef3e69
https://github.com/NativeScript/NativeScript/pull/11624/files#diff-aac2c6e11b65a628114bb7df638ed7e629e2cbe6d160c2172f37b2a7a9ef3e69
https://github.com/NativeScript/NativeScript/pull/11624/files#diff-aac2c6e11b65a628114bb7df638ed7e629e2cbe6d160c2172f37b2a7a9ef3e69
https://github.com/NativeScript/NativeScript/pull/11624/files#diff-aac2c6e11b65a628114bb7df638ed7e629e2cbe6d160c2172f37b2a7a9ef3e69
https://github.com/NativeScript/NativeScript/pull/11624/files#diff-aac2c6e11b65a628114bb7df638ed7e629e2cbe6d160c2172f37b2a7a9ef3e69
https://github.com/NativeScript/NativeScript/pull/11624/files#diff-aac2c6e11b65a628114bb7df638ed7e629e2cbe6d160c2172f37b2a7a9ef3e69
https://github.com/NativeScript/NativeScript/pull/11624/files#diff-aac2c6e11b65a628114bb7df638ed7e629e2cbe6d160c2172f37b2a7a9ef3e69
https://github.com/NativeScript/NativeScript/pull/11624/files#diff-aac2c6e11b65a628114bb7df638ed7e629e2cbe6d160c2172f37b2a7a9ef3e69
https://github.com/NativeScript/NativeScript/pull/11624/files#diff-aac2c6e11b65a628114bb7df638ed7e629e2cbe6d160c2172f37b2a7a9ef3e69
https://github.com/NativeScript/NativeScript/pull/11624/files#diff-aac2c6e11b65a628114bb7df638ed7e629e2cbe6d160c2172f37b2a7a9ef3e69
Please reload this pagehttps://github.com/NativeScript/NativeScript/pull/11624/files
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.