Android - Fix scroll on requesting money#31649
Conversation
|
@narefyev91 Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
|
@narefyev91 I was unable to test on |
| } | ||
|
|
||
| flatListRef.current.scrollToOffset({animated: false, offset: 0}); | ||
| setTimeout(() => { |
There was a problem hiding this comment.
@esh-g can you please add description why we could not avoid using setTimeout.. did you also try to avoid using it? Just to be 100% sure that we tried everything
There was a problem hiding this comment.
can we use maybe here InteractionManager.runAfterInteractions - is should works well with native side - can you try that?
There was a problem hiding this comment.
@narefyev91 After some more digging, I found the actual root cause! (very sneaky)
We are using a custom Flatlist for android and it saves the last scrolled point and goes to it after it comes into focus...
When the navigation modal is dismissed, this scrolls to the last scrolled point and prevents the reportScrollManager from working correctly...
There was a problem hiding this comment.
good point - i think we can fix that inside specific flatlist for android - can you try to do it?
There was a problem hiding this comment.
The current logic seems to be that whenever we scroll the list, the offset is saved and when list is refocused, that offset it set again.
Here are some things that I can brainstorm:
- We can modify the flatlist to make the
scrollPositionavailable publicly (possibly with context) instead of using just state and then set thescrollPositionto0when dismissing modal
- We can somehow prevent the offset from taking place after the focus
But still exploring the options
|
Hey @esh-g any updates here? |
|
@narefyev91 I pushed a commit to use the context for |
| Navigation.dismissModal(isMoneyRequestReport ? report.reportID : chatReport.reportID); | ||
| Report.notifyNewAction(chatReport.reportID, payeeAccountID); | ||
| Navigation.dismissModal(activeReportID); | ||
| Report.notifyNewAction(activeReportID, payeeAccountID); |
There was a problem hiding this comment.
why do we change that from chatReport.reportID to activeReportID? Can you please explain
There was a problem hiding this comment.
@narefyev91 We are always subscribed to the report opened in the report screen here:
So when we are in an expense report, chatReport.reportID which corresponds to currentChatReport passed to getMoneyRequestInformation
const currentChatReport = isMoneyRequestReport ? ReportUtils.getReport(report.chatReportID) : report;So, currentChatReport actually becomes the original report with the other person and not the IOU or expense report. This means that when we notify a new action, we do it on parent report and not the actual expense report when using chatReport.reportID.
This is why we modified the Navigation.dismissModal line to use a different reportID so that the user is redirected to the expense report from where they requested the money. The same logic should be used for notifyNewAction.
Reviewer Checklist
Screenshots/VideosWeb8mb.video-ji3-eNJbUG79.mp4Mobile Web - Chromeandroid-web.mp4Mobile Web - Safariios-web.mp4Desktopdesktop.mp4iOSios.mp4Androidandroid.mp4 |
narefyev91
left a comment
There was a problem hiding this comment.
LGTM!
Nice that we were able to avoid usage of setTimeout!
🎀 👀 🎀 C+ reviewed
marcochavezf
left a comment
There was a problem hiding this comment.
Thank you guys! LGTM, good job for avoiding the setTimeout!
|
✋ 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 production by https://github.com/mountiny in version: 1.4.6-2 🚀
|
Details
Fixed Issues
$ #31373
PROPOSAL: #31373 (comment)
Tests
Offline tests
QA Steps
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)myBool && <MyComponent />.src/languages/*files and using the translation methodWaiting for Copylabel for a copy review on the original GH to get the correct copy.STYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG))Avataris modified, I verified thatAvataris working as expected in all cases)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
Screen.Recording.2023-11-21.at.10.45.25.PM-1.mov
Android: mWeb Chrome
iOS: Native
Screen.Recording.2023-11-21.at.11.17.19.PM.mov
iOS: mWeb Safari
Screen.Recording.2023-11-21.at.10.43.11.PM.mov
MacOS: Chrome / Safari
Screen.Recording.2023-11-21.at.10.40.09.PM-1.mov
MacOS: Desktop
Screen.Recording.2023-11-21.at.11.11.12.PM.mov