How to use the @cometchat-pro/react-native-chat.CometChat.GroupsRequestBuilder function in @cometchat-pro/react-native-chat

To help you get started, we’ve selected a few @cometchat-pro/react-native-chat examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github cometchat-pro-samples / react-native-chat-app / chatApp / src / HomeScreen.js View on Github external
fetchGroups() {
        var limit = 30;

        var groupsRequest = new CometChat.GroupsRequestBuilder().setLimit(limit).build();

        groupsRequest.fetchNext().then(
            groupList => {
                console.log("Groups list fetched successfully", groupList);
                if(groupList.length >0){
                    CometChat.getUnreadMessageCountForAllGroups().then(array=>{
                        var unread = Object.keys(array);
                        if(unread.length > 0){
                            unread.map(guid =>{
                                var index = groupList.findIndex(group=> group.guid == guid);
                                if(index != -1){
                                    groupList[index].unreadCount = array[guid];
                                }
                            });
                        } 
                        this.setState({