Skip to content
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 not support Chinese input/clear() function doesn`t work in recent release of Reac-Native #18767

Closed
feng-zhang0712 opened this issue Apr 9, 2018 · 11 comments
Labels
Component: TextInput Related to the TextInput component. Ran Commands One of our bots successfully processed a command. Resolution: For Stack Overflow A question for Stack Overflow. Applying this label will cause issue to be closed. Resolution: Locked This issue was locked by the bot.

Comments

@feng-zhang0712
Copy link

feng-zhang0712 commented Apr 9, 2018

It seems like a very big problem, and not all TextInput component access to have this problem. I just found if I use defaultValue props, it will happen. This problem in react-native version 0.54.0~0.55.1, but normal in 0.53.0

@feng-zhang0712 feng-zhang0712 changed the title TextInput not support Chinese input in recent release of Reac-Native TextInput not support Chinese input/clear() function doesn`t work in recent release of Reac-Native Apr 9, 2018
@react-native-bot
Copy link
Collaborator

Thanks for posting this! It looks like your issue may be incomplete. Are all the fields required by the Issue Template filled out?

If you believe your issue contains all the relevant information, let us know in order to have a maintainer remove the No Template label. Thank you for your contributions.

How to ContributeWhat to Expect from Maintainers

@react-native-bot react-native-bot added 📋No Template Component: TextInput Related to the TextInput component. labels Apr 9, 2018
@hramos hramos added the Resolution: For Stack Overflow A question for Stack Overflow. Applying this label will cause issue to be closed. label Apr 9, 2018
@react-native-bot react-native-bot added the Ran Commands One of our bots successfully processed a command. label Apr 9, 2018
@react-native-bot
Copy link
Collaborator

This issue looks like a question that would be best asked on Stack Overflow.

Stack Overflow is amazing for Q&A: it has a reputation system, voting, the ability to mark a question as answered. Because of the reputation system it is likely the community will see and answer your question there. This also helps us use the GitHub bug tracker for bugs only.

Will close this as this is really a question that should be asked on Stack Overflow.

@feng-zhang0712
Copy link
Author

feng-zhang0712 commented Apr 11, 2018

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

@zhaiyjgithub
Copy link

i fixed the bug from @mkjfeng01. thanks.

@SunAnle
Copy link

SunAnle commented May 25, 2018

react-native version 0.55.3 has the same problem

@winglleung
Copy link

Same in react-native: 0.55.4.

@johnxie
Copy link

johnxie commented May 30, 2018

Any updates on this issue?

@feng-zhang0712
Copy link
Author

feng-zhang0712 commented May 31, 2018

@SunAnle @winglleung @johnxie Follow these file changes, and modify your code manual. I think this will solve your problem. https://github.com/facebook/react-native/pull/18456/files

@leonyhenn
Copy link

leonyhenn commented Jul 10, 2018

I find a workaround for this issue.
my experience with this bug is that
(a). Chinese input goes "dissappear" and only English letters are left in the textInput
(b). prop value of textInput cause this (a)
(c). If you want to use .clear(), you have to have prop value, otherwise .clear() won't clear input field in this release.

the workaround is NOT use prop value and .clear(), instead use setNativeProps.

following is my code sample.

<TextInput
        multiline={this.props.multiline}
        onChangeText={(text) => this.onChangeText(text)}
        //value={this.props.text}
        blurOnSubmit={false}
        //{...this.props.textInputProps}
        ref={component => this._textInput = component}
        onSubmitEditing={() => {
          this.clearText()
        }}
      />

and

  clearText(){
    if (Platform.OS === 'ios') {
      this._textInput.setNativeProps({ text: ' ' });
    }
    
    setTimeout(() => {
      this._textInput.setNativeProps({ text: '' });
    },5);
  }

Hope it helps.

@datvtwkm
Copy link

@leonyhenn amazing, you save my life! What is the magic behind this?

@Eaffy
Copy link

Eaffy commented Aug 13, 2018

@leonyhenn you save my life 2 !

@facebook facebook locked as resolved and limited conversation to collaborators Apr 9, 2019
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Apr 9, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Component: TextInput Related to the TextInput component. Ran Commands One of our bots successfully processed a command. Resolution: For Stack Overflow A question for Stack Overflow. Applying this label will cause issue to be closed. Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

10 participants