Prevent unnecessary wrapWidth updates
This commit is contained in:
parent
3b0734bb4d
commit
bb8a4d180e
File diff suppressed because one or more lines are too long
@ -32,14 +32,18 @@ export default class MessageBox extends PureComponent {
|
|||||||
|
|
||||||
listRef = el => { this.list = el; };
|
listRef = el => { this.list = el; };
|
||||||
|
|
||||||
updateWidth = () => {
|
updateWidth = (width) => {
|
||||||
const { isChannel, setWrapWidth, updateMessageHeight } = this.props;
|
const { isChannel, setWrapWidth, updateMessageHeight } = this.props;
|
||||||
let wrapWidth = this.width;
|
let wrapWidth = width || this.width;
|
||||||
|
|
||||||
if (isChannel) {
|
if (width) {
|
||||||
|
if (isChannel && window.innerWidth > 600) {
|
||||||
wrapWidth += 200;
|
wrapWidth += 200;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.width = wrapWidth;
|
||||||
|
}
|
||||||
|
|
||||||
// eslint-disable-next-line no-underscore-dangle
|
// eslint-disable-next-line no-underscore-dangle
|
||||||
const c = this.list.Grid._scrollingContainer;
|
const c = this.list.Grid._scrollingContainer;
|
||||||
if (c.scrollHeight > c.clientHeight) {
|
if (c.scrollHeight > c.clientHeight) {
|
||||||
@ -54,8 +58,7 @@ export default class MessageBox extends PureComponent {
|
|||||||
};
|
};
|
||||||
|
|
||||||
handleResize = size => {
|
handleResize = size => {
|
||||||
this.width = size.width - 30;
|
this.updateWidth(size.width - 30);
|
||||||
this.updateWidth();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
handleScroll = ({ scrollTop, clientHeight, scrollHeight }) => {
|
handleScroll = ({ scrollTop, clientHeight, scrollHeight }) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user