Skip to content
TypeScript

fix(mobile): stop iOS autocorrect from rewriting search queries (#12949)

Julius Marminge33cb911ceb89
diff --git a/patches/[email protected] b/patches/[email protected]
index ee017ce1993..9212cfc7b0f 100644
--- a/patches/[email protected]
+++ b/patches/[email protected]
@@ -294,7 +294,7 @@ index 1c844846a5c66e31cfa530ca462774d2fb6bbea1..a60b96b44e85d3f4b29dc0d190b95ab6
break;
}
case RNSScreenStackHeaderSubviewTypeCenter:
-@@ -648,10 +693,470 @@ + (void)updateViewController:(UIViewController *)vc
+@@ -648,10 +693,479 @@ + (void)updateViewController:(UIViewController *)vc
// This assignment should be done after `navitem.titleView = ...` assignment (iOS 16.0 bug).
// See: https://github.com/software-mansion/react-native-screens/issues/1570 (comments)
navitem.title = config.title;
@@ -586,6 +586,15 @@ index 1c844846a5c66e31cfa530ca462774d2fb6bbea1..a60b96b44e85d3f4b29dc0d190b95ab6
+ ]];
+ }
+
++ // A bare UISearchTextField keeps UITextField defaults (sentence
++ // capitalization, autocorrect), unlike UISearchBar. Search queries are
++ // identifiers, so match the autoCapitalize "none" the JS fallbacks use.
++ if (resolvedSearchTextField != nil) {
++ resolvedSearchTextField.autocapitalizationType = UITextAutocapitalizationTypeNone;
++ resolvedSearchTextField.autocorrectionType = UITextAutocorrectionTypeNo;
++ resolvedSearchTextField.spellCheckingType = UITextSpellCheckingTypeNo;
++ }
++
+ NSString *searchTextChangeId = mailSearchToolbarConfig[@"searchTextChangeId"];
+ NSString *searchTextChangeActionIdentifier = @"org.react-native-screens.mail-search-toolbar.text-change";
+ if (resolvedSearchTextField != nil) {
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 6b4d8281b7d..dd50a292a46 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -110,7 +110,7 @@ patchedDependencies:
[email protected]: 6e4339347bc5bb3c9ea67d85ff5c814058b211c5750f247aba59d07869a2e787
[email protected]: 825622aae63a8fb5b904f3c77908a0e216261d727ea171709f2c0b6088422675
[email protected]: bae9878a5bdba94e11c890e5ee164542feb622624fc81c13890063094608216d
- [email protected]: 8156dd0f3407822404793cfdaa95639a36b62102f4507c981b8be83600bb382d
+ [email protected]: 595114f3f9ce8b9f0d99d1aafe5c12c997b7d75ca9add31d46cbedbfe347b8e0
[email protected]: 17d92be2eec71bb6396b402e8d034968e54b28746876d7977cb3139655f42b90
importers:
@@ -277,7 +277,7 @@ importers:
'@react-navigation/native-stack':
specifier: 7.17.6
- version: 7.17.6(patch_hash=e667c3cef8c78bb9ff4882ee5bd23a432247b843060a9499eb5f07e9e2295552)(ad1eff2c3e588b799b6541240bb21d97)
+ version: 7.17.6(patch_hash=e667c3cef8c78bb9ff4882ee5bd23a432247b843060a9499eb5f07e9e2295552)(f640afa6cd4b9a1dc5422cbafdc82f53)
'@shikijs/core':
specifier: 4.2.0
version: 4.2.0
@@ -457,7 +457,7 @@ importers:
react-native-screens:
specifier: ~4.26.0
- version: 4.26.2(patch_hash=8156dd0f3407822404793cfdaa95639a36b62102f4507c981b8be83600bb382d)([email protected](@babel/[email protected])(@react-native/[email protected](@babel/[email protected])([email protected])([email protected]))(@types/[email protected])([email protected])([email protected])([email protected]))([email protected])
+ version: 4.26.2(patch_hash=595114f3f9ce8b9f0d99d1aafe5c12c997b7d75ca9add31d46cbedbfe347b8e0)([email protected](@babel/[email protected])(@react-native/[email protected](@babel/[email protected])([email protected])([email protected]))(@types/[email protected])([email protected])([email protected])([email protected]))([email protected])
react-native-shiki-engine:
specifier: ^0.3.12
@@ -14519,7 +14519,7 @@ snapshots:
optionalDependencies:
- '@react-navigation/[email protected](patch_hash=e667c3cef8c78bb9ff4882ee5bd23a432247b843060a9499eb5f07e9e2295552)(ad1eff2c3e588b799b6541240bb21d97)':
+ '@react-navigation/[email protected](patch_hash=e667c3cef8c78bb9ff4882ee5bd23a432247b843060a9499eb5f07e9e2295552)(f640afa6cd4b9a1dc5422cbafdc82f53)':
dependencies:
'@react-navigation/elements': 2.9.26(c10301b6e0c42fc6434d2b643197a81e)
@@ -14527,7 +14527,7 @@ snapshots:
react: 19.2.3
- react-native-screens: 4.26.2(patch_hash=8156dd0f3407822404793cfdaa95639a36b62102f4507c981b8be83600bb382d)([email protected](@babel/[email protected])(@react-native/[email protected](@babel/[email protected])([email protected])([email protected]))(@types/[email protected])([email protected])([email protected])([email protected]))([email protected])
+ react-native-screens: 4.26.2(patch_hash=595114f3f9ce8b9f0d99d1aafe5c12c997b7d75ca9add31d46cbedbfe347b8e0)([email protected](@babel/[email protected])(@react-native/[email protected](@babel/[email protected])([email protected])([email protected]))(@types/[email protected])([email protected])([email protected])([email protected]))([email protected])
sf-symbols-typescript: 2.2.0
warn-once: 0.1.1
transitivePeerDependencies:
@@ -20375,7 +20375,7 @@ snapshots:
react: 19.2.3
dependencies:
react: 19.2.3
react-freeze: 1.0.4([email protected])