Skip to content

fix(android): Corrected TabView fragment manager resolution#11217

Merged
NathanWalker merged 1 commit into
NativeScript:mainfrom
CatchABus:fix/android-tab-view-blank
May 17, 2026
Merged

fix(android): Corrected TabView fragment manager resolution#11217
NathanWalker merged 1 commit into
NativeScript:mainfrom
CatchABus:fix/android-tab-view-blank

Conversation

@CatchABus
Copy link
Copy Markdown
Contributor

@CatchABus CatchABus commented May 17, 2026

PR Checklist

What is the current behavior?

Right now, there's an issue that causes android TabView tabs to become blank if users switches tabs quickly.
This triggers a chain of events:

  • User switches tabs fast
  • ViewPager chooses to cache the tabs skipping instantiateItem/destroyItem call steps
  • The TabViewItem _getChildFragmentManager overridden method returns the wrong fragment manager because the previous fragment wasn't detached from fragment manager during tab navigation
  • Frame workarounds are triggered during tab load/unload lifecycle but resolve to the wrong FragmentManager.

What is the new behavior?

This PR will remove the faulty child fragment resolution code since it has no merits but causes problems instead.
Partially reverts #6293 which seems to be the culprit.

Fixes #10165.

Note: We can consider a huge refactor for TabView in the future and see if it's possible to use ViewPager2 or FragmentStatePagerAdapter

@nx-cloud
Copy link
Copy Markdown

nx-cloud Bot commented May 17, 2026

View your CI Pipeline Execution ↗ for commit 5b9d9ee

Command Status Duration Result
nx test apps-automated -c=android ✅ Succeeded 3m 40s View ↗
nx run-many --target=test --configuration=ci --... ✅ Succeeded 3s View ↗

☁️ Nx Cloud last updated this comment at 2026-05-17 17:48:55 UTC

@NathanWalker
Copy link
Copy Markdown
Contributor

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 17, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 17, 2026

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: d0d36dd0-45d6-4796-8c7a-c1eda69b6b8d

📥 Commits

Reviewing files that changed from the base of the PR and between 0c8229c and 5b9d9ee.

📒 Files selected for processing (1)
  • packages/core/ui/tab-view/index.android.ts

Walkthrough

Android TabView fragment manager resolution is simplified: TabViewItem._getChildFragmentManager() now directly returns the parent TabView's root fragment manager instead of scanning child fragments by index. This removes previous fallback logic and fragment lookup overhead.

Changes

TabView Fragment Manager Resolution

Layer / File(s) Summary
Fragment manager simplification
packages/core/ui/tab-view/index.android.ts
TabViewItem._getChildFragmentManager eliminates child fragment lookup logic and directly returns (<any>tabView)._getRootFragmentManager(), removing the prior index-based fragment search and conditional fallback path.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested reviewers

  • NathanWalker

Poem

🐰 A fragment's path grew long and winding,
Through indexed lookups, always finding—
But now we leap straight to the root,
Swift as a rabbit's hopeful boot! 🌱

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: fixing TabView fragment manager resolution on Android.
Description check ✅ Passed The description is related to the changeset, providing context about the bug, the fix, and the rationale for the change.
Linked Issues check ✅ Passed The PR directly addresses issue #10165 by removing the faulty fragment resolution code that caused TabView tabs to become blank during rapid tab switching.
Out of Scope Changes check ✅ Passed All changes are focused on fixing the TabViewItem._getChildFragmentManager method in the Android-specific file, directly addressing the linked issue.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@NathanWalker NathanWalker merged commit fe51a14 into NativeScript:main May 17, 2026
4 checks passed
CatchABus added a commit that referenced this pull request May 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Android][NS 8.3] Incorrect TabView behaviour

2 participants