Fix scrolling issues caused by performance branch (#4285)

Этот коммит содержится в:
Joram Wilander
2016-10-20 14:26:15 -04:00
коммит произвёл Corey Hulen
родитель 6d7da26af0
Коммит 0c663216cc

Просмотреть файл

@@ -392,15 +392,15 @@ export default class PostList extends React.Component {
if (this.props.scrollType === ScrollTypes.BOTTOM) { if (this.props.scrollType === ScrollTypes.BOTTOM) {
this.scrollToBottom(); this.scrollToBottom();
} else if (this.props.scrollType === ScrollTypes.NEW_MESSAGE) { } else if (this.props.scrollType === ScrollTypes.NEW_MESSAGE) {
window.setTimeout(window.requestAnimationFrame(() => { window.requestAnimationFrame(() => {
// If separator exists scroll to it. Otherwise scroll to bottom. // If separator exists scroll to it. Otherwise scroll to bottom.
if (this.refs.newMessageSeparator) { if (this.refs.newMessageSeparator) {
var objDiv = this.refs.postlist; var objDiv = this.refs.postlist;
objDiv.scrollTop = this.refs.newMessageSeparator.offsetTop; //scrolls node to top of Div objDiv.scrollTop = this.refs.newMessageSeparator.offsetTop; //scrolls node to top of Div
} else if (this.refs.postlist) { } else if (this.refs.postlist) {
this.refs.postlist.scrollTop = this.refs.postlist.scrollHeight; this.scrollToBottom();
} }
}), 0); });
} else if (this.props.scrollType === ScrollTypes.POST && this.props.scrollPostId) { } else if (this.props.scrollType === ScrollTypes.POST && this.props.scrollPostId) {
window.requestAnimationFrame(() => { window.requestAnimationFrame(() => {
const postNode = ReactDOM.findDOMNode(this.refs[this.props.scrollPostId]); const postNode = ReactDOM.findDOMNode(this.refs[this.props.scrollPostId]);