Skip to content

Instantly share code, notes, and snippets.

@spg
Last active July 27, 2020 16:10
Show Gist options
  • Save spg/748213665c644d9ad951bff117c534e2 to your computer and use it in GitHub Desktop.
Save spg/748213665c644d9ad951bff117c534e2 to your computer and use it in GitHub Desktop.
export class LongMessage extends React.Component {
componentDidMount() {
const newMessagesIndicator = document.getElementsByClassName('bpw-new-messages-indicator')[0]
// If the "New Messages" div is present, we should not auto-scroll
if (!newMessagesIndicator) {
const messagesList = document.getElementsByClassName('bpw-msg-list')[0]
messagesList.scrollTop = messagesList.scrollHeight
}
}
render() {
return (
<div>
{this.props.children} line 1<br />
line 1<br />
line 2<br />
line 3<br />
line 4<br />
line 5<br />
line 6<br />
line 7<br />
</div>
)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment