Skip to content

feat(iOS, Tabs): Use UISearchTab with automaticallyActivatesSearch prop - #4679

Draft
kmichalikk wants to merge 3 commits into
@kmichalikk/tabs-new-uikit-apifrom
@kmichalikk/uitab-support-uisearchtab
Draft

kmichalikk wants to merge 3 commits into
@kmichalikk/tabs-new-uikit-apifrom
@kmichalikk/uitab-support-uisearchtab

Conversation

@kmichalikk

@kmichalikk kmichalikk commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

Closes #4671

Description

This PR adds searchRole prop that marks the tab to be backed by UISearchTab and automaticallyActivatesSearch prop, enabling the separated search tab behavior on iOS 27 (on iOS 26 the similar feel could be achieved with systemItem set to "search", and this system keeps supporting both).

UIKit activates the UISearchController attached to the tab view controller's navigationItem, so the tab screen mirrors the search configuration (searchController, hidesSearchBarWhenScrolling, preferredSearchBarPlacement) from the stack nested inside the tab. A new RNSSearchControllerProviding protocol exposes the source UINavigationItem and should be implemented by both v4 and v5 stacks (the latter lacks the search for now, requires a followup in the future). The mirroring is done on every mounting transaction (updateSearchTabsIfNeeded) and just before UIKit may auto-activate search (shouldSelectTab:), so it follows the top screen of the nested stack across push/pop.

Important

A live tab is never rebuilt (UIKit asserts when a view controller is resolved by a second UITab instance and crashes the application), so the tab searchRole is fixed at creation and changing it on a live screen is unsupported.

It is technically possible to have more than 1 UISearchTab but this results in weird behavior observed on native, wrong icons used, separation for only one of the tabs, and glitches on automatic activation

Changes

  • RNSTabBarController now builds UITab / UISearchTab depending on the value of searchRole and mirrors the search controller on the stack inside the tab
  • new RNSSearchControllerProviding protocol
  • new automaticallyActivatesSearch prop that makes the search tab separated and automatically activateing the search input.
  • Added SFT test-tabs-search-tab-activation-ios

Before & after - visual documentation

Test plan

Use test-tabs-search-tab-activation-ios and test-tabs-system-item-ios - to verify no regression on iOS 26.

Checklist

  • Included code example that can be used to test this change.
  • For visual changes, included screenshots / GIFs / recordings documenting the change.
  • For API changes, updated relevant public types.
  • Ensured that CI passes

@kmichalikk
kmichalikk added this pull request to stack #4680 September 18, 2026 15:07
@kmichalikk
kmichalikk marked this pull request as draft September 18, 2026 15:07
@coderabbitai

coderabbitai Bot commented Sep 18, 2026 •

Copy link
Copy Markdown

Review Change StackReview Change Stack

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: cf0c5878-219f-46a5-b7bd-8f619b775225

📥 Commits

Reviewing files that changed from the base of the PR and between 3da6e47 and afc8c27.

📒 Files selected for processing (16)
  • apps/App.tsx
  • apps/src/tests/single-feature-tests/tabs/index.ts
  • apps/src/tests/single-feature-tests/tabs/test-tabs-search-tab-activation-ios/index.tsx
  • apps/src/tests/single-feature-tests/tabs/test-tabs-search-tab-activation-ios/scenario-description.ts
  • apps/src/tests/single-feature-tests/tabs/test-tabs-search-tab-activation-ios/scenario.md
  • apps/src/tests/single-feature-tests/tabs/test-tabs-system-item-ios/index.tsx
  • apps/src/tests/single-feature-tests/tabs/test-tabs-system-item-ios/scenario.md
  • ios/tabs/RNSTabBarItemsCoordinator.mm
  • ios/tabs/host/RNSTabBarController.mm
  • ios/tabs/screen/RNSTabsScreenComponentView.h
  • ios/tabs/screen/RNSTabsScreenComponentView.mm
  • ios/tabs/screen/RNSTabsScreenViewController.h
  • ios/tabs/screen/RNSTabsScreenViewController.mm
  • src/components/tabs/screen/TabsScreen.ios.tsx
  • src/components/tabs/screen/TabsScreen.ios.types.ts
  • src/fabric/tabs/TabsScreenIOSNativeComponent.ts

Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review.


📝 Walkthrough

Walkthrough

The change adds iOS UISearchTab support, exposes automaticallyActivatesSearch, synchronizes nested search controllers, and adds scenarios covering iOS 26 and later search-tab behavior.

Changes

Search tab support

