Skip to content

ReactNative's state update via this.setState breaks text input mode for Korean, Chinese, Japanese characters in 0.54 and 0.55 #19339

Closed
@daesan

Description

@daesan

Environment

Environment:
OS: macOS High Sierra 10.13.4
Node: 6.11.0
Yarn: Not Found
npm: 3.10.10
Watchman: Not Found
Xcode: Xcode 9.3 Build version 9E145
Android Studio: 3.0 AI-171.4443003

Packages: (wanted => installed)
react: ^16.3.1 => 16.3.2
react-native: ^0.55.4 => 0.55.4

Steps to Reproduce

This issue has been reported number of times already. #19313 #18403 #19104 #19337 #12599 #18379 #18767 #18260

However, most of them reported the issue as being the TextInput bug whereas the real bug seems to lie with ReactNative's view re-rendering logic in iOS. This report is to unify them under a more proper title so that someone who is more likely to recognize the root cause of this issue can pay attention.

If there is a TextInput tag in jsx file and its onChange or onChangeText callback has this.setState() call, Korean, Chinese, Japanese characters (which have multi-stage character input mode) are not input correctly.

In caes of Hangul(Korean), if the cursor is at the end of the text, the input is handled properly. However, if the cursor is at the beginning or is in the middle of the text, the input character parts are not combined as they should be. The parts of a character that should form a single character are input separately by themselves.

To reproduce, just type some Korean characters in TextInput, such as "하늘". Then move the cursor to the beginning of the text, and then type any text. Let's say I typed "파란" this time.

Expected Behavior

The text should be input like "파란하늘" (meaning blue sky)

Actual Behavior

However, as of RN version 0.54 and 0.55, the text is input like "ㅍㅏㄹㅏㄴ하늘"

Chinese characters and Japanese kanji characters are input by first entering romanzi to specify the pronounciation and then the user select a character from a list of Chinese characters popup that appears. However, this popup does not appear at all, as demonstrated in #18403.

Korean, Chineses, Japanese characters input is handled by multi-state IM mode. However, setState => view re-rendering cycle of ReactNative in v0.54 and v0.55 seems to reset the "character input is in progress" IM mode, thus causing incomplete and/or no characters to be entered into TextInput field.

This is a rather serious issue for Korean, Chinese, Japanese developers who have no options but to stick with v0.53 or below. (0.53 is particularly unstable version so I am stuck using v0.52.3) If anyone can guess where this issue might be stemming from, please share your opinions. It would be very much appreciated. Thank you.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Impact: RegressionDescribes a behavior that used to work on a prior release, but stopped working recently.Platform: iOSiOS applications.Resolution: LockedThis issue was locked by the bot.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions