@cometchat/chat-uikit-react-native 5.3.3 → 5.3.4

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.
Files changed (24) hide show
  1. package/android/src/main/java/com/reactnativecometchatuikit/CometChatWebView.java +9 -0
  2. package/ios/WebViewManager.m +13 -2
  3. package/package.json +1 -1
  4. package/src/CometChatMessageComposer/CometChatMessageComposer.tsx +1 -1
  5. package/src/CometChatMessageList/CometChatMessageList.tsx +13 -5
  6. package/src/shared/resources/CometChatLocalizeNew/resources/de/translation.json +2 -1
  7. package/src/shared/resources/CometChatLocalizeNew/resources/en/translation.json +2 -1
  8. package/src/shared/resources/CometChatLocalizeNew/resources/es/translation.json +2 -1
  9. package/src/shared/resources/CometChatLocalizeNew/resources/fr/translation.json +2 -1
  10. package/src/shared/resources/CometChatLocalizeNew/resources/hi/translation.json +2 -1
  11. package/src/shared/resources/CometChatLocalizeNew/resources/hu/translation.json +2 -1
  12. package/src/shared/resources/CometChatLocalizeNew/resources/it/translation.json +2 -1
  13. package/src/shared/resources/CometChatLocalizeNew/resources/ja/translation.json +2 -1
  14. package/src/shared/resources/CometChatLocalizeNew/resources/ko/translation.json +2 -1
  15. package/src/shared/resources/CometChatLocalizeNew/resources/lt/translation.json +2 -1
  16. package/src/shared/resources/CometChatLocalizeNew/resources/ms/translation.json +2 -1
  17. package/src/shared/resources/CometChatLocalizeNew/resources/nl/translation.json +2 -1
  18. package/src/shared/resources/CometChatLocalizeNew/resources/pt/translation.json +2 -1
  19. package/src/shared/resources/CometChatLocalizeNew/resources/ru/translation.json +2 -1
  20. package/src/shared/resources/CometChatLocalizeNew/resources/sv/translation.json +2 -1
  21. package/src/shared/resources/CometChatLocalizeNew/resources/tr/translation.json +2 -1
  22. package/src/shared/resources/CometChatLocalizeNew/resources/zh/translation.json +2 -1
  23. package/src/shared/resources/CometChatLocalizeNew/resources/zh-tw/translation.json +2 -1
  24. package/src/shared/utils/MarkdownUtils.ts +2 -1
@@ -1,5 +1,6 @@
1
1
  package com.reactnativecometchatuikit;
2
2
 
3
+ import android.os.Build;
3
4
  import android.os.Bundle;
4
5
  import android.util.Log;
5
6
  import android.view.ViewGroup;