Layer / File(s) Summary
Public search activation configuration
src/components/tabs/screen/*, src/fabric/tabs/TabsScreenIOSNativeComponent.ts, ios/tabs/screen/RNSTabsScreenComponentView.*
Adds the automaticallyActivatesSearch prop, forwards it to native code, stores it, and documents its iOS 26+ behavior.
UISearchTab creation and synchronization
ios/tabs/host/RNSTabBarController.mm, ios/tabs/RNSTabBarItemsCoordinator.mm, ios/tabs/screen/RNSTabsScreenViewController.*
Creates UISearchTab for search system items, prevents mounted role changes, mirrors nested search-controller settings, and synchronizes automatic activation before selection.
Scenario coverage and registration
apps/App.tsx, apps/src/tests/single-feature-tests/tabs/*
Registers a new iOS search activation scenario and updates system-item coverage for static search-tab behavior across iOS versions.

Priority: ➖ Normal

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Feature · Severity of issue fixed: Medium

Sequence Diagram(s)

sequenceDiagram
  participant TabsScreen
  participant RNSTabsScreenComponentView
  participant RNSTabBarController
  participant RNSTabsScreenViewController
  participant UISearchTab
  TabsScreen->>RNSTabsScreenComponentView: pass automaticallyActivatesSearch
  RNSTabBarController->>UISearchTab: create search tab
  RNSTabBarController->>RNSTabsScreenViewController: mirror nested search controller
  RNSTabsScreenViewController->>UISearchTab: provide synchronized search configuration
Loading

Suggested reviewers: kkafar

Merge Risk: ⚪ Minimal · up to afc8c

The implementation and documentation use the correct platform ranges, with no concrete merge-blocking issue identified.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 9 functions across 10 files. (6 skipped: 6… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The PR implements the coding requirements in #4671. RNSTabBarController.mm creates a UISearchTab for the search system item on iOS 26 and later. RNSTabBarItemsCoordinator.mm synchronizes `auto…
Out of Scope Changes check ✅ Passed The changed files stay within the scope of #4671. The new test scenario, its scenario description, and the updates to the system-item scenario validate the search-tab appearance and activation behavio…
Title check ✅ Passed The title clearly summarizes the main changes: using UISearchTab for iOS tabs and adding the automaticallyActivatesSearch prop.
Description check ✅ Passed The description is related to the changeset. It describes UISearchTab integration, automatic search activation, search-controller mirroring, and the added test scenario.
Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 9 functions across 10 files. (6 skipped: 6 unsupported.)

✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR

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.

Comment on lines 274 to 285
* On iOS 18+, a tab screen with `systemItem: 'search'` is backed natively by `UISearchTab`
* (other values use a plain `UITab`), and the native tab class cannot change during the
* screen's lifetime. Changing `systemItem` to or from `'search'` on a mounted tab screen is
* therefore not supported - it triggers an assertion in development builds. To change the
* search role at runtime, remount the tab screen (e.g. by changing its React `key`).
* Changes between the other system item values are applied dynamically.
*
* @see {@link https://developer.apple.com/documentation/uikit/uitabbaritem/systemitem|UITabBarItem.SystemItem}
*
* @platform ios
*/
systemItem?: TabsScreenSystemItem | undefined;

@satya164 satya164 Sep 19, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

correct me if i'm wrong, but aren't we overloading systemItem meaning? as i understand, UITabBarItem.SystemItem is for choosing the built-in localized icon and label for a tab based on predefined sets. so changing the class to something else doesn't fit with native UIKit semantics.

imo we should have a separate prop to explicitly choose to use UISearchTab, or role: "search" to match SwiftUI behavior with an explicit prop.

it'd also be nice to expose the new prominentTabIdentifier which is exposed in SwiftUI as role: "prominent"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In 26, this specific role made the item go to the side, so I thought this would make sense to keep + the linked issue leans towards it, but I'm open to sth else once I get the core to work

prominent is blocked by the UITab API rework, but should be done shortly after that, the API for that will probably be different than role=prominent, but that for another discussion

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In 26, this specific role made the item go to the side

yes, but this is iOS behavior, so UIKit apps would also need changes. previously there have been arguments towards exposing native behavior directly in screens and let the integration layer handle platform and version differences, so using a UIKit property name to expose custom behavior in screens itself would be non-characteristic imo.

we expose this prop as tabBarSystemItem in React Navigation, so I'd prefer to avoid confusion of using a UIKit API for the name while having different behavior.

a separate prop like role: 'search' | 'prominent' to mirror the similar SwiftUI API, or some other explicit prop would be better.

cc @kkafar

@kmichalikk
kmichalikk force-pushed the @kmichalikk/tabs-new-uikit-api branch from 3da6e47 to 1a8803e Compare September 21, 2026 11:21
@kmichalikk
kmichalikk force-pushed the @kmichalikk/uitab-support-uisearchtab branch from afc8c27 to 0404bce Compare September 21, 2026 11:26
@kmichalikk
kmichalikk force-pushed the @kmichalikk/tabs-new-uikit-api branch 4 times, most recently from 66f0a23 to a7eac47 Compare September 23, 2026 12:19
@kmichalikk
kmichalikk removed this pull request from stack #4680 September 23, 2026 12:38
@kmichalikk
kmichalikk force-pushed the @kmichalikk/uitab-support-uisearchtab branch from 0404bce to 2b33cec Compare September 23, 2026 12:39
@kmichalikk
kmichalikk added this pull request to stack #4713 September 23, 2026 12:39
@kmichalikk
kmichalikk removed this pull request from stack #4713 September 23, 2026 14:41
@kmichalikk
kmichalikk force-pushed the @kmichalikk/uitab-support-uisearchtab branch 2 times, most recently from ec026ec to aaeea05 Compare September 23, 2026 15:38
@@ -0,0 +1,80 @@
# Test Scenario: Search Tab Activation (iOS)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be an integration test instead?

@kmichalikk
kmichalikk force-pushed the @kmichalikk/uitab-support-uisearchtab branch from b2008ac to 91328d6 Compare September 25, 2026 11:04

This branch has not been deployed

No deployments
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.

[iOS 27 SDK] role="search" loses the detached search-tab chrome; the legacy UITabBarSystemItemSearch dress-up only happens under the iOS 26 SDK

2 participants