-
Notifications
You must be signed in to change notification settings - Fork 3.4k
fix: composer not cleared when sending message #44285
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
Conversation
a91920a to
b78967e
Compare
- emoji with colon is broken - emoji picker is broken - selecting text when it contains an emoji is broken
src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/ComposerWithSuggestions.tsx
Outdated
Show resolved
Hide resolved
Screen.Recording.2024-07-05.at.13.21.53.movCurrently investigating one bug where on web when selecting the whole text, deleting it, and then typing the full text reappears with the new text prefixed |
|
Okay, pushed a fix. Next bug I am looking into is when pasting the content is currently doubled: Screen.Recording.2024-07-05.at.13.35.39.mov |
|
Hm, might be a regression that has been introduced here: |
|
Okay I just reverted the changes from the PR in the patch - it's working now. I think the pasting issue is a bug that needs to be handled separately once we upgrade live-markdown >= 0.1.92 |
|
Hi @hannojg, we worked recently on fixing double pasting issue and we found a fix for it. I will create a PR that with the changes and live-markdown bump to the latest version. Is it okay for you? |
Sure! 😊 |
|
TODO: The rn-live-markdown PR has just been merged. I need to update to version |
|
Added a PR here to fix one issue on the web: can you maybe have a look @Skalakid ? |
|
Found another bug in this PR on web:
|
|
Opened this PR to address the bug: |
|
I implemented a simpler solution over here: |
|
(we can reopen this PR in case the other PR wouldn't work for any reason) |
Details
(Slack thread)
This PR fixes an issue where the composer's text input wouldn't show the value the user expects. The following use case now works:
In react native the text input sends the whole text thats currently in the text input in the onChange/onChangeText event callbacks. However, we maintain the "source of truth" for our text input in JavaScript in our
valuereact state variable.So it can happen that we set our JS
valueto""to clear the input, but the native side is ignoring that event (as the JS thread is lagging behind in events), and sends us a new update with the current native input (which would be "aaaaaabbbbbb" by then).With the approach in this PR, we only apply the difference from the native side to our JS value. E.g. if the user pressed another "a", instead of setting the whole native text to our js
valuewe just append theathat was added.This way the native side might still ignore our clear event (setting the value to
""), but when the user presses another character like"b"it will be appended to our empty value"" + "b", and when the native side then processes this update, it shows correctly"b"instead of"aaaaaab".For this to work we need to receive the range in which the changes to the new active text have been made. This requires changes in
react-nativeand@expensify/react-native-live-markdown. Two patches have been added for which we have PRs here:onChangeevent react-native-live-markdown#412This PR bumps rn-live-markdown to include the changes necessary for this PR. Before merging this PR make sure to merge this one first:
TODO:
Investigate potential re-render loop:(Shouldn't be part of this PR, this PR didn't;t introduce it)@expensify/react-native-live-markdownFixed Issues
$#37896
$#44185
PROPOSAL:
Tests
Offline tests
n/a
QA Steps
Same as testing steps
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)myBool && <MyComponent />.src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
android_native.webm
Android: mWeb Chrome
Screen.Recording.2024-07-02.at.17.14.16.mov
iOS: Native
ios-native.mov
iOS: mWeb Safari
Screen.Recording.2024-07-02.at.17.15.43.mov
MacOS: Chrome / Safari
Screen.Recording.2024-07-02.at.17.11.44.mov
MacOS: Desktop
Screen.Recording.2024-07-02.at.17.18.58.mov