Skip to content

Instantly share code, notes, and snippets.

@hieptl
Last active September 3, 2021 05:49
Show Gist options
  • Save hieptl/2e130491c7c478da53509ca68542ff65 to your computer and use it in GitHub Desktop.
Save hieptl/2e130491c7c478da53509ca68542ff65 to your computer and use it in GitHub Desktop.
index.js - CometChatMessageList - Mention Chat App
...
showToastForMentionMessage = (message) => {
if (message.text.includes(`@${this.state.loggedInUser.name}`)) {
const toastMessage = `You was tagged by ${message.sender.name}`;
this.context.setToastMessage("success", toastMessage);
}
}
//callback for listener functions
messageUpdated = (key, message, group, options) => {
...
case enums.TEXT_MESSAGE_RECEIVED:
case enums.MEDIA_MESSAGE_RECEIVED:
this.showToastForMentionMessage(message);
this.onMessageReceived(message);
break;
...
};
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment