-
Notifications
You must be signed in to change notification settings - Fork 24.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TextInput onChangeText is firing at wrong time when type with Chinese input keyboard in iOS #30578
Comments
This can be fixed by applying the following diff to react-native source code diff --git a/Libraries/Text/TextInput/RCTBackedTextInputDelegateAdapter.m b/Libraries/Text/TextInput/RCTBackedTextInputDelegateAdapter.m
--- a/Libraries/Text/TextInput/RCTBackedTextInputDelegateAdapter.m
+++ b/Libraries/Text/TextInput/RCTBackedTextInputDelegateAdapter.m
@@ -107,6 +107,12 @@ - (BOOL)textFieldShouldReturn:(__unused UITextField *)textField
- (void)textFieldDidChange
{
+ UITextRange *markedTextRange = _backedTextInputView.markedTextRange;
+
+ if (markedTextRange != nil && !markedTextRange.empty) {
+ return;
+ }
+
_textDidChangeIsComing = NO;
[_backedTextInputView.textInputDelegate textInputDidChange]; the result will be after_applied.movbut we will not able to handle the "ongoing text" ( So I tried using Seems like the "ongoing text" is not currently well handled by react-native, I'll stick to the diff solution mentioned above and make a pull request. |
still happen in 0.64.2 |
Seems like @rnike 's workaround doesn't work any more in RN 0.67.4. Does anyone figure out how to solve this problem? I'm not an iOS developer but would like to help test. |
This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days. |
Not stale. The pr #31376 is still opening and not merged |
Description
TextInput onChangeText is firing at wrong time. Here is the gif to show the problem.
I am typing the Chinese wording "你好" with a Chinese input keyboard in iOS.
React Native version:
Steps To Reproduce
Provide a detailed list of steps that reproduce the issue.
Expected Results
onChangeText should not be fire before the input method is done. It should be fired 2 times for 2 Chinese characters instead of 8 times.
Snack, code example, screenshot, or link to a repository:
https://snack.expo.io/@hkhermanho/textinput-with-chinese
The text was updated successfully, but these errors were encountered: