-
Notifications
You must be signed in to change notification settings - Fork 24.2k
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
Possible bug with TextInput and Chinese input method on iOS #12599
Comments
Note that this is no longer valid, it only works on React Native version: 0.41.2. I'll give a workaround which can fix the problem with both my original project and this reproduction project. The only modified part is inside the
Basically, If you want to make your app looks like not allow Chinese input method, you can remove this line Though I don't think this is a good idea, just FYI. |
@Kulbear I have the same problem , this should be a bug , and thanks for the workaround you provided. |
Could you please confirm that this issue still exists in current master? We recently fixed very similar issue and I hope that fix may help with this problem as well. |
@shergin Will do in 1-2 days. 👏 |
@shergin With the dependencies below, it still doesn't work as expected.
|
@shergin
Here is the log I got from both side:
The count 198 and 199 is those two change after click the outside of the TextInput. I cannot dig deeper since I'm not familiar with iOS(I'm an Android developer), but there are two things I don't understand:
|
A simple tmp workaround is remove the condition about But it will cause the UI syc problem when your JS running slowly, be careful if you want to use the approach. |
Summary: This introduces event counts to make sure JS doesn't set out of date values on native text inputs, which can cause dropped characters and can mess with autocomplete, and obviates the need for the input buffering which added lag and complexity to the component. Made sure to test simulated super-slow JS text event processing to make sure characters aren't dropped, as well as typing obviously correctable words and making sure autocomplete works as expected. TextInput is now a controlled input by default without causing any issues for most cases, so I removed the `controlled` prop. Fixes selection state jumping by restoring it after setting new text values, so highlighting the middle of some text in the new ReWrite example and hitting space will replace that selection with an underscore and keep the cursor at a sensible position as expected, instead of jumping to the end. Ads `maxLength` prop to support the most commonly needed syncronous behavior: preventing the user from typing too many characters. It can also be used to prevent users from continuing to type after entering special characters by changing it to the current length after a regex match. Made sure to verify it works well with pasted input (including in the middle of existing text), truncating it and collapsing the selection the same way it does on the web. Fixes bug in TextEventsExample where it wouldn't show the submit and end events, even though there were firing correctly.
I'm having a same issue with iOS system Chinese input on TextInput. |
Have the same problem in japanese input(also in chinese input). Only in IOS when typing, only the first character is correctly spelled (example: ba→ば) but the rest characters donot work (example : ba→bあ) when I use the setTimeout solution, I even cannot correctly input the first character. that solution does not work for me.(and I' m using redux-form Field to wrap the TextInput element) Finnally I delete the redux-form,not use it and the TextInput get worked again. |
@kidmysoul My workaround seems to be invalid after several releases since I made the original post... I think this problem will happen whenever we are using an input method like Chinese or Japanese input methods that require a selection after typing some character combination... |
我也遇到同样的问题,不能输入中文。。。 |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Maybe the issue has been fixed in a recent release, or perhaps it is not affecting a lot of people. If you think this issue should definitely remain open, please let us know why. Thank you for your contributions. |
This is still a problem for Chinese/Japanese/Korean input method. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Maybe the issue has been fixed in a recent release, or perhaps it is not affecting a lot of people. If you think this issue should definitely remain open, please let us know why. Thank you for your contributions. |
I’m having this problem of using TextInput with Chinese Pinyin probably due to the same bug. When I set a max length in the textinput and type Pinyin in this input, the length constraint applies to the Pinyin rather than the final resulting Chinese characters. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Maybe the issue has been fixed in a recent release, or perhaps it is not affecting a lot of people. If you think this issue should definitely remain open, please let us know why. Thank you for your contributions. |
I think this issue could potentially affect a lot of Chinese, Korean, Japanese users, or say non-alphabetic language users. |
Hey, when I update react native to version 0.54.0 ,this problem appears again !? liked there were lots of changes about textinput in ios in 0.54.0 and maybe that effects.
this simple code above cannot even input a whole Japanese word in ios. |
so Big Issue!!!!! |
problem happened in react-native version 0.55.0 |
problem happened in react-native version 0.54.2 |
@gelove Problem has been solved here #18456, the code has not been merged to newest version, so you have to modify your code manually https://github.com/facebook/react-native/pull/18456/files |
I took out |
Any Update on this issue? (exist in 0.55.4) |
I also have the same problem, the version is 0.55.4 |
this problem still occurs in 55.3 |
I have to use the <TextInput
style={[ commonStyles.commonInput, commonStyles.pdl_normal, commonStyles.pdr_normal ]}
underlineColorAndroid={'transparent'}
// 中文支持问题, issues
// https://github.com/facebook/react-native/issues/12599
// value={this.state.remark}
// onChangeText={( text ) => this.setState( { remark: text } )}
// onChange={(evt) => this.setState({ remark: evt.nativeEvent.text })}
// onChangeText={(text) => setTimeout(() => {this.setState({ remark: text })})}
onEndEditing={(evt) => this.setState({ remark: evt.nativeEvent.text })}
placeholder={I18n.t( Keys.eos_remark )}
defaultValue={this.state.remark}
autoCapitalize={'none'}/> Notice: |
This problem still occurs in RN56.0 as well. As AKACC mentioned if you remove "value" field from TextInput it seems to work even if you use maxlength and onChangeText for every letter typed. Since it is pretty common to read a value stored in Redux store as below I wish this bug to be taken care for CJK letters input. <TextInput
value={this.props.displayName} // <--- remove this line
label="some_text"
onChangeText={val=> this.onChangeInput("displayName", val)}
maxLength={8}
placeholder="some_placeholder_text"
autoCapitalize="none"
/> |
This bug has been fixed. https://github.com/facebook/react-native/pull/18456/files. I merge this code manually, it works well. |
Can I get some idea on when and/or which release will have the bug fix? |
@hkung77 maybe 0.57.0 |
This critical issue lived so long time even in 0.56.1, I can't understand. |
@elanpang this has been included in |
@StevenMasini So luck :) |
Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as "For Discussion" or "Good first issue" and I will leave it open. Thank you for your contributions. |
Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please feel free to create a new issue with up-to-date information. |
Description
I have some TextInput components in my project and there should be some problems with
onEndEditting
andonBlur
props of TextInput component. If I make the TextInput blur before I confirm the entered content from the Chinese input method, all the changes I made during this round of focus will be lost. Check the video below, starts from 0:17, the video demonstrates the issue.Basically, it should be an issue between the system Chinese input method and the RN TextInput component. I made a 30-second video record to demonstrate this issue.
https://www.youtube.com/watch?v=BG0WNHW2MEc
Reproduction
I don't know how to work with Chinese input methods on rnplay, so I've pushed a sample project with minimal code for reproduction.
Current code with a workaround
Original bug reproduction
I created a new project. The only modified file is the
index.ios.js
Solution
As you can see from the video, the displayed text and the text in the TextInput component should be identical.
Additional Information
The text was updated successfully, but these errors were encountered: