fix(status_list): Guard against missing ref (#4353)

This commit is contained in:
Sorin Davidoi 2017-07-25 02:13:05 +02:00 committed by Eugen Rochko
parent f52ce92f2b
commit 696bcff6bf

View File

@ -31,16 +31,18 @@ export default class StatusList extends ImmutablePureComponent {
intersectionObserverWrapper = new IntersectionObserverWrapper(); intersectionObserverWrapper = new IntersectionObserverWrapper();
handleScroll = debounce(() => { handleScroll = debounce(() => {
const { scrollTop, scrollHeight, clientHeight } = this.node; if (this.node) {
const offset = scrollHeight - scrollTop - clientHeight; const { scrollTop, scrollHeight, clientHeight } = this.node;
this._oldScrollPosition = scrollHeight - scrollTop; const offset = scrollHeight - scrollTop - clientHeight;
this._oldScrollPosition = scrollHeight - scrollTop;
if (250 > offset && this.props.onScrollToBottom && !this.props.isLoading) { if (250 > offset && this.props.onScrollToBottom && !this.props.isLoading) {
this.props.onScrollToBottom(); this.props.onScrollToBottom();
} else if (scrollTop < 100 && this.props.onScrollToTop) { } else if (scrollTop < 100 && this.props.onScrollToTop) {
this.props.onScrollToTop(); this.props.onScrollToTop();
} else if (this.props.onScroll) { } else if (this.props.onScroll) {
this.props.onScroll(); this.props.onScroll();
}
} }
}, 200, { }, 200, {
trailing: true, trailing: true,