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

[$500] Request Money - Conversation is not scrolled to the bottom when request money #22367

Closed
2 of 6 tasks
lanitochka17 opened this issue Jul 6, 2023 · 54 comments
Closed
2 of 6 tasks
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor Help Wanted Apply this label when an issue is open to proposals by contributors

Comments

@lanitochka17
Copy link

lanitochka17 commented Jul 6, 2023

If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!


Action Performed:

  1. Navigate to a 1:1 conversation
  2. Scroll a moderate amount of the conversation history so the latest message is not visible
  3. On the compose box - Click the + button
  4. Click on request money and finish the IOU flow

Expected Result:

The conversation should be scrolled to the bottom and the latest message (IOU) should be visible

Actual Result:

The conversation is not scrolled to the bottom when Request Money

Workaround:

Unknown

Platforms:

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

  • Android / native
  • Android / Chrome
  • iOS / native
  • iOS / Safari
  • MacOS / Chrome / Safari
  • MacOS / Desktop

Version Number: 1.3.37.2

Reproducible in staging?: Yes

Reproducible in production?: Yes

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

Notes/Photos/Videos: Any additional supporting documentation

Bug6118824_az_recorder_20230706_192749.mp4

Expensify/Expensify Issue URL:

Issue reported by: Applause - Internal Team

Slack conversation:

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~016ec292c1dce29715
  • Upwork Job ID: 1677287906884644864
  • Last Price Increase: 2023-09-12
@lanitochka17 lanitochka17 added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Jul 6, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jul 6, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Jul 6, 2023