@@ -15,8 +16,16 @@ public class CometChatWebView extends AppCompatActivity {
15
16
  protected void onCreate(@Nullable Bundle savedInstanceState) {
16
17
  super.onCreate(savedInstanceState);
17
18
  getSupportActionBar().hide();
19
+
20
+ // On API 30+ the default changed to edge-to-edge; restore classic behavior
21
+ // so the layout respects system bar insets (status bar, navigation bar).
22
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
23
+ getWindow().setDecorFitsSystemWindows(true);
24
+ }
25
+
18
26
  String urlToLoad = getIntent().getStringExtra("load_url");
19
27
  RelativeLayout layout = new RelativeLayout(this);
28
+ layout.setFitsSystemWindows(true);
20
29
  layout.setLayoutParams(new RelativeLayout.LayoutParams(
21
30
  ViewGroup.LayoutParams.MATCH_PARENT,
22
31
  ViewGroup.LayoutParams.MATCH_PARENT
@@ -13,14 +13,25 @@ RCT_EXPORT_METHOD(openUrl: (NSString *) url) {
13
13
 
14
14
  // Create a web view controller
15
15
  UIViewController *webViewController = [[UIViewController alloc] init];
16
+ webViewController.view.backgroundColor = [UIColor whiteColor];
16
17
 
17
- // Create a web view
18
- WKWebView *webView = [[WKWebView alloc] initWithFrame:webViewController.view.bounds];
18
+ // Create a web view with CGRectZero — Auto Layout will size it
19
+ WKWebView *webView = [[WKWebView alloc] initWithFrame:CGRectZero];
20
+ webView.translatesAutoresizingMaskIntoConstraints = NO;
19
21
  [webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:url]]];
20
22
 
21
23
  // Add the web view to the view controller's view
22
24
  [webViewController.view addSubview:webView];
23
25
 
26
+ // Constrain to safe area layout guide so content respects notch and home indicator
27
+ UILayoutGuide *safeArea = webViewController.view.safeAreaLayoutGuide;
28
+ [NSLayoutConstraint activateConstraints:@[
29
+ [webView.topAnchor constraintEqualToAnchor:safeArea.topAnchor],
30
+ [webView.bottomAnchor constraintEqualToAnchor:safeArea.bottomAnchor],
31
+ [webView.leadingAnchor constraintEqualToAnchor:safeArea.leadingAnchor],
32
+ [webView.trailingAnchor constraintEqualToAnchor:safeArea.trailingAnchor]
33
+ ]];
34
+
24
35
  // Present the web view controller
25
36
  UIViewController *rootViewController = [UIApplication sharedApplication].delegate.window.rootViewController;
26
37
  [rootViewController presentViewController:webViewController animated:YES completion:^{
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cometchat/chat-uikit-react-native",
3
- "version": "5.3.3",
3
+ "version": "5.3.4",
4
4
  "description": "Ready-to-use Chat UI Components for React Native",
5
5
  "main": "src/index",
6
6
  "module": "src/index",
@@ -1274,7 +1274,7 @@ export const CometChatMessageComposer = React.forwardRef(
1274
1274
  iconStyle={mergedComposerStyle.attachmentIconStyle as ImageStyle}
1275
1275
  />
1276
1276
  );
1277
- }, [mergedComposerStyle]);
1277
+ }, [mergedComposerStyle, actionSheetItems, hideAttachmentButton]);
1278
1278
 
1279
1279
  const RecordAudioButtonView = ({
1280
1280
  icon,
@@ -3431,9 +3431,11 @@ export const CometChatMessageList = memo(
3431
3431
  };
3432
3432
 
3433
3433
  const shareMedia = async (messageObject: CometChat.MediaMessage | any) => {
3434
- let _plainString = getPlainString(messageObject?.getData()["text"] || "", messageObject);
3435
-
3436
- let textMessage = stripMarkdown(_plainString);
3434
+ // Strip markdown/HTML from raw text BEFORE mention replacement,
3435
+ // because getPlainString can break HTML tags (e.g., </u> becomes /u>)
3436
+ let rawText = messageObject?.getData()["text"] || "";
3437
+ let strippedText = stripMarkdown(rawText);
3438
+ let textMessage = getPlainString(strippedText, messageObject);
3437
3439
  let fileUrl = messageObject.getData()["url"];
3438
3440
 
3439
3441
  const getFileName = () => {
@@ -3452,8 +3454,14 @@ export const CometChatMessageList = memo(
3452
3454
  : (messageObject as CometChat.MediaMessage)?.getAttachment()?.getMimeType(), // get Mime Type
3453
3455
  };
3454
3456
 
3455
- NativeModules.FileManager.shareMessage(shareObj, (callback: any) => {
3456
- });
3457
+ // Dismiss message options modal before presenting native share sheet
3458
+ // to prevent screen freeze when share sheet is dismissed on iOS (Fabric).
3459
+ // Use setTimeout with enough delay for the modal dismiss animation to complete.
3460
+ setShowMessageOptions([]);
3461
+ setTimeout(() => {
3462
+ NativeModules.FileManager.shareMessage(shareObj, (callback: any) => {
3463
+ });
3464
+ }, 600);
3457
3465
  };
3458
3466
 
3459
3467
  const openOptionsForMessage = useCallback(
@@ -489,5 +489,6 @@
489
489
  "EDIT_LINK": "Link bearbeiten",
490
490
  "LINK_TEXT": "Linktext",
491
491
  "URL": "URL",
492
- "INSERT": "Einfügen"
492
+ "INSERT": "Einfügen",
493
+ "GROUP_NO_LONGER_MEMBER": "Sie können keine Nachricht an diese Gruppe senden, da Sie kein Mitglied mehr sind."
493
494
  }
@@ -509,5 +509,6 @@
509
509
  "SEARCH_NO_MESSAGES": "No messages",
510
510
  "MESSAGE_REPORTED": "Message reported",
511
511
  "MARK_AS_UNREAD": "Mark Unread",
512
- "NEW": "New"
512
+ "NEW": "New",
513
+ "GROUP_NO_LONGER_MEMBER": "You can't send message to this group because you're no longer a member."
513
514
  }
@@ -509,5 +509,6 @@
509
509
  "EDIT_LINK": "Editar enlace",
510
510
  "LINK_TEXT": "Texto del enlace",
511
511
  "URL": "URL",
512
- "INSERT": "Insertar"
512
+ "INSERT": "Insertar",
513
+ "GROUP_NO_LONGER_MEMBER": "No puedes enviar mensajes a este grupo porque ya no eres miembro."
513
514
  }
@@ -509,5 +509,6 @@
509
509
  "EDIT_LINK": "Modifier le lien",
510
510
  "LINK_TEXT": "Texte du lien",
511
511
  "URL": "URL",
512
- "INSERT": "Insérer"
512
+ "INSERT": "Insérer",
513
+ "GROUP_NO_LONGER_MEMBER": "Vous ne pouvez pas envoyer de message à ce groupe car vous n'en êtes plus membre."
513
514
  }
