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.
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.
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.
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? |
|
|
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
scrollToBottomfunction.ReportScrollManager.scrollToIndexisn't work correctly in web because it has different behavior scroll from native.Fixed Issues
$ #11584
Tests
PR Review Checklist
PR Author Checklist
### Fixed Issuessection aboveTestssectionQA stepssectiontoggleReportand notonIconClick)src/languages/*filesWaiting 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)/** comment above it */thisproperly so there are no scoping issues (i.e. foronClick={this.submit}the methodthis.submitshould be bound tothisin the constructor)thisare necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);ifthis.submitis never passed to a component event handler likeonClick)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG)Avataris modified, I verified thatAvataris 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 Issuessection aboveTestssectionQA stepssectiontoggleReportand notonIconClick).src/languages/*filesSTYLE.md) were followedAvatar, I verified the components usingAvatarhave been tested & I retested again)/** comment above it */displayNamepropertythisproperly so there are no scoping issues (i.e. foronClick={this.submit}the methodthis.submitshould be bound tothisin the constructor)thisare necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);ifthis.submitis never passed to a component event handler likeonClick)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG)Avataris modified, I verified thatAvataris 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