Removed updateScrollBottom on Status, ScrollableList (fixes feed jumping?)
• Removed: - updateScrollBottom on Status, ScrollableList (fixes feed jumping?)
This commit is contained in:
parent
9ba03d2c94
commit
859b4b5ca8
@ -75,20 +75,6 @@ class ScrollableList extends React.PureComponent {
|
||||
this.handleScroll();
|
||||
}
|
||||
|
||||
getScrollPosition = () => {
|
||||
if (this.documentElement && (this.documentElement.scrollTop > 0 || this.mouseMovedRecently)) {
|
||||
return { height: this.documentElement.scrollHeight, top: this.documentElement.scrollTop };
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
updateScrollBottom = (snapshot) => {
|
||||
const newScrollTop = this.documentElement.scrollHeight - snapshot;
|
||||
|
||||
this.setScrollTop(newScrollTop);
|
||||
}
|
||||
|
||||
componentDidUpdate(prevProps, prevState, snapshot) {
|
||||
// Reset the scroll position when a new child comes in in order not to
|
||||
// jerk the scrollbar around if you're already scrolled down the page.
|
||||
@ -247,8 +233,6 @@ class ScrollableList extends React.PureComponent {
|
||||
>
|
||||
{
|
||||
React.cloneElement(child, {
|
||||
getScrollPosition: this.getScrollPosition,
|
||||
updateScrollBottom: this.updateScrollBottom,
|
||||
cachedMediaWidth: this.state.cachedMediaWidth,
|
||||
cacheMediaWidth: this.cacheMediaWidth,
|
||||
})
|
||||
|
@ -96,20 +96,6 @@ class Status extends ImmutablePureComponent {
|
||||
height: undefined,
|
||||
}
|
||||
|
||||
// Track height changes we know about to compensate scrolling
|
||||
componentDidMount() {
|
||||
const { isMuted, isHidden, status } = this.props
|
||||
this.didShowCard = !isMuted && !isHidden && status && status.get('card')
|
||||
}
|
||||
|
||||
getSnapshotBeforeUpdate() {
|
||||
if (this.props.getScrollPosition) {
|
||||
return this.props.getScrollPosition()
|
||||
}
|
||||
|
||||
return null
|
||||
}
|
||||
|
||||
static getDerivedStateFromProps(nextProps, prevState) {
|
||||
if (nextProps.isChild) return null
|
||||
|
||||
@ -131,7 +117,7 @@ class Status extends ImmutablePureComponent {
|
||||
}
|
||||
|
||||
// Compensate height changes
|
||||
componentDidUpdate(prevProps, prevState, snapshot) {
|
||||
componentDidUpdate(prevProps, prevState) {
|
||||
// timeline lazy loading comments
|
||||
if (!prevState.loadedComments && this.state.loadedComments && this.props.status && !this.props.isChild && this.props.contextType !== 'feature') {
|
||||
const commentCount = this.props.status.get('replies_count')
|
||||
@ -145,19 +131,6 @@ class Status extends ImmutablePureComponent {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const doShowCard = !this.props.isMuted && !this.props.isHidden && this.props.status && this.props.status.get('card')
|
||||
|
||||
if (doShowCard && !this.didShowCard) {
|
||||
this.didShowCard = true
|
||||
|
||||
if (snapshot !== null && this.props.updateScrollBottom) {
|
||||
if (this.node && this.node.offsetTop < snapshot.top) {
|
||||
// console.log("updateScrollBottom")
|
||||
this.props.updateScrollBottom(snapshot.height - snapshot.top)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
handleMoveUp = (id) => {
|
||||
@ -208,17 +181,6 @@ class Status extends ImmutablePureComponent {
|
||||
}
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
if (this.node && this.props.getScrollPosition) {
|
||||
const position = this.props.getScrollPosition()
|
||||
if (position !== null && this.node.offsetTop < position.top) {
|
||||
requestAnimationFrame(() => {
|
||||
this.props.updateScrollBottom(position.height - position.top)
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
handleToggleMediaVisibility = () => {
|
||||
this.setState({ showMedia: !this.state.showMedia })
|
||||
}
|
||||
@ -621,8 +583,6 @@ Status.propTypes = {
|
||||
onMoveDown: PropTypes.func,
|
||||
onFetchComments: PropTypes.func,
|
||||
onFetchContext: PropTypes.func,
|
||||
getScrollPosition: PropTypes.func,
|
||||
updateScrollBottom: PropTypes.func,
|
||||
cacheMediaWidth: PropTypes.func,
|
||||
cachedMediaWidth: PropTypes.number,
|
||||
contextType: PropTypes.string,
|
||||
|
Loading…
Reference in New Issue
Block a user