@cometchat/chat-uikit-react-native 4.3.1 → 4.3.3

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 (49) hide show
  1. package/android/src/main/AndroidManifest.xml +3 -4
  2. package/android/src/main/java/com/reactnativecometchatuikit/CometchatUiKitPackage.java +0 -1
  3. package/android/src/main/java/com/reactnativecometchatuikit/FileManager.java +125 -7
  4. package/android/src/main/java/com/reactnativecometchatuikit/ImageManager.java +1 -1
  5. package/package.json +1 -1
  6. package/src/CometChatConversations/CometChatConversations.tsx +51 -28
  7. package/src/CometChatConversations/style.ts +5 -1
  8. package/src/CometChatMessageComposer/CometChatMessageComposer.tsx +53 -20
  9. package/src/CometChatMessageList/CometChatMessageList.tsx +15 -15
  10. package/src/CometChatMessageList/MessageListConfiguration.ts +5 -5
  11. package/src/CometChatThreadedMessages/CometChatThreadedMessages.tsx +35 -2
  12. package/src/extensions/LinkPreview/LinkPreviewBubble.tsx +51 -15
  13. package/src/index.ts +8 -8
  14. package/src/shared/CometChatContext.tsx +5 -1
  15. package/src/shared/CometChatUiKit/CometChatUIKit.ts +1 -4
  16. package/src/shared/index.ts +8 -8
  17. package/src/shared/libs/ImageZoom/ReactNativeZoomableView.tsx +1040 -0
  18. package/src/shared/libs/ImageZoom/ReactNativeZoomableViewWithGestures.tsx +223 -0
  19. package/src/shared/libs/ImageZoom/helper.ts +144 -0
  20. package/src/shared/libs/ImageZoom/index.tsx +13 -0
  21. package/src/shared/libs/ImageZoom/types/index.ts +186 -0
  22. package/src/shared/libs/VideoPlayer/Video.js +0 -24
  23. package/src/shared/libs/VideoPlayerControls/assets/img/back.png +0 -0
  24. package/src/shared/libs/VideoPlayerControls/components/Back/Back.tsx +1 -1
  25. package/src/shared/resources/CometChatLocalize/CometChatLocalize.ts +1 -1
  26. package/src/shared/utils/NetworkUtils.tsx +5 -0
  27. package/src/shared/views/CometChatActionSheet/CometChatActionSheet.tsx +1 -0
  28. package/src/shared/views/CometChatDate/CometChatDate.tsx +1 -1
  29. package/src/shared/views/CometChatImageBubble/CometChatImageBubble.tsx +64 -18
  30. package/src/shared/views/CometChatImageBubble/assets/index.ts +5 -0
  31. package/src/shared/views/CometChatImageBubble/assets/spineer.png +0 -0
  32. package/src/shared/views/CometChatImageViewerModal/ImageViewerModal.tsx +106 -0
  33. package/src/shared/views/CometChatImageViewerModal/index.tsx +1 -0
  34. package/src/shared/views/CometChatImageViewerModal/resources/Back.png +0 -0
  35. package/src/shared/views/CometChatImageViewerModal/resources/index.ts +5 -0
  36. package/src/shared/views/CometChatList/CometChatList.tsx +10 -1
  37. package/src/shared/views/{CometChatReactionsList/CometChatReactionsList.tsx → CometChatReactionList/CometChatReactionList.tsx} +17 -17
  38. package/src/shared/views/CometChatReactionList/ReactionListConfiguration.tsx +14 -0
  39. package/src/shared/views/CometChatReactionList/index.ts +12 -0
  40. package/src/shared/views/CometChatVideoBubble/CometChatVideoBubble.tsx +1 -1
  41. package/src/shared/views/index.ts +5 -5
  42. package/android/src/main/java/com/reactnativecometchatuikit/VideoManager.java +0 -40
  43. package/src/shared/libs/VideoPlayerControls/assets/img/back@2x.png +0 -0
  44. package/src/shared/libs/VideoPlayerControls/assets/img/back@3x.png +0 -0
  45. package/src/shared/views/CometChatReactionsList/ReactionsListConfiguration.tsx +0 -14
  46. package/src/shared/views/CometChatReactionsList/index.ts +0 -12
  47. /package/src/shared/views/{CometChatReactionsList/ReactionsListStyle.tsx → CometChatReactionList/ReactionListStyle.tsx} +0 -0
  48. /package/src/shared/views/{CometChatReactionsList → CometChatReactionList}/resources/Spineer.png +0 -0
  49. /package/src/shared/views/{CometChatReactionsList → CometChatReactionList}/resources/index.ts +0 -0
