prevent error for empty list
This commit is contained in:
parent
eb4220a836
commit
9fa7990996
1 changed files with 3 additions and 1 deletions
|
@ -759,8 +759,10 @@ module.exports = createReactClass({
|
||||||
_getMessagesHeight() {
|
_getMessagesHeight() {
|
||||||
const itemlist = this.refs.itemlist;
|
const itemlist = this.refs.itemlist;
|
||||||
const lastNode = itemlist.lastElementChild;
|
const lastNode = itemlist.lastElementChild;
|
||||||
|
const lastNodeBottom = lastNode ? lastNode.offsetTop + lastNode.clientHeight : 0;
|
||||||
|
const firstNodeTop = itemlist.firstElementChild ? itemlist.firstElementChild.offsetTop : 0;
|
||||||
// 18 is itemlist padding
|
// 18 is itemlist padding
|
||||||
return (lastNode.offsetTop + lastNode.clientHeight) - itemlist.firstElementChild.offsetTop + (18 * 2);
|
return lastNodeBottom - firstNodeTop + (18 * 2);
|
||||||
},
|
},
|
||||||
|
|
||||||
_topFromBottom(node) {
|
_topFromBottom(node) {
|
||||||
|
|
Loading…
Reference in a new issue