fix input changes

This commit is contained in:
SrGooglo 2022-12-14 19:10:30 +00:00
parent 6522894530
commit 128f09a973

View File

@ -107,6 +107,10 @@ export default class LiveChat extends React.Component {
} }
handleInputChange = (e) => { handleInputChange = (e) => {
if (e.target.value[0] === " " || e.target.value[0] === "\n") {
e.target.value = e.target.value.slice(1)
}
this.setState({ this.setState({
writtedMessage: e.target.value writtedMessage: e.target.value
}) })
@ -124,12 +128,13 @@ export default class LiveChat extends React.Component {
} }
scrollTimelineToBottom = () => { scrollTimelineToBottom = () => {
// scroll to bottom smoothly if (this.timelineRef.current) {
this.timelineRef.current.scrollTo({ this.timelineRef.current.scrollTo({
top: this.timelineRef.current.scrollHeight, top: this.timelineRef.current.scrollHeight,
behavior: "smooth" behavior: "smooth"
}) })
} }
}
componentDidMount = async () => { componentDidMount = async () => {
await this.joinSocketRoom() await this.joinSocketRoom()