Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
let receiverType = CometChat.RECEIVER_TYPE.USER;
let typingNotification = new CometChat.TypingIndicator(
receiverId,
receiverType
);
if (e.target.value === "") CometChat.endTyping(typingNotification);
else CometChat.startTyping(typingNotification);
} else if (this.props.activeConversation.guid !== undefined) {
let receiverId = this.props.activeConversation.guid;
let receiverType = CometChat.RECEIVER_TYPE.GROUP;
let typingNotification = new CometChat.TypingIndicator(
receiverId,
receiverType
);
if (e.target.value === "") CometChat.endTyping(typingNotification);
else CometChat.startTyping(typingNotification);
}
};
endTyping=()=>{
if(this.props.activeMessageType == "user"){
let receiverId = this.props.activeUser;
let receiverType = CometChat.RECEIVER_TYPE.USER;
let metadata = {
text : ""
};
let typingNotification = new CometChat.TypingIndicator(receiverId,receiverType,metadata);
CometChat.endTyping(typingNotification);
}
}
startTyping=(content)=>{
if(this.props.activeMessageType == "user"){
let receiverId = this.props.activeUser;
let receiverType = CometChat.RECEIVER_TYPE.USER;
let metadata = {
text : content
};
let typingNotification = new CometChat.TypingIndicator(receiverId,receiverType,metadata);
CometChat.startTyping(typingNotification);
}
}
handleTextInputChange = e => {
this.setState({ newMessage: e.target.value });
if (this.props.activeConversation.uid !== undefined) {
let receiverId = this.props.activeConversation.uid;
let receiverType = CometChat.RECEIVER_TYPE.USER;
let typingNotification = new CometChat.TypingIndicator(
receiverId,
receiverType
);
if (e.target.value === "") CometChat.endTyping(typingNotification);
else CometChat.startTyping(typingNotification);
} else if (this.props.activeConversation.guid !== undefined) {
let receiverId = this.props.activeConversation.guid;
let receiverType = CometChat.RECEIVER_TYPE.GROUP;
let typingNotification = new CometChat.TypingIndicator(
receiverId,
receiverType
);