Skip to content

Commit 33cb911

Browse files
fix(mobile): stop iOS autocorrect from rewriting search queries (#12949)
Co-authored-by: Claude Fable 5 <[email protected]>
1 parent 371b52d commit 33cb911

2 files changed

Lines changed: 16 additions & 7 deletions

File tree

‎patches/[email protected]‎

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ index 1c844846a5c66e31cfa530ca462774d2fb6bbea1..a60b96b44e85d3f4b29dc0d190b95ab6
294294
break;
295295
}
296296
case RNSScreenStackHeaderSubviewTypeCenter:
297-
@@ -648,10 +693,470 @@ + (void)updateViewController:(UIViewController *)vc
297+
@@ -648,10 +693,479 @@ + (void)updateViewController:(UIViewController *)vc
298298
// This assignment should be done after `navitem.titleView = ...` assignment (iOS 16.0 bug).
299299
// See: https://github.com/software-mansion/react-native-screens/issues/1570 (comments)
300300
navitem.title = config.title;
@@ -586,6 +586,15 @@ index 1c844846a5c66e31cfa530ca462774d2fb6bbea1..a60b96b44e85d3f4b29dc0d190b95ab6
586586
+ ]];
587587
+ }
588588
+
589+
+ // A bare UISearchTextField keeps UITextField defaults (sentence
590+
+ // capitalization, autocorrect), unlike UISearchBar. Search queries are
591+
+ // identifiers, so match the autoCapitalize "none" the JS fallbacks use.
592+
+ if (resolvedSearchTextField != nil) {
593+
+ resolvedSearchTextField.autocapitalizationType = UITextAutocapitalizationTypeNone;
594+
+ resolvedSearchTextField.autocorrectionType = UITextAutocorrectionTypeNo;
595+
+ resolvedSearchTextField.spellCheckingType = UITextSpellCheckingTypeNo;
596+
+ }
597+
+
589598
+ NSString *searchTextChangeId = mailSearchToolbarConfig[@"searchTextChangeId"];
590599
+ NSString *searchTextChangeActionIdentifier = @"org.react-native-screens.mail-search-toolbar.text-change";
591600
+ if (resolvedSearchTextField != nil) {

‎pnpm-lock.yaml‎

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)