-
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
fix: 11584 web jump to unread message #12124
fix: 11584 web jump to unread message #12124
Conversation
Same here |
flatListRef.current.scrollToIndex(index); | ||
const sizeMap = flatListRef.current.props.sizeMap; | ||
const clientHeight = flatListRef.current.getScrollableNode().clientHeight; | ||
const paddingTop = parseFloat(flatListRef.current.getScrollableNode().childNodes[0].style.paddingTop || '0px'); |
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.
We should access nested properties using lodashGet
More details in STYLING.md
const clientHeight = flatListRef.current.getScrollableNode().clientHeight; | ||
const paddingTop = parseFloat(flatListRef.current.getScrollableNode().childNodes[0].style.paddingTop || '0px'); | ||
const sizeArray = _.map(_.values(sizeMap), s => s.length); | ||
const sumNum = _.reduce(sizeArray.slice(0, (index.index)), (acc, val) => acc + val); |
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.
Please give variables a bit more readable names, could we rename sumNum
to something like a currentOffset
?
const sumNum = _.reduce(sizeArray.slice(0, (index.index)), (acc, val) => acc + val); | ||
flatListRef.current.scrollToOffset({ | ||
animated: index.animated, | ||
offset: (sumNum + paddingTop + (index.viewOffset || 0)) - (clientHeight * (index.viewPosition || 0)), |
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.
I think we should have offset as a separate variable for the ease of reading and debugging
comst offset = sumNum + paddingTop + (index.viewOffset || 0)) - (clientHeight * (index.viewPosition || 0);
flatListRef.current.scrollToOffset({animated: index.animated, offset});
@eVoloshchak Thanks for noting, I just fixed your comment, Could you help to check again? |
|
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.
lgtm!
The reviewer will copy/paste it into a new comment and complete it after the author checklist is completed
|
@srikarparsi looks like this was merged without the checklist test passing. Please add a note explaining why this was done and remove the |
checklist is finished |
🚀 Deployed to staging by @srikarparsi in version: 1.2.21-4 🚀
|
🚀 Deployed to production by @Julesssss in version: 1.2.21-4 🚀
|
Details
scrollToBottom
function.ReportScrollManager.scrollToIndex
isn't work correctly in web because it has different behavior scroll from native.Fixed Issues
$ #11584
Tests
PR Review Checklist
PR Author Checklist
### Fixed Issues
section aboveTests
sectionQA steps
sectiontoggleReport
and notonIconClick
)src/languages/*
filesWaiting 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)QA Steps
PR Reviewer Checklist
The reviewer will copy/paste it into a new comment and complete it after the author checklist is completed
### Fixed Issues
section aboveTests
sectionQA steps
sectiontoggleReport
and notonIconClick
).src/languages/*
filesSTYLE.md
) were followedAvatar
, I verified the components usingAvatar
have been tested & I retested again)/** comment above it */
displayName
propertythis
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)QA Steps
Screenshots
Web
afterUpdate.mp4
Mobile Web - Chrome
jumpChrome.mp4
Mobile Web - Safari
jumpSafari.mp4
Desktop
jumpDesktop.mp4
iOS
jump.mp4
Android
jumpMobile.mp4