@cometchat/chat-uikit-react-native 4.1.1 → 4.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -11,7 +11,7 @@
11
11
 
12
12
  [![Platform](https://img.shields.io/badge/Platform-ReactNative-brightgreen.svg)](#)
13
13
  [![Platform](https://img.shields.io/badge/Language-TypeScript-yellowgreen.svg)](#)
14
- ![Version](https://shields.io/badge/version-v4.1.1-orange)
14
+ ![Version](https://shields.io/badge/version-v4.1.2-orange)
15
15
  ![Twitter Follow](https://img.shields.io/twitter/follow/cometchat?style=social)
16
16
 
17
17
  ## Table of contents
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cometchat/chat-uikit-react-native",
3
- "version": "4.1.1",
3
+ "version": "4.1.2",
4
4
  "description": "CometChat React Native UI Kit is a collection of custom UI Components designed to build text , chat and calling features in your application. The UI Kit is developed to keep developers in mind and aims to reduce development efforts significantly",
5
5
  "main": "src/index",
6
6
  "module": "src/index",
@@ -389,19 +389,19 @@ export const CometChatMessageList = forwardRef<
389
389
  .fetchNext()
390
390
  .then(newMessages => {
391
391
  let cleanUpdatedList = [...updatedList];
392
- for (let i = 0; i < cleanUpdatedList.length; i++) {
392
+ for (let i = (cleanUpdatedList.length - 1); i >= 0; i--) {
393
393
  if (cleanUpdatedList[i].id == lastID.current) break;
394
- if (cleanUpdatedList[i].id == undefined)
394
+ if (cleanUpdatedList[i].id == undefined || Number.isNaN(parseInt(cleanUpdatedList[i].id)))
395
395
  cleanUpdatedList.splice(i, 1);
396
396
  }
397
397
  // console.log("newMessages", newMessages.length, JSON.stringify(newMessages))
398
- if (cleanUpdatedList?.length > 0 && cleanUpdatedList?.[0]?.["muid"]) {
399
- let localFileExists = newMessages.findIndex(msg => msg?.["muid"] == cleanUpdatedList?.[0]?.["muid"]);
398
+ if (cleanUpdatedList?.length > 0 && cleanUpdatedList?.[cleanUpdatedList.length - 1]?.["muid"]) {
399
+ let localFileExists = newMessages.findIndex(msg => msg?.["muid"] == cleanUpdatedList?.[cleanUpdatedList.length - 1]?.["muid"]);
400
400
  if (localFileExists > -1) {
401
401
  cleanUpdatedList.shift();
402
402
  }
403
403
  }
404
- let tmpList = [...newMessages.reverse(), ...cleanUpdatedList];
404
+ let tmpList = [...cleanUpdatedList, ...newMessages.reverse()];
405
405
  tmpList = tmpList.map((item: CometChat.BaseMessage, index) => {
406
406
  if (item.getCategory() === MessageCategoryConstants.interactive) {
407
407
  return InteractiveMessageUtils.convertInteractiveMessage(item);
@@ -570,7 +570,7 @@ export const CometChatMessageList = forwardRef<
570
570
  const deleteMessage = (message: CometChat.BaseMessage) => {
571
571
  CometChat.deleteMessage(message.getId().toString())
572
572
  .then(res => {
573
- messageEdited(res, false);
573
+ CometChatUIEventHandler.emitMessageEvent(MessageEvents.ccMessageDeleted, { message: res });
574
574
  setShowMessageOptions([]);
575
575
  })
576
576
  .catch(rej => {
@@ -66,6 +66,9 @@ export class CometChatConversationUtils {
66
66
  } else if (lastMessage.getCategory() == CometChat.CATEGORY_CUSTOM as CometChat.MessageCategory) {
67
67
  msgText = lastMessage.getType();
68
68
  } else if (lastMessage.getCategory() == CometChat.CATEGORY_ACTION as CometChat.MessageCategory) {
69
+ if ((lastMessage as CometChat.Action)?.getAction() === CometChat.ACTION_TYPE.MESSSAGE_DELETED) {
70
+ return localize("THIS_MESSAGE_DELETED");
71
+ }
69
72
  msgText = (lastMessage as CometChat.Action).getMessage();
70
73
  } else if (lastMessage.getCategory() === CometChat.CATEGORY_INTERACTIVE) {
71
74
  msgText = lastMessage.getType() === "form" ? `${localize('FORM')} 📋` : `${localize('CARD')} 🪧`;