Last active
October 11, 2021 02:01
-
-
Save hieptl/193a8abbd1fa65092cff0f8cea9ee719 to your computer and use it in GitHub Desktop.
Home.js - Select Item - React Native Gifted Chat App
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
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