-
Notifications
You must be signed in to change notification settings - Fork 83
feat: enhance bottom tabs with search functionality #493
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds search functionality to the native bottom tabs component for iOS 18+. It introduces searchable tab capabilities with customizable navigation bar toolbar visibility and provides callbacks for search text and focus changes. The implementation uses SwiftUI's .searchable() modifier wrapped in a NavigationView to integrate search functionality with React Native views.
Key Changes:
- Added
searchableandnavigationBarToolbarStyleproperties to tab route options - Implemented
onSearchTextChangeandonSearchFocusChangecallbacks for search interactions - Created
RepresentableViewControllerwrapper to bridge UIViewController with SwiftUI's NavigationView
Reviewed changes
Copilot reviewed 14 out of 15 changed files in this pull request and generated 17 comments.
Show a summary per file
| File | Description |
|---|---|
packages/react-navigation/src/views/NativeBottomTabView.tsx |
Added getters for searchable and navigationBarToolbarStyle options from route descriptors |
packages/react-navigation/src/types.ts |
Extended NativeBottomTabNavigationOptions with searchable and navigationBarToolbarStyle properties |
packages/react-navigation/src/navigators/createNativeBottomTabNavigator.tsx |
Passed through search callbacks to NativeBottomTabView |
packages/react-native-bottom-tabs/src/types.ts |
Added searchable and navigationBarToolbarStyle to BaseRoute type |
packages/react-native-bottom-tabs/src/TabViewNativeComponent.ts |
Defined native event types and props for search functionality |
packages/react-native-bottom-tabs/src/TabView.tsx |
Implemented search callbacks and added getters for searchable properties |
packages/react-native-bottom-tabs/ios/TabViewProvider.swift |
Extended TabInfo with searchable properties and added delegate methods for search events |
packages/react-native-bottom-tabs/ios/TabViewProps.swift |
Added ToolbarStyle enum with iOS 18+ Visibility conversion |
packages/react-native-bottom-tabs/ios/TabViewImpl.swift |
Wired up search callbacks to native implementation |
packages/react-native-bottom-tabs/ios/TabView/NewTabView.swift |
Implemented searchable tabs with NavigationView wrapper and search modifiers |
packages/react-native-bottom-tabs/ios/RepresentableViewController.swift |
Created UIViewController wrapper for SwiftUI integration (new file) |
packages/react-native-bottom-tabs/ios/RCTTabViewComponentView.mm |
Added native event emitters for search text and focus changes |
apps/example/src/Examples/NativeBottomTabsEmbeddedStacks.tsx |
Added example usage with searchable Contacts tab |
apps/example/src/Examples/FourTabs.tsx |
Added example usage with searchable Contacts tab |
apps/example/ios/Podfile.lock |
Updated package version from 1.0.5 to 1.1.0 |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Copilot
AI
Dec 23, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment states "Have to wrap in NavigationView to use searchable" but doesn't explain why wrapping in UIViewController is required. The comment on line 38 mentions it will crash but doesn't provide context about what causes the crash or under what conditions.
Copilot
AI
Dec 23, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Duplicate comment line with inconsistent formatting. The comment "// MARK: TabViewProviderDelegate" has extra spaces before "MARK:" compared to standard Swift conventions which typically use "// MARK:" with a single space.
packages/react-native-bottom-tabs/src/TabViewNativeComponent.ts
Outdated
Show resolved
Hide resolved
packages/react-native-bottom-tabs/ios/RepresentableViewController.swift
Outdated
Show resolved
Hide resolved
Copilot
AI
Dec 23, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing implementation for macOS. The struct declares itself as UIViewControllerRepresentable which doesn't exist on macOS (should be NSViewControllerRepresentable). The macOS section implements view-related methods but the struct protocol is for view controllers.
Copilot
AI
Dec 23, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing space after colon in variable declaration. Should be onSearchTextChange : RCTDirectEventBlock? have consistent spacing as onSearchTextChange: RCTDirectEventBlock? to match the style of other properties in this file.
Copilot
AI
Dec 23, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing space after colon in variable declaration. Should be onSearchFocusChange : RCTDirectEventBlock? have consistent spacing as onSearchFocusChange: RCTDirectEventBlock? to match the style of other properties in this file.
searchableboolean property to route optionsnavigationBarToolbarStyleproperty to control navigation bar toolbar visibility ('automatic' | 'hidden' | 'visible')onSearchTextChangecallback that fires when search text changesonSearchFocusChangecallback that fires when search field gains/loses focusRepresentableViewControllerwrapper to properly integrate UIViewController with SwiftUI NavigationView (required for searchable functionality)NavigationViewand apply.searchable()modifierTabViewusage and React Navigation integrationHow to test?
Using TabView directly:
Using React Navigation:
Screenshots
For iOS 26 and higher
截圖 2025年12月14日 下午4 03 27
For iOS 18
截圖 2025年12月14日 下午4 04 53