Merge pull request #2600 from mattermost/new-messages-fix

PLT-2473 Fixing new messages jump
Этот коммит содержится в:
Harrison Healey
2016-04-01 10:23:50 -04:00
родитель d4442b002e 1788070f87
Коммит 5e307532d8

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

@@ -308,7 +308,7 @@ export default class PostsView extends React.Component {
if (this.props.scrollType === PostsView.SCROLL_TYPE_BOTTOM) { if (this.props.scrollType === PostsView.SCROLL_TYPE_BOTTOM) {
this.scrollToBottom(); this.scrollToBottom();
} else if (this.props.scrollType === PostsView.SCROLL_TYPE_NEW_MESSAGE) { } else if (this.props.scrollType === PostsView.SCROLL_TYPE_NEW_MESSAGE) {
window.requestAnimationFrame(() => { window.setTimeout(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;
@@ -316,7 +316,7 @@ export default class PostsView extends React.Component {
} else if (this.refs.postlist) { } else if (this.refs.postlist) {
this.refs.postlist.scrollTop = this.refs.postlist.scrollHeight; this.refs.postlist.scrollTop = this.refs.postlist.scrollHeight;
} }
}); }), 0);
} else if (this.props.scrollType === PostsView.SCROLL_TYPE_POST && this.props.scrollPostId) { } else if (this.props.scrollType === PostsView.SCROLL_TYPE_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]);