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 Android composer cursor bug by removing setTimeout from native composer onChangeText #4922

Merged
merged 1 commit into from
Aug 12, 2024

Conversation

haileyok
Copy link
Contributor

@haileyok haileyok commented Aug 12, 2024

Why

Fixes #2703

It seems that we were using a setTimeout() hack in the onChangeText handler. This appears to have been previously necessary back in @mattermost/react-native-paste-input@0.6.0, and there were quite a few issues and "fixes" that came out of it. See #929 which added this setTimeout().

However, this timeout is actually causing problems on Android when composing posts. The cursor will frequently "move back" a space whenever the user is typing fast. After removing this timeout, I can't repro the behavior anymore. I also cannot reproduce the behavior that's noted about the wrong elements being painted. Maybe @estrattonbailey has more context on something I might be missing.

Admittedly, there isn't anything that screams "this is the fix!" (see https://github.com/mattermost/react-native-paste-input/releases, the releases are mostly just dependency bumps), though it is also worth noting that this library essentially just subclasses React Native's text components on either device, so it's maybe possible that there was a fix upstream for whatever the problem was. Or, we might have fixed something along the way that fixes this problem (i.e. the autocorrect bug we had for a long time and fixed in a patch).

Again though, maybe I'm missing context/don't know how to repro this problem.

Test Plan

Screen.Recording.2024-08-11.at.10.31.16.PM.mov

Copy link

render bot commented Aug 12, 2024

@haileyok haileyok changed the title remove setTimeout from native composer onChangeText Fix Android composer cursor bug by removing setTimeout from native composer onChangeText Aug 12, 2024
Copy link

Old size New size Diff
7.09 MB 7.09 MB 0 B (0.00%)

@haileyok haileyok merged commit db7a744 into main Aug 12, 2024
6 checks passed
estrattonbailey added a commit that referenced this pull request Aug 15, 2024
* origin/main: (28 commits)
  swap control files (#4936)
  [Embed] Starter pack embed embed (#4935)
  [Video] set audio category to ambient every time a new player is made (#4934)
  Add `/live/` to supported YouTube embed URLs (#4932)
  [Video] Try/catch video play/pause (#4930)
  Don't kick to login screen on network error (#4911)
  Remove .withProxy() calls (#4929)
  [Video] Audio duck off main thread (#4926)
  subclass agent to add setPersistSessionHandler (#4928)
  [Video] Fix crash when switching tabs (#4925)
  [Video] Invert usage of `setAudioActive` (#4924)
  Upgrade API, implement XRPC rework (#4857)
  rm from swift (#4923)
  Fix Android composer cursor bug by removing `setTimeout` from native composer `onChangeText` (#4922)
  Show handle in recent searches and fix truncation (#4917)
  Improve styles (#4916)
  Mark string for localization (#4920)
  Fix `occurred` typo (#4919)
  [Video] Resume background audio whenever muting video audio (#4915)
  [Videos] Add error boundary to native (#4914)
  ...
@haileyok haileyok deleted the hailey/remove-settimeout-android branch September 2, 2024 20:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

User input on Android occasionally is extremely janky
2 participants