fix RTL in chat using react-virtualized
This commit is contained in:
parent
e23db63992
commit
dee84c1af9
@ -65,6 +65,7 @@ class MessageList extends Component {
|
||||
};
|
||||
|
||||
this.listRef = null;
|
||||
this.virualRef = null;
|
||||
|
||||
this.lastWidth = 0;
|
||||
}
|
||||
@ -74,9 +75,22 @@ class MessageList extends Component {
|
||||
scrollPosition,
|
||||
} = this.props;
|
||||
this.scrollTo(scrollPosition);
|
||||
|
||||
const { childNodes } = this.messageListWrapper;
|
||||
this.virualRef = childNodes ? childNodes[0].firstChild : null;
|
||||
|
||||
if (this.virualRef) {
|
||||
this.virualRef.style.direction = document.documentElement.dir;
|
||||
}
|
||||
}
|
||||
|
||||
componentDidUpdate(prevProps) {
|
||||
if (this.virualRef) {
|
||||
if (this.virualRef.style.direction !== document.documentElement.dir) {
|
||||
this.virualRef.style.direction = document.documentElement.dir;
|
||||
}
|
||||
}
|
||||
|
||||
const {
|
||||
scrollPosition,
|
||||
chatId,
|
||||
@ -264,7 +278,7 @@ class MessageList extends Component {
|
||||
} = this.state;
|
||||
|
||||
return (
|
||||
[<div className={styles.messageListWrapper} key="chat-list" data-test="chatMessages">
|
||||
[<div className={styles.messageListWrapper} key="chat-list" data-test="chatMessages" ref={node => this.messageListWrapper = node}>
|
||||
<AutoSizer>
|
||||
{({ height, width }) => {
|
||||
if (width !== this.lastWidth) {
|
||||
|
Loading…
Reference in New Issue
Block a user