clear input field when changing topics

This commit is contained in:
or-else
2022-03-17 14:12:25 -07:00
parent 3d2af23f14
commit c9391cf451
9 changed files with 33 additions and 11 deletions
+1
View File
@@ -1216,6 +1216,7 @@ class MessagesView extends React.Component {
:
<SendMessage
tinode={this.props.tinode}
topicName={this.state.topic}
noInput={!!this.props.forwardMessage}
disabled={!this.state.isWriter || this.state.deleted}
onKeyPress={this.sendKeyPress}
+7 -1
View File
@@ -78,6 +78,12 @@ export default class AudioRecorder extends React.PureComponent {
}
}
componentWillUnmount() {
if (this.stream) {
this.cleanUp();
}
}
// Draw amplitude of sound.
visualize() {
this.initCanvas();
@@ -308,7 +314,7 @@ export default class AudioRecorder extends React.PureComponent {
return (
<div className="audio">
<a href="#" onClick={this.handleDelete} title="Delete">
<i className="material-icons">delete_outline</i>
<i className="material-icons gray">delete_outline</i>
</a>
{this.state.recording ?
<canvas ref={this.canvasRef} />
+3 -1
View File
@@ -82,7 +82,9 @@ class SendMessage extends React.PureComponent {
this.messageEditArea.focus();
}
if (prevProps.reply != this.props.reply) {
if (prevProps.topicName != this.props.topicName) {
this.setState({message: '', audioRec: false, quote: null});
} else if (prevProps.reply != this.props.reply) {
this.setState({quote: this.formatReply()});
}
}