Skip to content

Instantly share code, notes, and snippets.

@hieptl
Last active October 11, 2021 02:01
Show Gist options
  • Save hieptl/193a8abbd1fa65092cff0f8cea9ee719 to your computer and use it in GitHub Desktop.
Save hieptl/193a8abbd1fa65092cff0f8cea9ee719 to your computer and use it in GitHub Desktop.
Home.js - Select Item - React Native Gifted Chat App
...
const joinGroup = (item) => {
if (item && item.guid && !item.hasJoined) {
const GUID = item.guid;
const password = "";
const groupType = cometChat.GROUP_TYPE.PUBLIC;
cometChat.joinGroup(GUID, groupType, password).then(
group => {
},
error => {
}
);
}
};
const selectItem = (item) => () => {
// if item is a group. Join the group if the user has not joined before.
if (item && item.guid && !item.hasJoined) {
joinGroup(item);
}
//
setSelectedConversation({ ...item, contactType: selectedType });
navigation.navigate('Chat');
};
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment