-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Scroll To Last Index After Layout Change Of List #15662
Conversation
…t change from report actions list to handle index scroll adjustment after layout is changed
CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅ |
This comment was marked as off-topic.
This comment was marked as off-topic.
@danieldoglas 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] |
Assigning @puneetlath and @eVoloshchak since this is their issue. not sure why Melving added me. |
@puneetlath not sure why @eVoloshchak was remnoved from reviewers |
Lint Updates
Lint Updates
@puneetlath @eVoloshchak i have fixed lint issues |
@eVoloshchak can you take the first pass? |
Sure, reviewing in a couple of hours |
@Litande, please include videos for all the platforms. They aren't affected, but this is a good way to double-check that |
@eVoloshchak updated the videos on all platforms, should i request review again? it seems to remove users when i do it. Thanks. |
No, it remains visible in Review requests, so you don't have to request a review each time |
Reviewer Checklist
Screenshots/VideosWebScreen.Recording.2023-03-08.at.12.49.35.movMobile Web - Chromevideo_2023-03-08_12-56-11.mp4Mobile Web - SafariIMG_0006.MP4DesktopScreen.Recording.2023-03-08.at.12.53.55.moviOSIMG_0007.MP4Androidvideo_2023-03-08_12-56-07.mp4 |
} | ||
|
||
flatListRef.current.scrollToIndex(lastIndex); | ||
lastIndex = undefined; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to do this? I might be wrong, but I think we don't need to set lastIndex to undefined
and don't need the if (lastIndex === undefined)
check. Could you verify that, please?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The uncontrolled behavior requires this because the events aren't chained and can happen asynchronously the check validates and clearance of this value validates the action won't happen again if not actually needed
Co-authored-by: Eugene Voloshchak <copyreading@gmail.com>
Co-authored-by: Eugene Voloshchak <copyreading@gmail.com>
Co-authored-by: Eugene Voloshchak <copyreading@gmail.com>
@eVoloshchak updated everything and left comments |
@Litande, some of the links in your Screenshots/Videos are broken, there are no videos. Screen.Recording.2023-03-08.at.12.55.35.mov |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code looks good to me, tests well on iOS too.
There is the same behavior on Mobile Safari
, Web
and Desktop
(you can see it in videos here), but it was present before this PR (and it changes index.ios
file only). We probably need to tackle it as a separate issue.
cc: @puneetlath
@eVoloshchak will update the videos in a hour like this |
@eVoloshchak updated the videos. |
Hm, interesting. Will the solution for tackling it on those platforms be different? |
Yes. I've tried to apply the fix to all platforms, but the behavior is still the same |
Ok, that's interesting. Is there a more holistic solution that we could do that would fix the issue on iOS and other platforms? Or do we need to take a platform-specific approach? Don't worry @Litande, we'll pay you out for this no matter what direction we choose to go. I just want to make sure that this is indeed the best approach. |
I can try to check other platforms the question is what the expected behavior if on switch to edit to execute the scroll because in most of them it don't scroll at all as it seems |
@puneetlath, it turns out we explicitly disable the scroll if editing on web and desktop App/src/libs/ReportScrollManager/index.js Line 15 in f4ffc7c
function scrollToIndex(index, isEditing) {
if (isEditing) {
return;
}
flatListRef.current.scrollToIndex(index);
} I deleted this line and everything seems to work fine, but this logic was added for some reason.
|
@puneetlath @eVoloshchak it seems to me on web and desktop the assumption is that if an item is fully in view there is no need to scroll it, but it seems not to handle the edge cases (in case the item pressed is partially covered from top or bottom) also in general the "mobile - web" doesn't have a lot of space and those the same issue may happen much more frequently. |
Looks like you added that two years ago @yuwenmemon. Do you remember why that was? |
Yeah, we didn't want the scroll to move if you were editing. We just wanted you to be able to "edit in place" effectively. Small UX choice not sure if we're married to it anymore. |
Ah that makes sense. So like if new messages come in while you're editing, we don't want the comment you're editing to move. |
I'm still thinking, however, that we should try to solve this in a cross-platform way, rather than just doing it for iOS. What do you think @Litande and @eVoloshchak? |
The only thing we can do is remove
It works ok for me, haven't found any issues. |
@puneetlath, bump on the above |
@eVoloshchak @puneetlath i am ok with this, but not sure if the desition is correct from behavior point of view. |
@puneetlath, should we proceed with the current bevavior (scroll is disabled while editing on web/desktop) or enable it? |
My apologies for the delay! Not sure how this slipped through the cracks for me for so long. I think what we want ideally on all platforms:
I think we should approach that in a cross-platofrm way. So I think we should go ahead and pay out @Litande and @eVoloshchak for this, since the work that was initially agreed upon was done. But let's close the PR and open a new issue to handle this in a more cross-platform way. Thoughts on that approach @eVoloshchak? |
Yeah, I argee that should be the correct behavior |
Ok opened new issue here: #16601 |
Details
Added
layoutChange
function that will scroll to last index and fix position in case the original scroll happened before layout changed.Fixed Issues
$ 15303
PROPOSAL: 15303(COMMENT)
Tests
Note: this behavior is only related to IOS and impacts native behavior.
Offline tests
QA Steps
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)src/languages/*
files and using the translation methodWaiting for Copy
label for a copy review on the original GH to get the correct copy.STYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)/** comment above it */
this
properly so there are no scoping issues (i.e. foronClick={this.submit}
the methodthis.submit
should be bound tothis
in the constructor)this
are necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);
ifthis.submit
is never passed to a component event handler likeonClick
)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.Screenshots/Videos
Web
New.Expensify.-.8.March.2023.mp4
Mobile Web - Chrome
Android.Studio.-.Emulator.-.8.March.2023.mp4
Mobile Web - Safari
Simulator.-.iPhone.14.Pro.-.8.March.2023.mp4
Desktop
Electron.-.New.Expensify.-.8.March.2023.mp4
iOS
Simulator.-.iPhone.14.Pro.-.6.March.2023.mp4
Android
qemu-system-aarch64.-.Android.Emulator.-.Pixel_6_API_32_5554.-.6.March.2023.mp4