Skip to content

Commit 5d02fdd

Browse files
fix(ios): only synthesize the search cancel on iOS 27, release 5.0.0-t3.49
iOS 26 already reports the integrated close button as a cancel, and its tab switches dismiss search with an empty field, which the synthetic cancel then reported as a user cancel and cleared the retained query. Also pin package provenance to pingdotgg/react-native-screens. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent f19890a commit 5d02fdd

3 files changed

Lines changed: 11 additions & 8 deletions

File tree

‎ios/legacy/RNSSearchBar.mm‎

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -401,14 +401,17 @@ - (void)didDismissSearchController:(UISearchController *)searchController
401401
{
402402
#if !TARGET_OS_TV
403403
// iOS 27's integrated close button clears and dismisses search without calling the cancel delegate.
404+
// Earlier versions call it themselves, and their tab switches also dismiss with an empty field.
404405
// A dismissal that keeps its text, or follows navigation or setActive(false), is not a cancel.
405406
// Integrated search can replace its field when collapsing, while its header stays mounted.
406-
UIView *header =
407-
[self.navigationItemDelegate isKindOfClass:UIView.class] ? (UIView *)self.navigationItemDelegate : nil;
408-
if (_userDismissal && !_cancelReported && ![self searchHostIsNavigating] &&
409-
searchController.searchBar.text.length == 0 &&
410-
(searchController.searchBar.window != nil || header.window != nil)) {
411-
[self searchBarCancelButtonClicked:searchController.searchBar];
407+
if (@available(iOS 27.0, *)) {
408+
UIView *header =
409+
[self.navigationItemDelegate isKindOfClass:UIView.class] ? (UIView *)self.navigationItemDelegate : nil;
410+
if (_userDismissal && !_cancelReported && ![self searchHostIsNavigating] &&
411+
searchController.searchBar.text.length == 0 &&
412+
(searchController.searchBar.window != nil || header.window != nil)) {
413+
[self searchBarCancelButtonClicked:searchController.searchBar];
414+
}
412415
}
413416
#endif
414417
_userDismissal = NO;

‎package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-native-screens",
3-
"version": "5.0.0-t3.48",
3+
"version": "5.0.0-t3.49",
44
"description": "Native navigation primitives for your React Native app.",
55
"scripts": {
66
"submodules": "git submodule update --init --recursive && (cd react-navigation && yarn && yarn build && cd ../)",

‎scripts/pack-t3.mjs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ if (run('git', ['status', '--porcelain']).trim()) {
2020
}
2121
run('git', ['merge-base', '--is-ancestor', pkg.t3Fork.upstreamCommit, 'HEAD']);
2222
const provenance = {
23-
repository: 'https://github.com/PixPMusic/react-native-screens',
23+
repository: 'https://github.com/pingdotgg/react-native-screens',
2424
commit: run('git', ['rev-parse', 'HEAD']).trim(),
2525
upstreamCommit: pkg.t3Fork.upstreamCommit,
2626
version: pkg.version,

0 commit comments

Comments
 (0)