Bug0 Triage Checklist (Main S/O)

  • This "bug" occurs on a supported platform (ensure Platforms in OP are ✅)
  • This bug is not a duplicate report (check E/App issues and #expensify-bugs)
    • If it is, comment with a link to the original report, close the issue and add any novel details to the original issue instead
  • This bug is reproducible using the reproduction steps in the OP. S/O
    • If the reproduction steps are clear and you're unable to reproduce the bug, check with the reporter and QA first, then close the issue.
    • If the reproduction steps aren't clear and you determine the correct steps, please update the OP.
  • This issue is filled out as thoroughly and clearly as possible
    • Pay special attention to the title, results, platforms where the bug occurs, and if the bug happens on staging/production.
  • I have reviewed and subscribed to the linked Slack conversation to ensure Slack/Github stay in sync

@PrashantMangukiya
Copy link
Contributor

PrashantMangukiya commented Jul 7, 2023

Proposal

Posting proposal early as per new guidelines

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

Conversation is not scrolled to the bottom when request money

What is the root cause of that problem?

We are not scrolling chat to bottom during request money as shown below.

onConfirm={createTransaction}

const createTransaction = useCallback(
(selectedParticipants) => {
const trimmedComment = props.iou.comment.trim();
// IOUs created from a group report will have a reportID param in the route.
// Since the user is already viewing the report, we don't need to navigate them to the report
if (iouType.current === CONST.IOU.MONEY_REQUEST_TYPE.SPLIT && CONST.REGEX.NUMBER.test(reportID.current)) {
IOU.splitBill(
selectedParticipants,
props.currentUserPersonalDetails.login,
props.currentUserPersonalDetails.accountID,
props.iou.amount,
trimmedComment,
props.iou.currency,
reportID.current,
);
return;
}
// If the request is created from the global create menu, we also navigate the user to the group report
if (iouType.current === CONST.IOU.MONEY_REQUEST_TYPE.SPLIT) {
IOU.splitBillAndOpenReport(
selectedParticipants,
props.currentUserPersonalDetails.login,
props.currentUserPersonalDetails.accountID,
props.iou.amount,
trimmedComment,
props.iou.currency,
);
return;
}
IOU.requestMoney(
props.report,
props.iou.amount,
props.iou.currency,
props.currentUserPersonalDetails.login,
props.currentUserPersonalDetails.accountID,
selectedParticipants[0],
trimmedComment,
);
},
[props.iou.amount, props.iou.comment, props.currentUserPersonalDetails.login, props.currentUserPersonalDetails.accountID, props.iou.currency, props.report],
);

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

We have to scroll to bottom (line 198) during confirm as shown below:

onConfirm={selectedParticipants => {
    createTransaction(selectedParticipants);
    ReportActionComposeFocusManager.focus()
}}

What alternative solutions did you explore? (Optional)

We can also scroll to bottom within createTransaction as shown below:

const createTransaction = useCallback(
    (selectedParticipants) => {
        ...
        if (iouType.current === CONST.IOU.MONEY_REQUEST_TYPE.SPLIT && CONST.REGEX.NUMBER.test(reportID.current)) {
            IOU.splitBill(
                ...
            );
            ReportActionComposeFocusManager.focus() // *** ADD THIS ***
            return;
        }

        if (iouType.current === CONST.IOU.MONEY_REQUEST_TYPE.SPLIT) {
            IOU.splitBillAndOpenReport(
                ...
            );
            ReportActionComposeFocusManager.focus() // *** ADD THIS ***
            return;
        }

        IOU.requestMoney(
            ...
        );
        ReportActionComposeFocusManager.focus() // *** ADD THIS ***
    },
    [...],
);
Results
Web.mov

@NicMendonca NicMendonca added the External Added to denote the issue can be worked on by a contributor label Jul 7, 2023
@melvin-bot melvin-bot bot changed the title Request Money - Conversation is not scrolled to the bottom when request money [$1000] Request Money - Conversation is not scrolled to the bottom when request money Jul 7, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jul 7, 2023

Job added to Upwork: https://www.upwork.com/jobs/~016ec292c1dce29715

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Jul 7, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jul 7, 2023

Triggered auto assignment to @lschurr (External), see https://stackoverflow.com/c/expensify/questions/8582 for more details.

@melvin-bot
Copy link

melvin-bot bot commented Jul 7, 2023

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

@hoangzinh
Copy link
Contributor

hoangzinh commented Jul 7, 2023

Proposal

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

Request Money - Conversation is not scrolled to the bottom when request money on small screen devices

What is the root cause of that problem?

In the end of money request action, we already trigger Report.notifyNewAction, which will trigger reportScrollManager.scrollToBottom() here

if (isFromCurrentUser) {
reportScrollManager.scrollToBottom();

In the large screen devices, it works as expected. But in small screen devices, we have transition animation to close Request money page, and also open the Keyboard when focus on chat composer. So the reportScrollManager.scrollToBottom won't work properly.

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

I think in small screen devices, we need to wait the animation transition before the scroll to bottom. In order to do that, we can:

@tienifr
Copy link
Contributor

tienifr commented Jul 8, 2023

Proposal

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

The conversation is not scrolled to the bottom when Request Money

What is the root cause of that problem?

When we scroll to the bottom here

reportScrollManager.scrollToBottom();
after receiving the new report action, it's being done at the same time as many other animations like screen transition, keyboard opening, ... for small screens. So the scrollToOffset API that is used doesn't work.

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

We can just wrap this line inside InteractionManager.runAfterInteractions to make sure it's run after the other animations completed.

What alternative solutions did you explore? (Optional)

NA

@s77rt
Copy link
Contributor

s77rt commented Jul 9, 2023

This issue is for Android/Native only right? Asking because the issue description says Android/Chrome? Assuming it's on Android/Native only, I think we can put this one on hold for #15964. The root cause seems that calling the scroll function while another animation is ongoing will do nothing. We have this commit facebook/react-native@681b35d that aborts the ongoing animation before making a new one. It may fix this issue, it would be glad if anyone can test that.

@melvin-bot melvin-bot bot added the Overdue label Jul 9, 2023
@tienifr
Copy link
Contributor

tienifr commented Jul 10, 2023

@s77rt It's on mWeb both in Android and iOS, not Android/Native I believe.

@hoangzinh
Copy link
Contributor

yeah, in small screen devices

@NicMendonca
Copy link
Contributor

@allroundexperts any thoughts here?

@melvin-bot melvin-bot bot removed the Overdue label Jul 10, 2023
@allroundexperts
Copy link
Contributor

@NicMendonca We're still discussing this internally here.

@allroundexperts
Copy link
Contributor

Okay. I went into this further and it seems like our root cause here is not correct. I tried to disable the autoFocus on the composer and added a log to the screen transition end. The scroll was being called AFTER the transition ended so I can not see how this is related to the animations. @hoangzinh or @tienifr can you do the same on your side and post a video if it works after removing the animations?

@tienifr
Copy link
Contributor

tienifr commented Jul 13, 2023

Actually the scroll was called BEFORE RequestMoneyConfirmationPage was unmounted. Also there was a closing screen transition happening while the page unmounted. This transition will conflict with the scroll and thus it won't work. The onEntryTransitionEnd that you've tested with is only triggered when navigating to that page, not closing.

@melvin-bot melvin-bot bot added the Overdue label Jul 13, 2023
@s77rt
Copy link
Contributor

s77rt commented Jul 13, 2023

@tienifr If we keep this page RequestMoneyConfirmationPage mounted i.e. do not dismiss the modal, will the scroll work correctly? Also anyone tested this against Freeze i.e. disable Freeze functionality?

@tienifr
Copy link
Contributor

tienifr commented Jul 14, 2023

@s77rt @allroundexperts After digging deep into the behavior of react navigation I found out that in small screen, when users open RHN, it will set display:none for ReportScreen and it just changes to flex when the RHNs totally hide. As I mentioned above the scroll was called BEFORE RequestMoneyConfirmationPage was unmounted so scroll action is performing when display is none (no location on the page) => it doesn't work.

That why we should use InteractionManager.runAfterInteractions to wait for the the animations end and display changes to flex

@NicMendonca
Copy link
Contributor

@allroundexperts any feedback here?

@melvin-bot
Copy link

melvin-bot bot commented Sep 13, 2023

Triggered auto assignment to @madmax330, see https://stackoverflow.com/c/expensify/questions/7972 for more details.

@mvtglobally
Copy link

Issue not reproducible during KI retests. (Third week)

@melvin-bot melvin-bot bot added the Overdue label Sep 18, 2023
@NicMendonca
Copy link
Contributor

@madmax330 should I close this?

@melvin-bot melvin-bot bot removed the Overdue label Sep 18, 2023
@madmax330
Copy link
Contributor

I think we close after 4 weeks of not being reproducible

@tienifr
Copy link
Contributor

tienifr commented Sep 19, 2023

@NicMendonca @madmax330 Currently, after request/split money, users are not redirected to chat page. We already have the ticket to handle this #27724

I think we should hold this GH until the issue is fixed

@NicMendonca
Copy link
Contributor

@tienifr #27724 is fixed though!

@mvtglobally can you reproduce this?

@melvin-bot melvin-bot bot added the Overdue label Sep 25, 2023
@NicMendonca
Copy link
Contributor

bump bump @mvtglobally

@melvin-bot melvin-bot bot removed the Overdue label Sep 25, 2023
@mvtglobally
Copy link

Will provide feedback in a little bit

@mvtglobally
Copy link

Issue not reproducible during KI retests. (Fourth week) @NicMendonca

@lanitochka17
Copy link
Author

Issue reproducible on latest build 1.3.88-3

0-02-01-a925dfd72fb88a9cf3d4fe39d14845634e7cd89db2dbf7b0aea55c055c86ff9a_af5b384da4a76697.mp4

@lanitochka17 lanitochka17 reopened this Oct 21, 2023
@melvin-bot melvin-bot bot added the Overdue label Oct 21, 2023
@madmax330
Copy link
Contributor

Hmm I wonder if this will create a regression somewhere?

@melvin-bot melvin-bot bot added Overdue and removed Overdue labels Oct 23, 2023
@NicMendonca
Copy link
Contributor

@madmax330 or maybe a regression re-caused this? 🤔 (since it was fixed for quite a while) Let me know how you think we should proceed!

@melvin-bot melvin-bot bot removed the Overdue label Oct 26, 2023
@madmax330
Copy link
Contributor

Yes we're modifying a lot for the money 2020 and other waves right now, so I wouldn't be surprised

@melvin-bot melvin-bot bot added the Overdue label Oct 30, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 30, 2023

@madmax330, @NicMendonca, @allroundexperts Whoops! This issue is 2 days overdue. Let's get this updated quick!

@NicMendonca
Copy link
Contributor

@madmax330 so should I close, or leave open?

@melvin-bot melvin-bot bot removed the Overdue label Oct 30, 2023
@madmax330
Copy link
Contributor

Let's close for now, we can revisit this later

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor Help Wanted Apply this label when an issue is open to proposals by contributors
Projects
None yet
Development

No branches or pull requests

10 participants