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

compose: Drop TextInput workaround on clearing contents #5074

Merged
merged 1 commit into from
Oct 26, 2021

Conversation

gnprice
Copy link
Member

@gnprice gnprice commented Oct 25, 2021

This library was a workaround for a bug in React Native's TextInput
component: it doesn't tell the keyboard to refresh its state after
the app changes the text contents programmatically.

The workaround only operates in the case where we're clearing the
contents entirely. When we update it in any other way, such as for
autocomplete, we're still exposed to this RN bug; that's #5072.

And then it turns out that since RN v0.60.0, this workaround has been
superseded by one in RN which also operates only in the case of
completely clearing the contents:
#4239 (comment)

So we can happily drop it.

I tested this manually on a device which I know is affected by the
underlying RN bug, because it reproduces #5072: a Samsung J5 (model
SM-J510FN) running Android 6.0.1 and Samsung Keyboard 1.5.46. (From
other reports I believe these issues appear on recent Samsung devices
too; that's just the one I have on hand.) I sent a message, causing
us to clear the input. The keyboard state refreshed as it should:
typing a new letter inserted only that letter, not also the last word
typed in the previous message.

Fixes: #4239

@gnprice gnprice added a-Android a-compose/send Compose box, autocomplete, camera/upload, outbox, sending dependencies Pull requests that update a dependency file labels Oct 25, 2021
@chrisbobbe
Copy link
Contributor

Looks like the CI failure is from eslint:

/home/runner/work/zulip-mobile/zulip-mobile/src/compose/ComposeBox.js
Warning:   4:26  warning  'findNodeHandle' is defined but never used  no-unused-vars

@gnprice gnprice force-pushed the pr-textinput-drop-workaround branch from 747537c to a02ce99 Compare October 26, 2021 18:37
@gnprice
Copy link
Member Author

gnprice commented Oct 26, 2021

Whoops, thanks -- fixed.

This library was a workaround for a bug in React Native's TextInput
component: it doesn't tell the keyboard to refresh its state after
the app changes the text contents programmatically.

The workaround only operates in the case where we're clearing the
contents entirely.  When we update it in any other way, such as for
autocomplete, we're still exposed to this RN bug; that's zulip#5072.

And then it turns out that since RN v0.60.0, this workaround has been
superseded by one in RN which also operates only in the case of
completely clearing the contents:
  zulip#4239 (comment)

So we can happily drop it.

I tested this manually on a device which I know is affected by the
underlying RN bug, because it reproduces zulip#5072: a Samsung J5 (model
SM-J510FN) running Android 6.0.1 and Samsung Keyboard 1.5.46.  (From
other reports I believe these issues appear on recent Samsung devices
too; that's just the one I have on hand.)  I sent a message, causing
us to clear the input.  The keyboard state refreshed as it should:
typing a new letter inserted only that letter, not also the last word
typed in the previous message.

Fixes: zulip#4239
@chrisbobbe chrisbobbe force-pushed the pr-textinput-drop-workaround branch from a02ce99 to 3e276de Compare October 26, 2021 22:27
@chrisbobbe chrisbobbe merged commit 3e276de into zulip:main Oct 26, 2021
@chrisbobbe
Copy link
Contributor

chrisbobbe commented Oct 26, 2021

Thanks for all your investigative work around this, and for this PR! LGTM, merged.

@gnprice gnprice deleted the pr-textinput-drop-workaround branch October 26, 2021 23:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a-Android a-compose/send Compose box, autocomplete, camera/upload, outbox, sending dependencies Pull requests that update a dependency file
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove react-native-text-input-reset dependency, if possible
2 participants