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

Fix issue with composing text not being cleared on some Android devices #18859

Closed
wants to merge 1 commit into from

Conversation

mannol
Copy link
Contributor

@mannol mannol commented Apr 14, 2018

Summary

Clearing the android TextInput text programmatically (i.e. calling: this.textInputRef.clear()) does not clear the previously composing text, if enabled, causing inconveniences when such behaviour is desired (i.e. chat input box, where you constantly have to clear the input after sending a message). Instead, the currently observed behaviour is that, after a new text is entered (usually as soon as the first letter), the previously composing text reappears making the input unusable.

The effect is only observable on some devices, for example, we observed it on Samsung S6 devices using both Android 6 and 7, and several LG devices running Android 6.

This issue is only present when clearing the text; setting text to some other value does not produce the same effect.

Test Plan

// minimum code example
state = { v: "" };
_changeText = v => this.setState({ v });
clear = () => this.textInputRef.clear();

render() {
  return (
    <View style={styles.container}>
      <TouchableOpacity onPress={this.clear}>
        <Text> Clear </Text>
      </TouchableOpacity>
      <TextInput
        ref={ref => this.textInputRef = ref}
        value={this.state.v}
        onChangeText={this._changeText}
      />
    </View>
  );
}

Steps to reproduce(test):

  • Have a previously named device with default keyboard.
  • Have autocorrect enabled in the phone settings.
  • Type something in the input (preferably incomplete word so the autocomplete is not triggered).
  • Press clear.
  • Type a letter.
  • You will then see the previously composing text appear again.

Release Notes

[ANDROID] [Fixed] - Fix issue with composing text not being cleared

@react-native-bot react-native-bot added Missing Changelog This PR appears to be missing a changelog, or they are incorrectly formatted. Platform: Android Android applications. 📋Release Notes labels Apr 14, 2018
@facebook-github-bot
Copy link
Contributor

Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need the corporate CLA signed.

If you have received this in error or have any questions, please contact us at [email protected]. Thanks!

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Apr 14, 2018
@facebook-github-bot
Copy link
Contributor

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

@timwangdev timwangdev removed the Missing Changelog This PR appears to be missing a changelog, or they are incorrectly formatted. label Apr 23, 2018
@facebook-github-bot
Copy link
Contributor

@mannol I tried to find reviewers for this pull request and wanted to ping them to take another look. However, based on the blame information for the files in this pull request I couldn't find any reviewers. This sometimes happens when the files in the pull request are new or don't exist on master anymore. Is this pull request still relevant? If yes could you please rebase? In case you know who has context on this code feel free to mention them in a comment (one person is fine). Thanks for reading and hope you will continue contributing to the project.

@mannol
Copy link
Contributor Author

mannol commented May 16, 2018

Possibly @mkonicek and @shergin

@facebook-github-bot facebook-github-bot added the Import Started This pull request has been imported. This does not imply the PR has been approved. label Feb 13, 2019
Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hramos is landing this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@hramos
Copy link
Contributor

hramos commented Feb 13, 2019

Can you rebase? We're having issues importing PRs older than a few months old.

@facebook-github-bot facebook-github-bot added Import Failed and removed Import Started This pull request has been imported. This does not imply the PR has been approved. labels Feb 14, 2019
@facebook-github-bot

This comment has been minimized.

@mannol
Copy link
Contributor Author

mannol commented Feb 21, 2019

Sorry for the late response, I'll do this later tonight.

Clearing the android TextInput text programmatically (i.e. calling: this.textInputRef.clear()) does not clear the previously composing text, if enabled, causing inconveniences when such behaviour is desired (i.e. chat input box, where you constantly have to clear the input after sending a message). Instead, the currently observed behaviour is that, after a new text is entered (usually as soon as the first letter), the previously composing text reappears deeming the input unusable.

The effect is only observable on some devices, for example, we observed it on Samsung S6 devices using both Android 6 and 7, and several LG devices running Android 6.

This issue is only present when clearing the text; setting text to some other value does not produce the same effect.
@facebook facebook deleted a comment from pull-bot Feb 22, 2019
@facebook-github-bot facebook-github-bot added the Import Started This pull request has been imported. This does not imply the PR has been approved. label Feb 22, 2019
Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hramos is landing this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@react-native-bot
Copy link
Collaborator

@mannol merged commit b471916 into facebook:master.

@facebook facebook locked as resolved and limited conversation to collaborators Feb 22, 2019
@react-native-bot react-native-bot added the Merged This PR has been merged. label Feb 22, 2019
@hramos hramos removed Import Failed Import Started This pull request has been imported. This does not imply the PR has been approved. labels Feb 23, 2019
@hramos hramos removed the Import Started This pull request has been imported. This does not imply the PR has been approved. label Feb 23, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Merged This PR has been merged. Needs: Rebase Platform: Android Android applications.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants