-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Composer: add clear command that bypasses the event count #45613
Composer: add clear command that bypasses the event count #45613
Conversation
I'm able to get the message to remain in the text input after sending by spamming the send button while typing: Screen.Recording.2024-07-18.at.21.02.12.mov |
…-clearing-force-clear-event
Was that in a release or debug build? |
In the debug build |
can you confirm that the patch got applied (react native patch 18)? I can't reproduce this behaviour on any of my sims / devices |
I tested it on debug and release build and wasn't able to reproduce it Simulator.Screen.Recording.-.14.Pro.-.2024-07-19.at.16.46.58.mp4 |
@Ollyws Okay, then let's move forward with the PR? If we see in production that its still broken we can revert this PR, and try again (or in the worst case come back to the approach in this PR) |
Reviewer Checklist
Screenshots/VideosAndroid: Native01_Android_Native.mp4Android: mWeb Chrome02_Android_Chrome.mp4iOS: Native03_iOS_Native.mp4iOS: mWeb Safari04_iOS_Safari.mp4MacOS: Chrome / Safari05_MacOS_Chrome.mp4MacOS: Desktop06_MacOS_Desktop.mp4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
🚀 Deployed to staging by https://github.com/MariaHCD in version: 9.0.11-0 🚀
|
🚀 Cherry-picked to staging by https://github.com/francoisl in version: 9.0.11-2 🚀
@Expensify/applauseleads please QA this PR and check it off on the deploy checklist if it passes. |
🚀 Deployed to production by https://github.com/francoisl in version: 9.0.11-5 🚀
|
🚀 Deployed to production by https://github.com/francoisl in version: 9.0.12-0 🚀
|
Details
This PR is an alternative implementation to the approach taken in this PR:
the problem with that PR is that the web implementation become quite complex, and I had to rewrite large parts of the composer. I was working on a PR here for react-native-live-markdown, but realised there were many edge cases that needed to be considered:
Solution explained
This PR fixes the problem by:
testInputRef.clear()
or setting thevalue
prop to""
it internally calls a view command calledsetTextAndSelection("", 0, 0)
setTextAndSelection
is using an event count mechanism. It drops events from JS that have an outdated event count.setTextAndSelection("", 0, 0)
event reached the native side. Once it arrives its outdated and simply droppedclear
view command always takes the latest event count on the native side (and actually also increments it, so any further updates that might happened in between get dropped)We already tried to call
setNativeProps(animatedRef, {text: ''})
, however this is also limited by the event count.Upstream PR at
facebook/react-native
I discussed this with multiple people and figured the best way is to first start a discussion on the react-native repo. I suspect that such a change can take a long while until it gets merged to react-native in some way:
It might also be that meta doesn't want to do any of these changes. In this case we already discussed on slack that we might want to look into writing our own expensify text input component that extends react-native's.
There exists an issue for that in react-native:
Fixed Issues
$ #37896
PROPOSAL:
Tests
Check that the original bug is fixed, reproduction:
Offline tests
Same as tests
QA Steps
Same as tests
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.src/languages/*
files and using the translation methodSTYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)Design
label and/or tagged@Expensify/design
so the design team can review the changes.ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.Screenshots/Videos
Android: Native
android-native.mov
Android: mWeb Chrome
Screen.Recording.2024-07-17.at.17.18.33.mov
iOS: Native
ios-native.mov
iOS: mWeb Safari
ios-mweb.mov
MacOS: Chrome / Safari
web.mov
MacOS: Desktop
Screen.Recording.2024-07-17.at.17.20.42.mov