From 7b301fc7236edf8faa81897447ab23d21ee0bcd4 Mon Sep 17 00:00:00 2001 From: Nathan Walker Date: Thu, 5 Mar 2026 16:28:49 -0800 Subject: [PATCH 1/2] perf(TextField): optimize secureWithoutAutofill --- packages/core/ui/text-field/index.ios.ts | 61 +++++++++++++++++------- 1 file changed, 43 insertions(+), 18 deletions(-) diff --git a/packages/core/ui/text-field/index.ios.ts b/packages/core/ui/text-field/index.ios.ts index d82eb6c8df..c490ce4a26 100644 --- a/packages/core/ui/text-field/index.ios.ts +++ b/packages/core/ui/text-field/index.ios.ts @@ -245,35 +245,60 @@ export class TextField extends TextFieldBase { return; } - const nativeField = textField as any; + let shouldReloadInputViews = false; - textField.secureTextEntry = true; + if (!textField.secureTextEntry) { + textField.secureTextEntry = true; + shouldReloadInputViews = true; + } - if (nativeField.textContentType !== undefined) { - nativeField.textContentType = typeof UITextContentTypeOneTimeCode !== 'undefined' ? UITextContentTypeOneTimeCode : ''; + if (textField.textContentType !== undefined) { + const desiredTextContentType = typeof UITextContentTypeOneTimeCode !== 'undefined' ? UITextContentTypeOneTimeCode : ''; + if (textField.textContentType !== desiredTextContentType) { + textField.textContentType = desiredTextContentType; + shouldReloadInputViews = true; + } } - if (nativeField.autocorrectionType !== undefined) { - nativeField.autocorrectionType = UITextAutocorrectionType.No; + if (textField.autocorrectionType !== undefined) { + if (textField.autocorrectionType !== UITextAutocorrectionType.No) { + textField.autocorrectionType = UITextAutocorrectionType.No; + shouldReloadInputViews = true; + } } - if (nativeField.spellCheckingType !== undefined) { - nativeField.spellCheckingType = UITextSpellCheckingType.No; + if (textField.spellCheckingType !== undefined) { + if (textField.spellCheckingType !== UITextSpellCheckingType.No) { + textField.spellCheckingType = UITextSpellCheckingType.No; + shouldReloadInputViews = true; + } } - if (nativeField.smartDashesType !== undefined) { - nativeField.smartDashesType = UITextSmartDashesType.No; + if (textField.smartDashesType !== undefined) { + if (textField.smartDashesType !== UITextSmartDashesType.No) { + textField.smartDashesType = UITextSmartDashesType.No; + shouldReloadInputViews = true; + } } - if (nativeField.smartQuotesType !== undefined) { - nativeField.smartQuotesType = UITextSmartQuotesType.No; + if (textField.smartQuotesType !== undefined) { + if (textField.smartQuotesType !== UITextSmartQuotesType.No) { + textField.smartQuotesType = UITextSmartQuotesType.No; + shouldReloadInputViews = true; + } } - if (nativeField.smartInsertDeleteType !== undefined) { - nativeField.smartInsertDeleteType = UITextSmartInsertDeleteType.No; + if (textField.smartInsertDeleteType !== undefined) { + if (textField.smartInsertDeleteType !== UITextSmartInsertDeleteType.No) { + textField.smartInsertDeleteType = UITextSmartInsertDeleteType.No; + shouldReloadInputViews = true; + } } - if (nativeField.passwordRules !== undefined) { - nativeField.passwordRules = null; + if (textField.passwordRules !== undefined) { + if (textField.passwordRules !== null) { + textField.passwordRules = null; + shouldReloadInputViews = true; + } } - if (nativeField.reloadInputViews) { - nativeField.reloadInputViews(); + if (shouldReloadInputViews && textField.isFirstResponder) { + textField.reloadInputViews(); } } From b48030b00ed71c59362f4b990ec003be03509f8d Mon Sep 17 00:00:00 2001 From: Nathan Walker Date: Fri, 6 Mar 2026 08:15:52 -0800 Subject: [PATCH 2/2] chore: simplify --- packages/core/ui/text-field/index.ios.ts | 57 +++++++++--------------- 1 file changed, 21 insertions(+), 36 deletions(-) diff --git a/packages/core/ui/text-field/index.ios.ts b/packages/core/ui/text-field/index.ios.ts index c490ce4a26..8235064b6d 100644 --- a/packages/core/ui/text-field/index.ios.ts +++ b/packages/core/ui/text-field/index.ios.ts @@ -252,49 +252,34 @@ export class TextField extends TextFieldBase { shouldReloadInputViews = true; } - if (textField.textContentType !== undefined) { - const desiredTextContentType = typeof UITextContentTypeOneTimeCode !== 'undefined' ? UITextContentTypeOneTimeCode : ''; - if (textField.textContentType !== desiredTextContentType) { - textField.textContentType = desiredTextContentType; - shouldReloadInputViews = true; - } + if (textField.textContentType !== undefined && textField.textContentType !== UITextContentTypeOneTimeCode) { + textField.textContentType = UITextContentTypeOneTimeCode; + shouldReloadInputViews = true; } - if (textField.autocorrectionType !== undefined) { - if (textField.autocorrectionType !== UITextAutocorrectionType.No) { - textField.autocorrectionType = UITextAutocorrectionType.No; - shouldReloadInputViews = true; - } + if (textField.autocorrectionType !== undefined && textField.autocorrectionType !== UITextAutocorrectionType.No) { + textField.autocorrectionType = UITextAutocorrectionType.No; + shouldReloadInputViews = true; } - if (textField.spellCheckingType !== undefined) { - if (textField.spellCheckingType !== UITextSpellCheckingType.No) { - textField.spellCheckingType = UITextSpellCheckingType.No; - shouldReloadInputViews = true; - } + if (textField.spellCheckingType !== undefined && textField.spellCheckingType !== UITextSpellCheckingType.No) { + textField.spellCheckingType = UITextSpellCheckingType.No; + shouldReloadInputViews = true; } - if (textField.smartDashesType !== undefined) { - if (textField.smartDashesType !== UITextSmartDashesType.No) { - textField.smartDashesType = UITextSmartDashesType.No; - shouldReloadInputViews = true; - } + if (textField.smartDashesType !== undefined && textField.smartDashesType !== UITextSmartDashesType.No) { + textField.smartDashesType = UITextSmartDashesType.No; + shouldReloadInputViews = true; } - if (textField.smartQuotesType !== undefined) { - if (textField.smartQuotesType !== UITextSmartQuotesType.No) { - textField.smartQuotesType = UITextSmartQuotesType.No; - shouldReloadInputViews = true; - } + if (textField.smartQuotesType !== undefined && textField.smartQuotesType !== UITextSmartQuotesType.No) { + textField.smartQuotesType = UITextSmartQuotesType.No; + shouldReloadInputViews = true; } - if (textField.smartInsertDeleteType !== undefined) { - if (textField.smartInsertDeleteType !== UITextSmartInsertDeleteType.No) { - textField.smartInsertDeleteType = UITextSmartInsertDeleteType.No; - shouldReloadInputViews = true; - } + if (textField.smartInsertDeleteType !== undefined && textField.smartInsertDeleteType !== UITextSmartInsertDeleteType.No) { + textField.smartInsertDeleteType = UITextSmartInsertDeleteType.No; + shouldReloadInputViews = true; } - if (textField.passwordRules !== undefined) { - if (textField.passwordRules !== null) { - textField.passwordRules = null; - shouldReloadInputViews = true; - } + if (textField.passwordRules !== undefined && textField.passwordRules !== null) { + textField.passwordRules = null; + shouldReloadInputViews = true; } if (shouldReloadInputViews && textField.isFirstResponder) {