Expensify / App

Welcome to New Expensify: a complete re-imagination of financial collaboration, centered around chat. Help us build the next generation of Expensify by sharing feedback and contributing to the code.
https://new.expensify.com
MIT License
3.51k stars 2.87k forks source link

Android - Chat - Composer reduced with delay after sending message with several line breaks #51875

Open lanitochka17 opened 18 hours ago

lanitochka17 commented 18 hours ago

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Version Number: 9.0.56-2 Reproducible in staging?: Y Reproducible in production?: Y If this was caught on HybridApp, is this reproducible on New Expensify Standalone?: Y If this was caught during regression testing, add the test name, ID and link from TestRail: https://expensify.testrail.io/index.php?/tests/view/5171395&group_by=cases:section_id&group_order=asc&group_id=292106 Issue reported by: Applause - Internal Team

Action Performed:

  1. Open the Expensify app
  2. Open any chat
  3. Write a message with at least ten line breaks
  4. Send the message to chat
  5. Verify that compose box is automatically reduced after sending the message

Expected Result:

Compose box should be automatically reduced after sending message with several line breaks

Actual Result:

After sending a message with ten or more line breaks, compose box is reduced with delay. It can be seen expanded without any message inside for a second

Workaround:

Unknown

Platforms:

Which of our officially supported platforms is this issue occurring on?

Screenshots/Videos

Add any screenshot/video evidence

https://github.com/user-attachments/assets/5a5899e2-d615-4e0a-a884-db59a381ad79

View all open jobs on GitHub

melvin-bot[bot] commented 18 hours ago

Triggered auto assignment to @bfitzexpensify (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.

lanitochka17 commented 18 hours ago

@bfitzexpensify FYI I haven't added the External label as I wasn't 100% sure about this issue. Please take a look and add the label if you agree it's a bug and can be handled by external contributors

QichenZhu commented 4 hours ago

Proposal

Please re-state the problem that we are trying to solve in this issue.

The composer height shrinks to its normal size with a delay after sending a long message.

What is the root cause of that problem?

We can notice two steps after sending a message: 1) the composer is cleared. 2) the expand button is removed. Between 1 and 2, there is an intermediate state that the composer is empty, but the expand button is still visible.

Screenshot 2024-11-02 at 7 00 20 PM

Some processes take place during this period, including 1) layout recalculation, 2) TextInput detecting layout changes and emitting the onContentSizeChange event, 3) the composer receiving the onContentSizeChange event,

https://github.com/Expensify/App/blob/bef062b4caa7f665159dc107911e708031e648c4/src/components/Composer/implementation/index.native.tsx#L121

4) setting isFullComposerAvailable to false,

https://github.com/Expensify/App/blob/bef062b4caa7f665159dc107911e708031e648c4/src/libs/ComposerUtils/updateIsFullComposerAvailable.ts#L19

and 5) removing the expand button.

https://github.com/Expensify/App/blob/bef062b4caa7f665159dc107911e708031e648c4/src/pages/home/report/ReportActionCompose/AttachmentPickerWithMenuItems.tsx#L271-L272

What changes do you think we should make in order to solve the problem?

Directly set isFullComposerAvailable to false after the composer is cleared by adding setIsFullComposerAvailable(false) in the composer’s onClear event handler.

https://github.com/Expensify/App/blob/bef062b4caa7f665159dc107911e708031e648c4/src/components/Composer/implementation/index.native.tsx#L85

What alternative solutions did you explore? (Optional)

N/A