@@ -509,5 +509,6 @@
509
509
  "EDIT_LINK": "लिंक संपादित करें",
510
510
  "LINK_TEXT": "लिंक टेक्स्ट",
511
511
  "URL": "URL",
512
- "INSERT": "डालें"
512
+ "INSERT": "डालें",
513
+ "GROUP_NO_LONGER_MEMBER": "आप इस समूह में संदेश नहीं भेज सकते क्योंकि अब आप सदस्य नहीं हैं।"
513
514
  }
@@ -509,5 +509,6 @@
509
509
  "EDIT_LINK": "Link szerkesztése",
510
510
  "LINK_TEXT": "Link szövege",
511
511
  "URL": "URL",
512
- "INSERT": "Beszúrás"
512
+ "INSERT": "Beszúrás",
513
+ "GROUP_NO_LONGER_MEMBER": "Nem küldhet üzenetet ebbe a csoportba, mert már nem tag."
513
514
  }
@@ -509,5 +509,6 @@
509
509
  "EDIT_LINK": "Modifica link",
510
510
  "LINK_TEXT": "Testo del link",
511
511
  "URL": "URL",
512
- "INSERT": "Inserisci"
512
+ "INSERT": "Inserisci",
513
+ "GROUP_NO_LONGER_MEMBER": "Non puoi inviare messaggi a questo gruppo perché non sei più un membro."
513
514
  }
@@ -509,5 +509,6 @@
509
509
  "EDIT_LINK": "リンクを編集",
510
510
  "LINK_TEXT": "リンクテキスト",
511
511
  "URL": "URL",
512
- "INSERT": "挿入"
512
+ "INSERT": "挿入",
513
+ "GROUP_NO_LONGER_MEMBER": "あなたはもうメンバーではないため、このグループにメッセージを送信できません。"
513
514
  }
@@ -509,5 +509,6 @@
509
509
  "EDIT_LINK": "링크 편집",
510
510
  "LINK_TEXT": "링크 텍스트",
511
511
  "URL": "URL",
512
- "INSERT": "삽입"
512
+ "INSERT": "삽입",
513
+ "GROUP_NO_LONGER_MEMBER": "더 이상 멤버가 아니므로 이 그룹에 메시지를 보낼 수 없습니다."
513
514
  }
@@ -509,5 +509,6 @@
509
509
  "EDIT_LINK": "Redaguoti nuorodą",
510
510
  "LINK_TEXT": "Nuorodos tekstas",
511
511
  "URL": "URL",
512
- "INSERT": "Įterpti"
512
+ "INSERT": "Įterpti",
513
+ "GROUP_NO_LONGER_MEMBER": "Negalite siųsti žinutės šiai grupei, nes nebesate narys."
513
514
  }
@@ -509,5 +509,6 @@
509
509
  "EDIT_LINK": "Edit pautan",
510
510
  "LINK_TEXT": "Teks pautan",
