diff --git a/MessageList.js b/MessageList.js index a10b48d..3a44484 100644 --- a/MessageList.js +++ b/MessageList.js @@ -167,24 +167,24 @@ var MessageList = React.createClass({ }, getPageSize: function() { - return Math.round(this.refs.scroll.offsetHeight / (this.props.layout == 'message-on-right' ? 60 : 30)); + return Math.floor(this.refs.scroll.offsetHeight / (this.props.layout == 'message-on-right' ? 60 : 30)); }, getItemOffset: function(index) { - var n = 0, top = this.refs.title.offsetHeight, p; + var n = 0, top = 0, p; + var h = (this.props.layout == 'message-on-right' ? 60 : 30); for (var i = 0; i < (this.props.groups||[]).length; i++) { p = n; n += (i > 0 ? 1 : 0)+this.props.groups[i].messageCount; if (index < n) { - if (index > p) - top += (i > 0 ? 30 : 0) + (this.props.layout == 'message-on-right' ? 60 : 30)*(index-p-1); + top += (index > p && i > 0 ? 30+h*(index-p-1) : h*(index-p)); break; } - top += (i > 0 ? 30 : 0) + (this.props.layout == 'message-on-right' ? 60 : 30)*this.props.groups[i].messageCount; + top += (i > 0 ? 30 : 0) + h*this.props.groups[i].messageCount; } - return [ top, (this.props.layout == 'message-on-right' && (index == 0 || index != p) ? 60 : 30) ]; + return [ top, index == p && i > 0 ? 30 : h ]; }, getScrollPaddingTop: function() { @@ -262,6 +262,14 @@ var MessageList = React.createClass({ })} + }, + componentDidMount: function() + { + window.addEventListener('resize', this.changeFirstDay); + }, + componentWillUnmount: function() + { + window.removeEventListener('resize', this.changeFirstDay); } }); diff --git a/MessageView.js b/MessageView.js index c7158e8..b737ae9 100644 --- a/MessageView.js +++ b/MessageView.js @@ -53,7 +53,6 @@ var MessageView = React.createClass({ }); } } - // TODO list attachments return