Skip to content

Conversation

@kligarski
Copy link
Contributor

@kligarski kligarski commented Aug 27, 2025

Description

This PR addresses changes to search bar on iOS 26.

Closes https://github.com/software-mansion/react-native-screens-labs/issues/339.

After merging, docs in react-navigation should also be updated, issue for this: https://github.com/software-mansion/react-native-screens-labs/issues/384.

Changes

  • add support for new search bar placements (integrated, integratedButton, integratedCentered),
  • add prop for controlling new search bar toolbar integration on iPhone (allowToolbarIntegration),
  • deprecate one of the placements (inline has been renamed to integrated starting from iOS 26) and cancelButtonText (search cancel button does not have any text on iOS 26),
  • reduce scope of workaround introduced in fix(iOS, Stack v4): fix missing search bar on root screen on iOS 26 #3098 (only to stacked placement)
  • disable recycling for SearchBar (workaround above does not solve all bugs with search bar on iOS 26).

Screenshots / GIFs

Simulator.Screen.Recording.-.iPhone.16.Pro.-.2025-08-28.at.12.17.00.mov

Note

If you use integrated, integratedButton or integratedCentered, the integration into toolbar is delayed and causes a flash (you can see it on the video). This bug happens also in bare UIKit app. The best workarounds I could find are:

  • use automatic with transparent header,
  • use automatic with hideWhenScrolling: true

Details: https://github.com/software-mansion/react-native-screens-labs/issues/331#issuecomment-3232909939

There is also another bug (also reproducible but due to how tabs+freeze work in screens, it's a little bit worse in our case). I think it's more of an edge case though (if you use tab with search systemItem but disable toolbar integration, the search bar is empty). Details: https://github.com/software-mansion/react-native-screens-labs/issues/331#issuecomment-3233232295

Test code and steps to reproduce

Run Test3168. You can also see other Search Bar related test screens like SearchBar.tsx, Test758, Test1097.

Checklist

@kligarski kligarski marked this pull request as ready for review August 28, 2025 12:28
@kligarski kligarski requested review from kkafar and kmichalikk August 28, 2025 12:28
Copy link
Collaborator

@kmichalikk kmichalikk left a comment

Choose a reason for hiding this comment

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

Looks good overall.
There are glitches with some combinations, but there are present in native apps, too.
I'm worried that we didn't check out enough combinations, though. We should also see what happens when we set different styling options for header.
When I disabled headerTransparent, it broke 'automatic' too:

automatic-header-transparent-false.mov

@kligarski
Copy link
Contributor Author

When I disabled headerTransparent, it broke 'automatic' too:

I managed to reproduce this as well in bare UIKit app. By default, UIKit uses hideWhenScrolling: true but we use hideWhenScrolling: false, that's why it was hard to reproduce. I described the details in PR description and corresponding issue.

@kligarski kligarski requested a review from kmichalikk August 29, 2025 11:14
Copy link
Member

@kkafar kkafar left a comment

Choose a reason for hiding this comment

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

Few adjustments request & we're good.

@kligarski kligarski force-pushed the @kligarski/search-bar-ios-26 branch from 1ad30f7 to 85e101a Compare September 2, 2025 14:06
@kligarski kligarski requested a review from kkafar September 2, 2025 14:20
Copy link
Member

@kkafar kkafar left a comment

Choose a reason for hiding this comment

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

Looking good, thank you!

@kkafar kkafar merged commit 21e40a2 into main Sep 2, 2025
9 checks passed
@kkafar kkafar deleted the @kligarski/search-bar-ios-26 branch September 2, 2025 15:27
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.

4 participants