511
511
  "URL": "URL",
512
- "INSERT": "Masukkan"
512
+ "INSERT": "Masukkan",
513
+ "GROUP_NO_LONGER_MEMBER": "Anda tidak boleh menghantar mesej ke kumpulan ini kerana anda bukan lagi ahli."
513
514
  }
@@ -509,5 +509,6 @@
509
509
  "EDIT_LINK": "Link bewerken",
510
510
  "LINK_TEXT": "Linktekst",
511
511
  "URL": "URL",
512
- "INSERT": "Invoegen"
512
+ "INSERT": "Invoegen",
513
+ "GROUP_NO_LONGER_MEMBER": "U kunt geen bericht naar deze groep sturen omdat u geen lid meer bent."
513
514
  }
@@ -509,5 +509,6 @@
509
509
  "EDIT_LINK": "Editar link",
510
510
  "LINK_TEXT": "Texto do link",
511
511
  "URL": "URL",
512
- "INSERT": "Inserir"
512
+ "INSERT": "Inserir",
513
+ "GROUP_NO_LONGER_MEMBER": "Você não pode enviar mensagem para este grupo porque não é mais membro."
513
514
  }
@@ -509,5 +509,6 @@
509
509
  "EDIT_LINK": "Редактировать ссылку",
510
510
  "LINK_TEXT": "Текст ссылки",
511
511
  "URL": "URL",
512
- "INSERT": "Вставить"
512
+ "INSERT": "Вставить",
513
+ "GROUP_NO_LONGER_MEMBER": "Вы не можете отправить сообщение в эту группу, так как вы больше не являетесь участником."
513
514
  }
@@ -509,5 +509,6 @@
509
509
  "EDIT_LINK": "Redigera länk",
510
510
  "LINK_TEXT": "Länktext",
511
511
  "URL": "URL",
512
- "INSERT": "Infoga"
512
+ "INSERT": "Infoga",
513
+ "GROUP_NO_LONGER_MEMBER": "Du kan inte skicka meddelande till denna grupp eftersom du inte längre är medlem."
513
514
  }
@@ -509,5 +509,6 @@
509
509
  "EDIT_LINK": "Bağlantıyı düzenle",
510
510
  "LINK_TEXT": "Bağlantı metni",
511
511
  "URL": "URL",
512
- "INSERT": "Ekle"
512
+ "INSERT": "Ekle",
513
+ "GROUP_NO_LONGER_MEMBER": "Artık üye olmadığınız için bu gruba mesaj gönderemezsiniz."
513
514
  }
@@ -509,5 +509,6 @@
509
509
  "EDIT_LINK": "编辑链接",
510
510
  "LINK_TEXT": "链接文本",
511
511
  "URL": "URL",
512
- "INSERT": "插入"
512
+ "INSERT": "插入",
513
+ "GROUP_NO_LONGER_MEMBER": "您无法向此群组发送消息,因为您已不再是成员。"
513
514
  }
@@ -509,5 +509,6 @@
509
509
  "EDIT_LINK": "編輯連結",
510
510
  "LINK_TEXT": "連結文字",
511
511
  "URL": "URL",
512
- "INSERT": "插入"
512
+ "INSERT": "插入",
513
+ "GROUP_NO_LONGER_MEMBER": "您無法向此群組發送訊息,因為您已不再是成員。"
513
514
  }
@@ -61,8 +61,9 @@ export function stripMarkdown(text: string): string {
61
61
  result = result.replace(/^\d+\.\s/gm, '');
62
62
 
63
63
  // 10. Strip HTML tags (e.g., <u>, <b>, <i>, <s>, <em>, <strong>, <del>, <br>, etc.)
64
+ // Preserve CometChat mention tokens <@uid:xxx> and <@all:xxx> which look like HTML tags
64
65
  result = result.replace(/<br\s*\/?>/gi, '\n');
65
- result = result.replace(/<[^>]+>/g, '');
66
+ result = result.replace(/<(?!@(?:uid|all):)[^>]+>/g, '');
66
67
 
67
68
  // 11. Remove any remaining backslash escapes (e.g., \* \_ \` \~)
68
69
  result = result.replace(/\\([*_`~>\\])/g, '$1');