Skip to content

[HOLD for payment 2024-03-04] [$500] iOS-Chat not scrolled to bottom if delete last message by edit > clear comment > apply changes #35835

Closed

Description

@lanitochka17

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: 1.4.36-1
Reproducible in staging?: Y
Reproducible in production?: Y
If this was caught during regression testing, add the test name, ID and link from TestRail:
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Expensify/Expensify Issue URL:
Issue reported by: Applause - Internal Team
Slack conversation:

Action Performed:

  1. Log in to New Expensify
  2. Navigate to a chat with a few messages
  3. Hold last message
  4. Tap Edit message
  5. Clear compose box
  6. Tap apply changes

Expected Result:

The edited message should be deleted, and chat history should be scrolled to the very bottom

Actual Result:

The edited message is deleted, but chat history is not scrolled to the bottom. There is one or two messages below

Workaround:

Unknown

Platforms:

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

  • Android: Native
  • Android: mWeb Chrome
  • iOS: Native
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Add any screenshot/video evidence

Bug6367929_1707148265687.OVKO5302.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01a3b81b8f8d63b5f3
  • Upwork Job ID: 1754543250858106880
  • Last Price Increase: 2024-02-05
  • Automatic offers:
    • jeremy-croff | Contributor | 0

Activity

  1. added
    External
    Daily
    Bug
    on Feb 5, 2024
  2. changed the title [-]iOS-Chat not scrolled to bottom if delete last message by edit > clear comment > apply changes[/-] [+][$500] iOS-Chat not scrolled to bottom if delete last message by edit > clear comment > apply changes[/+] on Feb 5, 2024
  3. melvin-bot commented on Feb 5, 2024

    @melvin-bot
  4. added
    Help Wanted
    on Feb 5, 2024
  5. melvin-bot commented on Feb 5, 2024

    @melvin-bot

    Triggered auto assignment to Contributor-plus team member for initial proposal review - @allroundexperts (External)

  6. melvin-bot commented on Feb 5, 2024

    @melvin-bot

    Triggered auto assignment to @stephanieelliott (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.

  7. jeremy-croff commented on Feb 6, 2024

    @jeremy-croff
    Contributor

    Proposal

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

    We don't presreve the scroll position after deleting a message through the edit flow.

    What is the root cause of that problem?

    Only in IOS, we are maintaing focus on the composer. So the keyboard shows up during edit, shifts the scroll. After delete, we don't have the keyboard, and the scroll position is lost. On other platforms we focus the composer and the keyboard gets shown again, preserving the scroll.

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

    We have a nice utility to preserve the scroll
    reportScrollManager.scrollToIndex(index, false);

    Using this utility after the delete draft here:


    will preserve the correct scroll position and address this issue.

    But how do we reconcile the logic with the existing scroll listeners on keyboard hide?
    I looked closely at the conditions for the existing reportScrollManager.scrollToIndex(index, false); here

    if (index === 0) {
    const keyboardDidHideListener = Keyboard.addListener('keyboardDidHide', () => {
    reportScrollManager.scrollToIndex(index, false);
    keyboardDidHideListener.remove();
    });

    And confirmed that this will run when scrolled all the way to the bottom, and when edited a message to a new message.
    By removing the boundaries when that runs, and always running that, it will ensure the messages are always visible. In both that use case, and this use case.

    What alternative solutions did you explore? (Optional)#

    • Focus the composer and show keyboard after edit on IOS as well.
    • Or specific logic to call reportScrollManager.scrollToIndex(index, false); when deleting the message in the edit flow
  8. HarshMohanSason commented on Feb 6, 2024

    @HarshMohanSason

    Did you try using the scrollToEnd() method provided by the ScrollView component? That should solve this case if all you need to do is to just scroll at the bottom each time a message edit was successful.

  9. melvin-bot commented on Feb 6, 2024

    @melvin-bot

    📣 @HarshMohanSason! 📣
    Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork.
    Please follow these steps:

    1. Make sure you've read and understood the contributing guidelines.
    2. Get the email address used to login to your Expensify account. If you don't already have an Expensify account, create one here. If you have multiple accounts (e.g. one for testing), please use your main account email.
    3. Get the link to your Upwork profile. It's necessary because we only pay via Upwork. You can access it by logging in, and then clicking on your name. It'll look like this. If you don't already have an account, sign up for one here.
    4. Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details.
      Screen Shot 2022-11-16 at 4 42 54 PM
      Format:
    Contributor details
    Your Expensify account email: <REPLACE EMAIL HERE>
    Upwork Profile Link: <REPLACE LINK HERE>
    
  10. jeremy-croff commented on Feb 6, 2024

    @jeremy-croff
    Contributor

    Did you try using the scrollToEnd() method provided by the ScrollView component? That should solve this case if all you need to do is to just scroll at the bottom each time a message edit was successful.

    You don't want want to scroll down if you are editing something in history.

  11. HarshMohanSason commented on Feb 7, 2024

    @HarshMohanSason

    Did you try using the scrollToEnd() method provided by the ScrollView component? That should solve this case if all you need to do is to just scroll at the bottom each time a message edit was successful.

    You don't want want to scroll down if you are editing something in history.

    I meant call the function after the delete is completed by setting a flag to know if it has been finished or not.

    The solutions you have provided where "Or specific logic to call reportScrollManager.scrollToIndex(index, false); when deleting the message in the edit flow". You can try using a trigger function which is called whenever the keyboard is opened so it saves that position. Then you can have something like

    const getSavedScrollPosition = () => {
        return savedScrollPosition;
      };
      
      //and then use this savedScrollPosition in your logic
      
       if (index === 0) { 
         const keyboardDidHideListener = Keyboard.addListener('keyboardDidHide', () => { 
             const scrollPos = getSavedScrollPosition();
             //use this to scroll. 
             keyboardDidHideListener.remove(); 
         }); 
      
    
  12. 16 remaining items

  13. jeremy-croff commented on Feb 13, 2024

    @jeremy-croff
    Contributor

    @allroundexperts I'm looking for approval on the information above. I have a draft PR open and can finalize the checklist if this looks good.

  14. jeremy-croff commented on Feb 14, 2024

    @jeremy-croff
    Contributor

    @allroundexperts bumping this.

  15. allroundexperts commented on Feb 14, 2024

    @allroundexperts
    Contributor

    That's fine @jeremy-croff. Please open the PR so I can test it.

  16. added
    Weekly
    and removed
    Weekly
    on Feb 14, 2024
  17. jeremy-croff commented on Feb 14, 2024

    @jeremy-croff
    Contributor

    That's fine @jeremy-croff. Please open the PR so I can test it.

    I have opened the draft for review so you can test it.
    I will be in office, but at the end of my day in approx 12 hrs I can go through the checklist thoroughly and test.

  18. jeremy-croff commented on Feb 15, 2024

    @jeremy-croff
    Contributor

    Expecting to continue work on this in 12 hours

  19. jeremy-croff commented on Feb 16, 2024

    @jeremy-croff
    Contributor

    Ready for review!

  20. stephanieelliott commented on Feb 19, 2024

    @stephanieelliott
    Contributor

    Hey @allroundexperts looks like this is waiting on your review!

  21. stephanieelliott commented on Feb 27, 2024

    @stephanieelliott
    Contributor

    PR was deployed to staging

  22. stephanieelliott commented on Mar 5, 2024

    @stephanieelliott
    Contributor

    This was deployed to prod on 2/28, seems the automation didn't work so am updating manually

  23. changed the title [-][$500] iOS-Chat not scrolled to bottom if delete last message by edit > clear comment > apply changes[/-] [+][HOLD for payment 2024-03-04] [$500] iOS-Chat not scrolled to bottom if delete last message by edit > clear comment > apply changes[/+] on Mar 5, 2024
  24. stephanieelliott commented on Mar 6, 2024

    @stephanieelliott
    Contributor

    Summarizing payment on this issue:

    Upwork job is here: https://www.upwork.com/jobs/~1737876297360310272"

  25. JmillsExpensify commented on Mar 12, 2024

    @JmillsExpensify
    Contributor

    $500 approved for @allroundexperts based on summary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

BugExternalReviewingWeekly

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions