Skip to content

Commit 086af42

Browse files
committed
fix(Sticky): remove gab between component and StickyScrollUp
When scrolling fast and the page is not updated fast enought the sticky offset is calculated before the position fixed is set for the StickyScrollUp component. In this situation a gap between the elements will appear. By setting the offset the the height (which is always the highest value possible) prevents this to happening.
1 parent 4d59423 commit 086af42

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/StickyProvider.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export default class StickyScrollUpProvider extends React.PureComponent {
3737
};
3838

3939
updateStickyOffset = (stickyOffset: number, height: number) => {
40-
this.stickyOffset.top = stickyOffset;
40+
this.stickyOffset.top = Math.min(stickyOffset, height);
4141
this.stickyOffset.height = height;
4242
};
4343

0 commit comments

Comments
 (0)