@@ -4,7 +4,8 @@
4
4
  <uses-permission android:name="android.permission.INTERNET" />
5
5
  <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
6
6
  <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
7
- <application android:requestLegacyExternalStorage="true">
7
+ <application android:requestLegacyExternalStorage="true"
8
+ android:largeHeap="true" >
8
9
  <activity
9
10
  android:name="com.reactnativecometchatuikit.CometChatVideoPlayer"
10
11
  android:theme="@style/Theme.AppCompat" />
@@ -16,12 +17,10 @@
16
17
  android:theme="@style/Theme.AppCompat" />
17
18
  <provider
18
19
  android:name="androidx.core.content.FileProvider"
19
- android:authorities="${applicationId}.provider"
20
+ android:authorities="${applicationId}.fileprovider"
20
21
  android:exported="false"
21
- tools:replace="android:authorities"
22
22
  android:grantUriPermissions="true">
23
23
  <meta-data
24
- tools:replace="android:resource"
25
24
  android:name="android.support.FILE_PROVIDER_PATHS"
26
25
  android:resource="@xml/filepaths" />
27
26
  </provider>
@@ -21,7 +21,6 @@ public class CometchatUiKitPackage implements ReactPackage {
21
21
  modules.add(new CometChatSoundModule(reactContext));
22
22
  modules.add(new SoundPlayer(reactContext));
23
23
  modules.add(new FileManager(reactContext));
24
- modules.add(new VideoManager(reactContext));
25
24
  modules.add(new ImageManager(reactContext));
26
25
  modules.add(new WebViewManager(reactContext));
27
26
  modules.add(new TimeZoneCodeManager(reactContext));
@@ -2,6 +2,7 @@ package com.reactnativecometchatuikit;
2
2
 
3
3
  import static android.os.Environment.DIRECTORY_DOCUMENTS;
4
4
 
5
+ import android.Manifest;
5
6
  import android.app.Activity;
6
7
  import android.app.DownloadManager;
7
8
  import android.content.ActivityNotFoundException;
@@ -14,6 +15,9 @@ import android.content.IntentFilter;
14
15
  import android.content.pm.PackageManager;
15
16
  import android.database.Cursor;
16
17
  import android.graphics.Bitmap;
18
+ import android.graphics.BitmapFactory;
19
+ import android.graphics.Matrix;
20
+ import android.media.ExifInterface;
17
21
  import android.media.MediaPlayer;
18
22
  import android.media.MediaRecorder;
19
23
  import android.net.Uri;
@@ -27,6 +31,7 @@ import android.provider.DocumentsContract;
27
31
  import android.provider.MediaStore;
28
32
  import android.provider.OpenableColumns;
29
33
  import android.util.Log;
34
+ import android.webkit.MimeTypeMap;
30
35
  import android.widget.Toast;
31
36
 
32
37
  import androidx.annotation.NonNull;
@@ -47,6 +52,7 @@ import com.facebook.react.bridge.ReadableMap;
47
52
  import com.facebook.react.bridge.ReadableArray;
48
53
  import com.facebook.react.bridge.WritableArray;
49
54
  import com.facebook.react.bridge.WritableMap;
55
+ import com.facebook.react.bridge.WritableNativeMap;
50
56
 
51
57
  import java.io.File;
52
58
  import java.io.FileOutputStream;
@@ -73,6 +79,8 @@ public class FileManager extends ReactContextBaseJavaModule {
73
79
  private ReactApplicationContext mReactContext;
74
80
  private static final int READ_REQUEST_CODE = 100;
75
81
  private static final int CAPTURE_STILL_IMAGE = 101;
82
+ private static final int REQUEST_LAUNCH_CAMERA = 1;
83
+ private static int IMAGE_QUALITY = 20;
76
84
 
77
85
  private Callback callback;
78
86
 
@@ -82,6 +90,7 @@ public class FileManager extends ReactContextBaseJavaModule {
82
90
  private static final String FIELD_NAME = "name";
83
91
  private static final String FIELD_TYPE = "type";
84
92
  private static final String FIELD_SIZE = "size";
93
+ private File cameraFile;
85
94
 
86
95
  FileManager(ReactApplicationContext context) {
87
96
  super(context);
@@ -109,6 +118,70 @@ public class FileManager extends ReactContextBaseJavaModule {
109
118
  if (requestCode == CAPTURE_STILL_IMAGE) {
110
119
  saveImageFromCameraAndReturn(resultCode, data, callback);
111
120
  }
121
+ if (requestCode == REQUEST_LAUNCH_CAMERA) {
122
+ if (resultCode == Activity.RESULT_OK) {
123
+ if (cameraFile != null && cameraFile.exists()) {
124
+ // Compress the image
125
+ try {
126
+ Bitmap bitmap = BitmapFactory.decodeFile(cameraFile.getAbsolutePath());
127
+ ExifInterface exif = new ExifInterface(cameraFile.getAbsolutePath());
128
+ int orientation = exif.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_NORMAL);
129
+ Log.i(TAG, "onActivityResult: orientation" + orientation);
130
+ int rotationAngle = 0;
131
+ if (orientation == ExifInterface.ORIENTATION_ROTATE_90) {
132
+ rotationAngle = 90;
133
+ }
134
+ else if (orientation == ExifInterface.ORIENTATION_ROTATE_180) {
135
+ rotationAngle = 180;
136
+ }
137
+ else if (orientation == ExifInterface.ORIENTATION_ROTATE_270) {
138
+ rotationAngle = 270;
139
+ }
140
+
141
+ // Create a new matrix for rotation
142
+ Matrix matrix = new Matrix();
143
+ if (rotationAngle != 0) {
144
+ matrix.setRotate(rotationAngle);
145
+ // Rotate the bitmap
146
+ bitmap = Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), matrix, true);
147
+ }
148
+ FileOutputStream out = new FileOutputStream(cameraFile);
149
+
150
+ // The quality parameter can be adjusted to decrease image quality (100 means no compression)
151
+ bitmap.compress(Bitmap.CompressFormat.JPEG, IMAGE_QUALITY, out); // Compress to 50% quality
152
+ out.flush();
153
+ out.close();
154
+ bitmap.recycle();
155
+ } catch (Exception e) {
156
+ WritableMap errorMap = new WritableNativeMap();
157
+ errorMap.putString("error", "Image compression error: " + e.getMessage());
158
+ callback.invoke(errorMap);
159
+ return;
160
+ }
161
+
162
+ // Prepare the image details to return to React Native
163
+ WritableMap imageMap = new WritableNativeMap();
164
+ Uri fileUri = Uri.fromFile(cameraFile);
165
+ imageMap.putString("uri", fileUri.toString());
166
+ imageMap.putString("path", cameraFile.getAbsolutePath());
167
+ imageMap.putDouble("size", cameraFile.length());
168
+ imageMap.putString("name", cameraFile.getName());
169
+ String fileExtension = MimeTypeMap.getFileExtensionFromUrl(fileUri.toString());
170
+ String mimeType = MimeTypeMap.getSingleton().getMimeTypeFromExtension(fileExtension.toLowerCase());
171
+ imageMap.putString("type", mimeType != null ? mimeType : "image/jpeg");
172
+
173
+ callback.invoke(imageMap);
174
+ } else {
175
+ WritableMap errorMap = new WritableNativeMap();
176
+ errorMap.putString("error", "Image file does not exist.");
177
+ callback.invoke(errorMap);
178
+ }
179
+ } else {
180
+ WritableMap errorMap = new WritableNativeMap();
181
+ errorMap.putString("error", "Camera activity did not return RESULT_OK.");
182
+ callback.invoke(errorMap);
183
+ }
184
+ }
112
185
  }
113
186
 
114
187
  private void saveImageFromCameraAndReturn(int resultCode, Intent data, Callback callback) {
@@ -496,17 +569,62 @@ public class FileManager extends ReactContextBaseJavaModule {
496
569
  }
497
570
  }
498
571
 
499
- @ReactMethod
500
- public void openCamera(String fileType, Callback callback) {
572
+ @ReactMethod
573
+ public void openCamera(String fileType, Integer imageQuality, final Callback callback) {
574
+ IMAGE_QUALITY = imageQuality;
575
+ final Activity currentActivity = getCurrentActivity();
576
+ if (currentActivity == null) {
577
+ WritableMap errorMap = new WritableNativeMap();
578
+ errorMap.putString("error", "Activity doesn't exist");
579
+ callback.invoke(errorMap);
580
+ return;
581
+ }
582
+
583
+ // Check and request permissions if needed, then proceed with camera launch
584
+ if (ContextCompat.checkSelfPermission(currentActivity, Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED) {
585
+ ActivityCompat.requestPermissions(currentActivity, new String[] {Manifest.permission.CAMERA}, REQUEST_LAUNCH_CAMERA);
586
+ } else {
587
+ launchCameraIntent(currentActivity, callback);
588
+ }
589
+ }
590
+
591
+ private void launchCameraIntent(Activity currentActivity, Callback callback) {
592
+ this.callback = callback;
593
+ Intent cameraIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
501
594
  try {
502
- this.callback = callback;
503
- Intent camera_intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE_SECURE);
504
- mReactContext.startActivityForResult(camera_intent,CAPTURE_STILL_IMAGE, Bundle.EMPTY);
505
- } catch (Exception ex) {
506
- Log.e(TAG, "openCamera: " + ex.getMessage() );
595
+ cameraFile = createImageFile(); // Use the global variable here
596
+ if (cameraFile != null) {
597
+ Uri photoURI = FileProvider.getUriForFile(currentActivity,
598
+ currentActivity.getApplicationContext().getPackageName() + ".fileprovider",
599
+ cameraFile);
600
+ cameraIntent.putExtra(MediaStore.EXTRA_OUTPUT, photoURI);
601
+ currentActivity.startActivityForResult(cameraIntent, REQUEST_LAUNCH_CAMERA);
602
+ } else {
603
+ WritableMap errorMap = new WritableNativeMap();
604
+ errorMap.putString("error", "Could not create image file");
605
+ callback.invoke(errorMap);
606
+ }
607
+ } catch (Exception e) {
608
+ WritableMap errorMap = new WritableNativeMap();
609
+ errorMap.putString("error", "Failed to launch camera: " + e.getMessage());
610
+ callback.invoke(errorMap);
507
611
  }
508
612
  }
509
613
 
614
+ private File createImageFile() throws IOException {
615
+ // Create an image file name
616
+ String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date());
617
+ String imageFileName = "JPEG_" + timeStamp + "_";
618
+ File storageDir = getCurrentActivity().getExternalFilesDir(Environment.DIRECTORY_PICTURES);
619
+ File image = File.createTempFile(
620
+ imageFileName, /* prefix */
621
+ ".jpeg", /* suffix */
622
+ storageDir /* directory */
623
+ );
624
+ return image;
625
+ }
626
+
627
+
510
628
  @ReactMethod
511
629
  public void openFileChooser(String fileType, Callback callback) {
512
630
  try {
@@ -11,7 +11,7 @@ import com.facebook.react.bridge.ReactContextBaseJavaModule;
11
11
  import com.facebook.react.bridge.ReactMethod;
12
12
 
13
13
  public class ImageManager extends ReactContextBaseJavaModule {
14
- public static final String TAG = "VideoManager";
14
+ public static final String TAG = "ImageManager";
15
15
 
16
16
  ImageManager(ReactApplicationContext context) {
17
17
  super(context);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cometchat/chat-uikit-react-native",
3
- "version": "4.3.1",
3
+ "version": "4.3.3",
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",
@@ -8,6 +8,7 @@ import {
8
8
  CometChatConfirmDialog,
9
9
  CometChatConfirmDialogStyleInterface,
10
10
  CometChatContext,
11
+ CometChatListActionsInterface,
11
12
  localize
12
13
  } from "../shared";
13
14
  import { Style } from "./style";
@@ -267,7 +268,7 @@ export const CometChatConversations = (props: ConversationInterface) => {
267
268
  //context
268
269
  const { theme } = useContext<CometChatContextType>(CometChatContext);
269
270
 
270
- const conversationListRef = React.useRef(null);
271
+ const conversationListRef = React.useRef<CometChatListActionsInterface>(null);
271
272
  const loggedInUser = React.useRef(null);
272
273
  const [confirmDelete, setConfirmDelete] = React.useState(undefined);
273
274
  const [selecting, setSelecting] = React.useState(false);
@@ -363,24 +364,38 @@ export const CometChatConversations = (props: ConversationInterface) => {
363
364
  }
364
365
  }
365
366
 
367
+
368
+ const getConversationRefFromTypingIndicator = (typingIndicator : CometChat.TypingIndicator)=> {
369
+ let list = conversationListRef.current.getAllListItems();
370
+ return list.find((item: CometChat.Conversation) => {
371
+ return (
372
+ (typingIndicator.getReceiverType()== ReceiverTypeConstants.user&&
373
+ item.getConversationType() == ReceiverTypeConstants.user
374
+ && (item.getConversationWith() as CometChat.User).getUid() == typingIndicator.getSender().getUid() )
375
+ || (typingIndicator.getReceiverType() == ReceiverTypeConstants.group && item.getConversationType() == ReceiverTypeConstants.group
376
+ && (item.getConversationWith() as CometChat.Group).getGuid() == typingIndicator.getReceiverId() )
377
+ )})
378
+ }
379
+
366
380
  /**
367
381
  * Listener callback for typing event
368
382
  * @param {...any} args
369
383
  */
370
384
  const typingEventHandler = (...args) => {
371
- // console.log("typing event", args[1], args[0].receiverId);
372
- let conversation = conversationListRef.current.getListItem(`${args[0]['receiverType']}_${args[0]['receiverId']}`);
373
- // console.log("typing event", conversation);
374
- let isTyping = args[1];
375
- let newConversation = conversation
376
- if (isTyping && newConversation?.['lastMessage']?.["typing"]) {
377
- newConversation['lastMessage']["typing"] = args[0]?.receiverType === 'group' ?
378
- `${args[0].sender.name} : ${localize("IS_TYPING")}` :
379
- localize("IS_TYPING");
380
- } else {
381
- delete newConversation['lastMessage']['typing'];
385
+ let conversation: CometChat.Conversation = getConversationRefFromTypingIndicator(args[0]);
386
+ if(conversation){
387
+ let isTyping = args[1];
388
+ let newConversation = conversation
389
+ if (isTyping && !newConversation?.['lastMessage']?.["typing"]) {
390
+ newConversation['lastMessage']["typing"] = args[0]?.receiverType === 'group' ?
391
+ `${args[0].sender.name} ${localize("IS_TYPING")}` :
392
+ localize("IS_TYPING");
393
+ } else {
394
+ delete newConversation['lastMessage']['typing'];
395
+ }
396
+ conversationListRef.current.updateList(newConversation);
382
397
  }
383
- conversationListRef.current.updateList(conversation);
398
+
384
399
  }
385
400
 
386
401
  /**
@@ -392,7 +407,7 @@ export const CometChatConversations = (props: ConversationInterface) => {
392
407
  const checkAndUpdateLastMessage = (newMessage: CometChat.BaseMessage) => {
393
408
  CometChat.CometChatHelper.getConversationFromMessage(newMessage)
394
409
  .then(conversation => {
395
- let conver = conversationListRef.current.getListItem(conversation.getConversationId())
410
+ let conver: any = conversationListRef.current.getListItem(conversation.getConversationId())
396
411
  if (!conver) return;
397
412
  let lastMessageId = conver['lastMessage']['id']
398
413
  if (lastMessageId == newMessage['id']) {
@@ -536,7 +551,6 @@ export const CometChatConversations = (props: ConversationInterface) => {
536
551
  }
537
552
 
538
553
  const removeItemFromSelectionList = (id) => {
539
- //remove from selected list if list is in selecting mode.
540
554
  if (selecting) {
541
555
  let index = selectedConversation.find(member => member['uid'] == id);
542
556
  if (index > -1) {
@@ -561,7 +575,7 @@ export const CometChatConversations = (props: ConversationInterface) => {
561
575
 
562
576
  const getMessagePreview = (conversations: CometChat.Conversation, uid) => {
563
577
 
564
- let lastMessage: CometChat.BaseMessage = conversations['lastMessage'];
578
+ let lastMessage: CometChat.BaseMessage = conversations.getLastMessage();
565
579
  if (!lastMessage) return null;
566
580
  let messageText: string ;
567
581
  if(lastMessage.getDeletedAt() !== undefined){
@@ -570,16 +584,18 @@ export const CometChatConversations = (props: ConversationInterface) => {
570
584
  messageText = ChatConfigurator.getDataSource().getLastConversationMessage(conversations);
571
585
  }
572
586
  let groupText = "";
573
- if (lastMessage['receiverType'] == 'group') {
574
- if (lastMessage['receiverId'] == uid) {
575
- groupText = "you: "
587
+ if (lastMessage.getReceiverType() == ReceiverTypeConstants.group) {
588
+ if (lastMessage.getSender().getUid() == uid) {
589
+ groupText = localize("YOU")+ ": "
576
590
  } else {
577
- groupText = lastMessage['sender']['name'] + ": "
591
+ groupText = lastMessage.getSender().getName() + ": "
578
592
  }
579
593
  }
580
594
 
595
+ messageText = messageText?.trim();
581
596
  return (
582
- <Text numberOfLines={1} ellipsizeMode={"tail"} style={[Style.subtitleTextStyle, { color: theme.palette.getAccent600() }]}>
597
+ <Text numberOfLines={1} ellipsizeMode={"tail"} style={[Style.subtitleTextStyle, { color: theme.palette.getAccent600(), fontSize : theme.typography.subtitle1.fontSize,
598
+ fontWeight : theme.typography.subtitle1.fontWeight }]}>
583
599
  {groupText + messageText}
584
600
  </Text>
585
601
  )
@@ -589,14 +605,13 @@ export const CometChatConversations = (props: ConversationInterface) => {
589
605
  conversations: CometChat.Conversation,
590
606
  typingText: string
591
607
  }) => {
592
-
593
608
  const lastMessage = params['conversations']['lastMessage'];
594
609
  if (!lastMessage) return null;
595
610
  let readReceipt;
596
-
597
- if (!disableTyping && params.typingText) {
611
+ if ( params.typingText) {
598
612
  return <View style={Style.row}>
599
- <Text>{params.typingText}</Text>
613
+ <Text numberOfLines={1} ellipsizeMode={"tail"} style={[Style.subtitleTextStyle, { color: theme.palette.getPrimary() ,
614
+ fontSize : theme.typography.subtitle1.fontSize , fontWeight : theme.typography.subtitle1.fontWeight }]} >{params.typingText}</Text>
600
615
  </View>
601
616
  }
602
617
 
@@ -618,13 +633,21 @@ export const CometChatConversations = (props: ConversationInterface) => {
618
633
  />;
619
634
  }
620
635
 
636
+ let threadView;
621
637
 
638
+ if(lastMessage?.getParentMessageId()){
639
+ threadView = <Text numberOfLines={1} style={[Style.subtitleTextStyle, { color: theme.palette.getAccent600() }]} >{localize("IN_A_THREAD")}</Text>
640
+ }
622
641
 
623
642
  return (
624
- <View style={Style.row}>
625
- {readReceipt}
626
- {getMessagePreview(params['conversations'], loggedInUser.current?.uid)}
643
+ <View style={Style.column}>
644
+ {threadView}
645
+ <View style={Style.row}>
646
+ {readReceipt}
647
+ {getMessagePreview(params['conversations'], loggedInUser.current?.uid)}
648
+ </View>
627
649
  </View>
650
+
628
651
  )
629
652
  }
630
653
 
@@ -29,6 +29,10 @@ export const Style = StyleSheet.create({
29
29
  justifyContent: "center",
30
30
  alignItems: "center"
31
31
  },
32
+ column: {
33
+ width: "100%",
34
+ flexDirection: 'column'
35
+ },
32
36
  row: {
33
37
  flexDirection: 'row'
34
38
  },
@@ -36,7 +40,7 @@ export const Style = StyleSheet.create({
36
40
  fontWeight: 'bold'
37
41
  },
38
42
  subtitleTextStyle: {
39
- maxWidth: "80%",
43
+ width: "95%",
40
44
  color: "rgba(20, 20, 20, 0.58)",
41
45
  },
42
46
  startNewConversationBtnStyle: {
@@ -218,7 +218,7 @@ const LiveReaction = (props: any) => {
218
218
  let recordedTime = 0, timerIntervalId = null;
219
219
 
220
220
  export interface MessageComposerStyleInterface extends BaseStyle {
221
- attachIcontint?: string;
221
+ attachIconTint?: string;
222
222
  sendIconTint?: string;
223
223
  inputBackground?: string;
224
224
  inputBorder?: BorderStyleInterface;
@@ -234,6 +234,12 @@ export interface MessageComposerStyleInterface extends BaseStyle {
234
234
  actionSheetLayoutModeIconTint?: string;
235
235
  actionSheetCancelButtonIconTint?: string;
236
236
  }
237
+ type Enumerate<N extends number, Acc extends number[] = []> = Acc['length'] extends N
238
+ ? Acc[number]
239
+ : Enumerate<N, [...Acc, Acc['length']]>
240
+
241
+ type IntRange<F extends number, T extends number> = Exclude<Enumerate<T>, Enumerate<F>>
242
+
237
243
  export interface CometChatMessageComposerInterface {
238
244
  /**
239
245
  *
@@ -508,6 +514,11 @@ export interface CometChatMessageComposerInterface {
508
514
  * To override keyboardAvoidingViewProps.
509
515
  */
510
516
  keyboardAvoidingViewProps?: KeyboardAvoidingViewProps
517
+ /**
518
+ * To manually manage image quality taken from the camera (100 means no compression).
519
+ * @default 20
520
+ */
521
+ imageQuality?: IntRange<1, 100>
511
522
  }
512
523
  export const CometChatMessageComposer = React.forwardRef(
513
524
  (props: CometChatMessageComposerInterface, ref) => {
@@ -551,7 +562,8 @@ export const CometChatMessageComposer = React.forwardRef(
551
562
  submitIconUrl,
552
563
  AIIconURL,
553
564
  aiOptionsStyle,
554
- keyboardAvoidingViewProps
565
+ keyboardAvoidingViewProps,
566
+ imageQuality = 20
555
567
  } = props;
556
568
 
557
569
  const defaultAttachmentOptions =
@@ -622,28 +634,45 @@ export const CometChatMessageComposer = React.forwardRef(
622
634
  }
623
635
  };
624
636
 
637
+ const cameraCallback = async (cameraImage: any) => {
638
+ if (CheckPropertyExists(cameraImage, 'error')) {
639
+ return;
640
+ }
641
+ const { name, uri, type } = cameraImage;
642
+ let file = {
643
+ name,
644
+ type,
645
+ uri,
646
+ };
647
+ sendMediaMessage(
648
+ chatWithId.current,
649
+ file,
650
+ MessageTypeConstants.image,
651
+ chatWith.current
652
+ );
653
+ }
654
+
625
655
  const fileInputHandler = async (fileType: string) => {
626
656
  if (fileType === MessageTypeConstants.takePhoto) {
627
657
  if (!(await permissionUtilIOS.startResourceBasedTask(["camera"]))) {
628
658
  return;
629
659
  }
630
- FileManager.openCamera(fileType, async (cameraImage: any) => {
631
- if (CheckPropertyExists(cameraImage, 'error')) {
632
- return;
633
- }
634
- const { name, uri, type } = cameraImage;
635
- let file = {
636
- name,
637
- type,
638
- uri,
639
- };
640
- sendMediaMessage(
641
- chatWithId.current,
642
- file,
643
- MessageTypeConstants.image,
644
- chatWith.current
660
+ let quality = imageQuality
661
+ if(isNaN(imageQuality) || imageQuality < 1 || imageQuality > 100) {
662
+ quality = 20
663
+ }
664
+ if(Platform.OS === "android") {
665
+ FileManager.openCamera(
666
+ fileType,
667
+ Math.round(quality),
668
+ cameraCallback
645
669
  );
646
- });
670
+ } else {
671
+ FileManager.openCamera(
672
+ fileType,
673
+ cameraCallback
674
+ );
675
+ }
647
676
  }
648
677
  else if (Platform.OS === 'ios' && fileType === MessageTypeConstants.video) {
649
678
  NativeModules.VideoPickerModule.pickVideo(((file) => {
@@ -1045,8 +1074,8 @@ export const CometChatMessageComposer = React.forwardRef(
1045
1074
  height: 23,
1046
1075
  width: 23,
1047
1076
  resizeMode: 'contain',
1048
- tintColor: messageComposerStyle.attachIcontint
1049
- ? messageComposerStyle.attachIcontint
1077
+ tintColor: messageComposerStyle.attachIconTint
1078
+ ? messageComposerStyle.attachIconTint
1050
1079
  : theme.palette.getAccent(),
1051
1080
  }}
1052
1081
  />
@@ -1330,6 +1359,10 @@ export const CometChatMessageComposer = React.forwardRef(
1330
1359
  messageComposerStyle.actionSheetSeparatorTint,
1331
1360
  }
1332
1361
  : {}),
1362
+ layoutModeIconTint: messageComposerStyle.actionSheetLayoutModeIconTint,
1363
+ titleColor: messageComposerStyle.actionSheetTitleColor,
1364
+ listItemIconTint: messageComposerStyle.attachIconTint,
1365
+ listItemTitleFont: messageComposerStyle.actionSheetTitleFont
1333
1366
  }}
1334
1367
  cometChatBottomSheetStyle={
1335
1368
  messageComposerStyle.actionSheetCancelButtonIconTint
@@ -29,7 +29,7 @@ import { CometChatMessageInformation } from "../CometChatMessageInformation/Come
29
29
  import { MessageInformationConfigurationInterface } from "../CometChatMessageInformation";
30
30
  import { InteractiveMessageUtils } from "../shared/utils/InteractiveMessageUtils";
31
31
  import { CometChatEmojiKeyboard, EmojiKeyboardStyle } from "../shared/views/CometChatEmojiKeyboard";
32
- import { CometChatReactionsList, ReactionsListConfigurationInterface } from "../shared/views/CometChatReactionsList";
32
+ import { CometChatReactionList, ReactionListConfigurationInterface } from "../shared/views/CometChatReactionList";
33
33
  import { CometChatQuickReactions, QuickReactionsConfigurationInterface } from "../shared/views/CometChatQuickReactions";
34
34
  import { CometChatReactions, ReactionsConfigurationInterface } from "../shared/views/CometChatReactions";
35
35
  import { CommonUtils } from "../shared/utils/CommonUtils";
@@ -87,9 +87,9 @@ export interface CometChatMessageListProps {
87
87
  */
88
88
  reactionsConfiguration?: ReactionsConfigurationInterface,
89
89
  /**
90
- * Message Reaction List Configuration @ReactionsListConfigurationInterface
90
+ * Message Reaction List Configuration @ReactionListConfigurationInterface
91
91
  */
92
- reactionsListConfiguration?: ReactionsListConfigurationInterface,
92
+ reactionListConfiguration?: ReactionListConfigurationInterface,
93
93
  /**
94
94
  * Quick Reaction Configuration @QuickReactionsConfigurationInterface
95
95
  */
@@ -160,7 +160,7 @@ export const CometChatMessageList = memo(forwardRef<
160
160
  hideActionSheetHeader,
161
161
  reactionsConfiguration,
162
162
  disableReactions,
163
- reactionsListConfiguration,
163
+ reactionListConfiguration,
164
164
  quickReactionConfiguration,
165
165
  emojiKeyboardStyle,
166
166
  } = props;
@@ -287,7 +287,7 @@ export const CometChatMessageList = memo(forwardRef<
287
287
  const [ongoingCallView, setOngoingCallView] = useState(null);
288
288
  const [selectedMessage, setSelectedMessage] = useState(null);
289
289
  const [showEmojiKeyboard, setShowEmojiKeyboard] = useState(false);
290
- const [showReactionsList, setShowReactionsList] = useState(false);
290
+ const [showReactionList, setShowReactionList] = useState(false);
291
291
  const [selectedEmoji, setSelectedEmoji] = useState(null);
292
292
  // const [forwarding, setForwarding] = useState(false);
293
293
 
@@ -1017,7 +1017,7 @@ export const CometChatMessageList = memo(forwardRef<
1017
1017
 
1018
1018
  useEffect(() => {
1019
1019
  if (selectedEmoji) {
1020
- setShowReactionsList(true);
1020
+ setShowReactionList(true);
1021
1021
  }
1022
1022
  }, [selectedEmoji])
1023
1023
 
@@ -1516,8 +1516,8 @@ export const CometChatMessageList = memo(forwardRef<
1516
1516
  <CometChatMessageBubble
1517
1517
  id={`${message.getId()}`}
1518
1518
  LeadingView={() => !isThreaded && getLeadingView(message)}
1519
- HeaderView={() => !isThreaded && getHeaderView(message)}
1520
- FooterView={() => (disableReactions || isThreaded) ? null : getFooterView(message, bubbleAlignment)}
1519
+ HeaderView={hasTemplate.HeaderView ? hasTemplate.HeaderView?.bind(this, message, bubbleAlignment) : () => !isThreaded && getHeaderView(message)}
1520
+ FooterView={hasTemplate.FooterView ? hasTemplate.FooterView?.bind(this, message, bubbleAlignment) : () => (disableReactions || isThreaded) ? null : getFooterView(message, bubbleAlignment)}
1521
1521
  alignment={isThreaded ? "left" : bubbleAlignment}
1522
1522
  ContentView={hasTemplate.ContentView?.bind(this, message, bubbleAlignment)}
1523
1523
  ThreadView={() => !isThreaded && getThreadView(message, bubbleAlignment)}
@@ -1929,26 +1929,26 @@ export const CometChatMessageList = memo(forwardRef<
1929
1929
  </CometChatBottomSheet>
1930
1930
 
1931
1931
  <CometChatBottomSheet
1932
- isOpen={showReactionsList}
1932
+ isOpen={showReactionList}
1933
1933
  onClose={() => {
1934
- setShowReactionsList(false);
1934
+ setShowReactionList(false);
1935
1935
  setSelectedEmoji(null);
1936
1936
  }}
1937
1937
  sliderMaxHeight={Dimensions.get('window').height * 0.5}
1938
1938
  sliderMinHeight={Dimensions.get('window').height * 0.5}
1939
1939
  >
1940
- <CometChatReactionsList
1940
+ <CometChatReactionList
1941
1941
  messageObject={selectedMessage}
1942
1942
  selectedReaction={selectedEmoji}
1943
- {...reactionsListConfiguration}
1943
+ {...reactionListConfiguration}
1944
1944
  onPress={(messageReaction: CometChat.Reaction, messageObject: CometChat.BaseMessage) => {
1945
- if (reactionsListConfiguration?.onPress) {
1946
- reactionsListConfiguration.onPress(messageReaction, messageObject);
1945
+ if (reactionListConfiguration?.onPress) {
1946
+ reactionListConfiguration.onPress(messageReaction, messageObject);
1947
1947
  return;
1948
1948
  }
1949
1949
  reactToMessage(messageReaction?.getReaction(), messageObject);
1950
1950
  if (messageObject?.getReactions()?.length === 1 && messageObject?.getReactions()?.[0]?.['count'] == 1) {
1951
- setShowReactionsList(false);
1951
+ setShowReactionList(false);
1952
1952
  setSelectedEmoji(null);
1953
1953
  }
1954
1954
  }}