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 searchUsers = () => { | |
if (cometChat) { | |
const limit = 30; | |
const usersRequestBuilder = new cometChat.UsersRequestBuilder().setLimit(limit); | |
const usersRequest = keyword ? usersRequestBuilder.setSearchKeyword(keyword).build() : usersRequestBuilder.build(); | |
usersRequest.fetchNext().then( | |
userList => { | |
/* userList will be the list of User class. */ | |
/* retrived list can be used to display contact list. */ |
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
import React, { useState, useContext } from 'react'; | |
import { StyleSheet, View, TextInput, TouchableOpacity, Text, ActivityIndicator, Alert } from 'react-native'; | |
// import Context to get shared data from React context. | |
import Context from "../context"; | |
// import validator to validate user's credentials. | |
import validator from "validator"; | |
// import uuid to generate id for users. | |
import 'react-native-get-random-values'; | |
import { v4 as uuidv4 } from "uuid"; |
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 createGroup = () => { | |
if (isGroupValid(groupName)) { | |
setIsLoading(true); | |
const GUID = uuidv4(); | |
const groupType = cometChat.GROUP_TYPE.PUBLIC; | |
const groupIcon = generateAvatar(); | |
const password = ""; | |
const group = new cometChat.Group(GUID, groupName, groupType, password); |
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 => { | |
}, |
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 Chat = () => { | |
... | |
const { cometChat, selectedConversation, user } = useContext(Context); | |
const [messages, setMessages] = useState([]); | |
... | |
useEffect(() => { | |
if (selectedConversation) { | |
// get list of messages. |
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 Chat = () => { | |
... | |
const { cometChat, selectedConversation, user} = useContext(Context); | |
const [messages, setMessages] = useState([]); | |
... | |
const getReceiverId = () => { | |
if (selectedConversation && selectedConversation.guid) { | |
return selectedConversation.guid; |
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 Chat = () => { | |
... | |
const { cometChat, selectedConversation, user } = useContext(Context); | |
const [messages, setMessages] = useState([]); | |
const [selectedFile, setSelectedFile] = useState(null); | |
... | |
useEffect(() => { | |
if (selectedFile && selectedFile.name && selectedFile.uri) { |
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 Chat = () => { | |
... | |
const { cometChat, selectedConversation, user } = useContext(Context); | |
const [messages, setMessages] = useState([]); | |
... | |
useEffect(() => { | |
if (selectedConversation) { | |
... |
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 App = () => { | |
const callListenerId = useRef(uuidv4()); | |
... | |
const [callType, setCallType] = useState(null); | |
const [callSettings, setCallSettings] = useState(null); | |
const [call, setCall] = useState(null); | |
const [isSomeoneCalling, setIsSomeoneCalling] = useState(false); | |
useEffect(() => { |
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
import React, { useState, useContext } from 'react'; | |
import { StyleSheet, View, TouchableOpacity, Text, Image, Alert, ActivityIndicator } from 'react-native'; | |
import Context from '../context'; | |
const ManageGroup = (props) => { | |
const { navigation } = props; | |
const { cometChat, selectedConversation } = useContext(Context); |