From fd7d84008a2ac53ab85d922c41b65a19a0f02a9f Mon Sep 17 00:00:00 2001 From: szydlovsky <9szydlowski9@gmail.com> Date: Tue, 23 Sep 2025 19:04:12 +0200 Subject: [PATCH] fix: use the only working focus check API --- ios/utils/TextInsertionUtils.mm | 4 ++-- ios/utils/ZeroWidthSpaceUtils.mm | 6 ++---- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/ios/utils/TextInsertionUtils.mm b/ios/utils/TextInsertionUtils.mm index 83b8c7b94..ac5f62f63 100644 --- a/ios/utils/TextInsertionUtils.mm +++ b/ios/utils/TextInsertionUtils.mm @@ -18,7 +18,7 @@ + (void)insertText:(NSString*)text at:(NSInteger)index additionalAttributes:(NSD [textView.textStorage insertAttributedString:newAttrStr atIndex:index]; if(withSelection) { - if(!textView.focused) { + if(![textView isFirstResponder]) { [textView reactFocus]; } textView.selectedRange = NSMakeRange(index + text.length, 0); @@ -38,7 +38,7 @@ + (void)replaceText:(NSString*)text at:(NSRange)range additionalAttributes:(NSDi } if(withSelection) { - if(!textView.focused) { + if(![textView isFirstResponder]) { [textView reactFocus]; } textView.selectedRange = NSMakeRange(range.location + text.length, 0); diff --git a/ios/utils/ZeroWidthSpaceUtils.mm b/ios/utils/ZeroWidthSpaceUtils.mm index 04e785989..587113245 100644 --- a/ios/utils/ZeroWidthSpaceUtils.mm +++ b/ios/utils/ZeroWidthSpaceUtils.mm @@ -63,8 +63,7 @@ + (void)removeSpacesIfNeededinInput:(EnrichedTextInputView *)input { } // fix the selection if needed - if(input->textView.focused) { - [input->textView reactFocus]; + if([input->textView isFirstResponder]) { input->textView.selectedRange = NSMakeRange(preRemoveSelection.location + postRemoveOffset, preRemoveSelection.length); } } @@ -112,8 +111,7 @@ + (void)addSpacesIfNeededinInput:(EnrichedTextInputView *)input { } // fix the selection if needed - if(input->textView.focused) { - [input->textView reactFocus]; + if([input->textView isFirstResponder]) { input->textView.selectedRange = NSMakeRange(preAddSelection.location + postAddOffset, preAddSelection.length); } }