From 5b203a43cacd06ee809bcee92c17068e9e9e02be Mon Sep 17 00:00:00 2001 From: ruifanyuan Date: Mon, 6 Nov 2023 16:34:33 +0800 Subject: [PATCH] fix(ios): reaload textfield after changing keyboardType --- .../renderer/component/textinput/NativeRenderTextField.m | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/renderer/native/ios/renderer/component/textinput/NativeRenderTextField.m b/renderer/native/ios/renderer/component/textinput/NativeRenderTextField.m index 9e27d5947c5..b2505721133 100644 --- a/renderer/native/ios/renderer/component/textinput/NativeRenderTextField.m +++ b/renderer/native/ios/renderer/component/textinput/NativeRenderTextField.m @@ -30,15 +30,22 @@ @implementation NativeRenderUITextField - (void)setKeyboardType:(UIKeyboardType)keyboardType { + if(self.keyboardType == keyboardType){ + return; + } NSString *tempPwdStr = self.text; self.text = @""; if (keyboardType == UIKeyboardTypeTwitter) { self.secureTextEntry = true; } else { self.secureTextEntry = false; - [super setKeyboardType:keyboardType]; } + [super setKeyboardType:keyboardType]; self.text = tempPwdStr; + + if([self isFirstResponder]){ + [self reloadInputViews]; + } } - (void)setReturnKeyType:(UIReturnKeyType) returnKeyType{