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

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 (227) hide show
  1. package/README.md +26 -67
  2. package/android/.gradle/7.4/checksums/checksums.lock +0 -0
  3. package/android/.gradle/7.4/fileHashes/fileHashes.lock +0 -0
  4. package/android/build.gradle +1 -1
  5. package/android/src/main/java/com/reactnativecometchatuikit/CometchatUiKitPackage.java +2 -1
  6. package/android/src/main/java/com/reactnativecometchatuikit/ReactVideoView.java +796 -0
  7. package/android/src/main/java/com/reactnativecometchatuikit/ReactVideoViewManager.java +172 -0
  8. package/android/src/main/java/com/scalablevideoview/BuildConfig.java +10 -0
  9. package/android/src/main/java/com/scalablevideoview/PivotPoint.java +13 -0
  10. package/android/src/main/java/com/scalablevideoview/ScalableType.java +34 -0
  11. package/android/src/main/java/com/scalablevideoview/ScalableVideoView.java +255 -0
  12. package/android/src/main/java/com/scalablevideoview/ScaleManager.java +188 -0
  13. package/android/src/main/java/com/scalablevideoview/Size.java +20 -0
  14. package/android/src/main/java/com/zipfile/APEZProvider.java +287 -0
  15. package/android/src/main/java/com/zipfile/APKExpansionSupport.java +81 -0
  16. package/android/src/main/java/com/zipfile/ZipResourceFile.java +428 -0
  17. package/android/src/main/res/values/attrs.xml +37 -0
  18. package/ios/FileManager.m +75 -5
  19. package/ios/Video/CCRCTVideo.h +67 -0
  20. package/ios/Video/CCRCTVideo.m +2031 -0
  21. package/ios/Video/CCRCTVideoManager.h +6 -0
  22. package/ios/Video/CCRCTVideoManager.m +133 -0
  23. package/ios/Video/CCRCTVideoPlayerViewController.h +20 -0
  24. package/ios/Video/CCRCTVideoPlayerViewController.m +43 -0
  25. package/ios/Video/CCRCTVideoPlayerViewControllerDelegate.h +7 -0
  26. package/ios/Video/UIView+FindUIViewController.h +15 -0
  27. package/ios/Video/UIView+FindUIViewController.m +21 -0
  28. package/ios/VideoCaching/RCTVideoCache.h +38 -0
  29. package/ios/VideoCaching/RCTVideoCache.m +174 -0
  30. package/ios/VideoPickerModule.h +7 -0
  31. package/ios/VideoPickerModule.mm +95 -0
  32. package/package.json +3 -4
  33. package/react-native-cometchat-ui-kit.podspec +24 -10
  34. package/src/CometChatContacts/CometChatContacts.tsx +12 -9
  35. package/src/CometChatConversations/CometChatConversations.tsx +84 -64
  36. package/src/CometChatDetails/CometChatDetails.tsx +14 -12
  37. package/src/CometChatGroupMembers/CometChatGroupMembers.tsx +8 -4
  38. package/src/CometChatGroupMembers/resources/check.png +0 -0
  39. package/src/CometChatGroupMembers/resources/index.ts +2 -0
  40. package/src/CometChatGroups/CometChatGroups.tsx +4 -4
  41. package/src/CometChatMessageComposer/CometChatMessageComposer.tsx +57 -15
  42. package/src/CometChatMessageHeader/CometChatMessageHeader.tsx +9 -2
  43. package/src/CometChatMessageInformation/CometChatMessageInformation.tsx +1 -1
  44. package/src/CometChatMessageList/CometChatMessageList.tsx +596 -181
  45. package/src/CometChatMessageList/MessageListConfiguration.ts +55 -4
  46. package/src/CometChatMessageList/resources/index.ts +5 -1
  47. package/src/CometChatMessageList/resources/leftarrowcurve.png +0 -0
  48. package/src/CometChatMessageList/resources/rightarrowcurve.png +0 -0
  49. package/src/CometChatMessages/CometChatMessages.tsx +1 -1
  50. package/src/CometChatThreadedMessages/CometChatThreadedMessages.tsx +4 -12
  51. package/src/CometChatThreadedMessages/style.ts +3 -1
  52. package/src/CometChatUsers/CometChatUsers.tsx +1 -1
  53. package/src/calls/CallUtils.ts +4 -8
  54. package/src/calls/CallingExtentionDecorator.tsx +5 -2
  55. package/src/calls/CometChatCallBubble/styles.ts +2 -1
  56. package/src/calls/CometChatCallButtons/CometChatCallButtons.tsx +14 -3
  57. package/src/calls/CometChatIncomingCall/CometChatIncomingCall.tsx +9 -9
  58. package/src/calls/CometChatOutgoingCall/CometChatOutgoingCall.tsx +80 -73
  59. package/src/extensions/CollaborativeBubble/styles.ts +2 -0
  60. package/src/extensions/SmartReplies/SmartRepliesDecorator.tsx +11 -0
  61. package/src/extensions/index.ts +0 -4
  62. package/src/index.ts +53 -8
  63. package/src/shared/CometChatUiKit/CometChatUIKit.ts +14 -2
  64. package/src/shared/constants/UIKitConstants.ts +1 -0
  65. package/src/shared/events/CometChatUIEventHandler/CometChatUIEventHandler.ts +6 -0
  66. package/src/shared/events/CometChatUIEventHandler/Listener.ts +8 -0
  67. package/src/shared/events/ListenerInitializer.ts +6 -0
  68. package/src/shared/events/messages.ts +2 -0
  69. package/src/shared/framework/MessageDataSource.tsx +29 -25
  70. package/src/shared/index.ts +49 -1
  71. package/src/shared/libs/VideoPlayer/DRMType.js +6 -0
  72. package/src/shared/libs/VideoPlayer/FilterType.js +18 -0
  73. package/src/shared/libs/VideoPlayer/TextTrackType.js +5 -0
  74. package/src/shared/libs/VideoPlayer/Video.js +519 -0
  75. package/src/shared/libs/VideoPlayer/VideoResizeMode.js +5 -0
  76. package/src/shared/libs/VideoPlayerControls/OSSupport/PlatformSupport.tsx +43 -0
  77. package/src/shared/libs/VideoPlayerControls/OSSupport/TVOSSupport.tsx +16 -0
  78. package/src/shared/libs/VideoPlayerControls/OSSupport/index.tsx +1 -0
  79. package/src/shared/libs/VideoPlayerControls/VideoPlayer.tsx +511 -0
  80. package/src/shared/libs/VideoPlayerControls/assets/img/back.png +0 -0
  81. package/src/shared/libs/VideoPlayerControls/assets/img/back@2x.png +0 -0
  82. package/src/shared/libs/VideoPlayerControls/assets/img/back@3x.png +0 -0
  83. package/src/shared/libs/VideoPlayerControls/assets/img/bottom-vignette.png +0 -0
  84. package/src/shared/libs/VideoPlayerControls/assets/img/bottom-vignette@2x.png +0 -0
  85. package/src/shared/libs/VideoPlayerControls/assets/img/bottom-vignette@3x.png +0 -0
  86. package/src/shared/libs/VideoPlayerControls/assets/img/error-icon.png +0 -0
  87. package/src/shared/libs/VideoPlayerControls/assets/img/error-icon@2x.png +0 -0
  88. package/src/shared/libs/VideoPlayerControls/assets/img/error-icon@3x.png +0 -0
  89. package/src/shared/libs/VideoPlayerControls/assets/img/expand.png +0 -0
  90. package/src/shared/libs/VideoPlayerControls/assets/img/expand@2x.png +0 -0
  91. package/src/shared/libs/VideoPlayerControls/assets/img/expand@3x.png +0 -0
  92. package/src/shared/libs/VideoPlayerControls/assets/img/forward.png +0 -0
  93. package/src/shared/libs/VideoPlayerControls/assets/img/forward@2x.png +0 -0
  94. package/src/shared/libs/VideoPlayerControls/assets/img/forward@3x.png +0 -0
  95. package/src/shared/libs/VideoPlayerControls/assets/img/loader-icon.png +0 -0
  96. package/src/shared/libs/VideoPlayerControls/assets/img/loader-icon@2x.png +0 -0
  97. package/src/shared/libs/VideoPlayerControls/assets/img/loader-icon@3x.png +0 -0
  98. package/src/shared/libs/VideoPlayerControls/assets/img/pause.png +0 -0
  99. package/src/shared/libs/VideoPlayerControls/assets/img/pause@2x.png +0 -0
  100. package/src/shared/libs/VideoPlayerControls/assets/img/pause@3x.png +0 -0
  101. package/src/shared/libs/VideoPlayerControls/assets/img/play.png +0 -0
  102. package/src/shared/libs/VideoPlayerControls/assets/img/play@2x.png +0 -0
  103. package/src/shared/libs/VideoPlayerControls/assets/img/play@3x.png +0 -0
  104. package/src/shared/libs/VideoPlayerControls/assets/img/rewind.png +0 -0
  105. package/src/shared/libs/VideoPlayerControls/assets/img/rewind@2x.png +0 -0
  106. package/src/shared/libs/VideoPlayerControls/assets/img/rewind@3x.png +0 -0
  107. package/src/shared/libs/VideoPlayerControls/assets/img/shrink.png +0 -0
  108. package/src/shared/libs/VideoPlayerControls/assets/img/shrink@2x.png +0 -0
  109. package/src/shared/libs/VideoPlayerControls/assets/img/shrink@3x.png +0 -0
  110. package/src/shared/libs/VideoPlayerControls/assets/img/top-vignette.png +0 -0
  111. package/src/shared/libs/VideoPlayerControls/assets/img/top-vignette@2x.png +0 -0
  112. package/src/shared/libs/VideoPlayerControls/assets/img/top-vignette@3x.png +0 -0
  113. package/src/shared/libs/VideoPlayerControls/assets/img/volume.png +0 -0
  114. package/src/shared/libs/VideoPlayerControls/assets/img/volume@2x.png +0 -0
  115. package/src/shared/libs/VideoPlayerControls/assets/img/volume@3x.png +0 -0
  116. package/src/shared/libs/VideoPlayerControls/components/Back/Back.tsx +28 -0
  117. package/src/shared/libs/VideoPlayerControls/components/Back/index.ts +1 -0
  118. package/src/shared/libs/VideoPlayerControls/components/BottomControls.tsx +142 -0
  119. package/src/shared/libs/VideoPlayerControls/components/Control.tsx +45 -0
  120. package/src/shared/libs/VideoPlayerControls/components/Error/Error.tsx +22 -0
  121. package/src/shared/libs/VideoPlayerControls/components/Error/index.ts +1 -0
  122. package/src/shared/libs/VideoPlayerControls/components/Error/styles.ts +21 -0
  123. package/src/shared/libs/VideoPlayerControls/components/Fullscreen.tsx +36 -0
  124. package/src/shared/libs/VideoPlayerControls/components/Loader/Loader.tsx +15 -0
  125. package/src/shared/libs/VideoPlayerControls/components/Loader/index.ts +1 -0
  126. package/src/shared/libs/VideoPlayerControls/components/Loader/styles.ts +16 -0
  127. package/src/shared/libs/VideoPlayerControls/components/NullControl.tsx +7 -0
  128. package/src/shared/libs/VideoPlayerControls/components/Overlay.tsx +23 -0
  129. package/src/shared/libs/VideoPlayerControls/components/PlayPause/PlayPause.tsx +109 -0
  130. package/src/shared/libs/VideoPlayerControls/components/PlayPause/index.ts +1 -0
  131. package/src/shared/libs/VideoPlayerControls/components/PlayPause/styles.ts +21 -0
  132. package/src/shared/libs/VideoPlayerControls/components/Seekbar/Seekbar.tsx +47 -0
  133. package/src/shared/libs/VideoPlayerControls/components/Seekbar/index.ts +1 -0
  134. package/src/shared/libs/VideoPlayerControls/components/Seekbar/styles.ts +37 -0
  135. package/src/shared/libs/VideoPlayerControls/components/Timer/Timer.tsx +28 -0
  136. package/src/shared/libs/VideoPlayerControls/components/Timer/index.ts +1 -0
  137. package/src/shared/libs/VideoPlayerControls/components/Timer/styles.ts +12 -0
  138. package/src/shared/libs/VideoPlayerControls/components/Title.tsx +35 -0
  139. package/src/shared/libs/VideoPlayerControls/components/TopControls.tsx +110 -0
  140. package/src/shared/libs/VideoPlayerControls/components/Volume/Volume.tsx +37 -0
  141. package/src/shared/libs/VideoPlayerControls/components/Volume/index.ts +1 -0
  142. package/src/shared/libs/VideoPlayerControls/components/Volume/styles.ts +31 -0
  143. package/src/shared/libs/VideoPlayerControls/components/index.ts +14 -0
  144. package/src/shared/libs/VideoPlayerControls/components/styles.ts +30 -0
  145. package/src/shared/libs/VideoPlayerControls/hooks/index.ts +3 -0
  146. package/src/shared/libs/VideoPlayerControls/hooks/useAnimations.ts +68 -0
  147. package/src/shared/libs/VideoPlayerControls/hooks/useControlTimeout.tsx +67 -0
  148. package/src/shared/libs/VideoPlayerControls/hooks/usePanResponders.tsx +96 -0
  149. package/src/shared/libs/VideoPlayerControls/index.ts +4 -0
  150. package/src/shared/libs/VideoPlayerControls/styles.ts +19 -0
  151. package/src/shared/libs/VideoPlayerControls/types.ts +290 -0
  152. package/src/shared/libs/VideoPlayerControls/utils.ts +76 -0
  153. package/src/shared/modals/CometChatMessageTemplate.ts +113 -9
  154. package/src/shared/modals/InteractiveData/InteractiveMessage/SchedulerMessage.ts +23 -21
  155. package/src/shared/resources/CometChatLocalize/resources/ar/translation.json +4 -1
  156. package/src/shared/resources/CometChatLocalize/resources/de/translation.json +4 -1
  157. package/src/shared/resources/CometChatLocalize/resources/en/translation.json +6 -3
  158. package/src/shared/resources/CometChatLocalize/resources/es/translation.json +4 -1
  159. package/src/shared/resources/CometChatLocalize/resources/fr/translation.json +4 -1
  160. package/src/shared/resources/CometChatLocalize/resources/hi/translation.json +4 -1
  161. package/src/shared/resources/CometChatLocalize/resources/lt/translation.json +4 -1
  162. package/src/shared/resources/CometChatLocalize/resources/ms/translation.json +4 -1
  163. package/src/shared/resources/CometChatLocalize/resources/pt/translation.json +4 -1
  164. package/src/shared/resources/CometChatLocalize/resources/ru/translation.json +4 -1
  165. package/src/shared/resources/CometChatLocalize/resources/sv/translation.json +4 -1
  166. package/src/shared/resources/CometChatLocalize/resources/zh/translation.json +4 -1
  167. package/src/shared/resources/CometChatLocalize/resources/zh-tw/translation.json +4 -1
  168. package/src/shared/resources/CometChatTheme/Palette.ts +79 -45
  169. package/src/shared/resources/CometChatTheme/Typography.ts +18 -0
  170. package/src/shared/utils/CommonUtils.ts +71 -0
  171. package/src/shared/utils/PermissionUtilIOS.ts +104 -0
  172. package/src/shared/views/CometChatActionSheet/ActionSheetStyle.ts +3 -1
  173. package/src/shared/views/CometChatActionSheet/CometChatActionSheet.tsx +6 -6
  174. package/src/shared/views/CometChatAudioBubble/CometChatAudioBubble.tsx +28 -5
  175. package/src/shared/views/CometChatAudioBubble/style.ts +4 -2
  176. package/src/shared/views/CometChatAvatar/AvatarStyle.ts +1 -1
  177. package/src/shared/views/CometChatBottomSheet/CometChatBottomSheet.tsx +4 -3
  178. package/src/shared/views/CometChatEmojiKeyboard/CometChatEmojiKeyboard.tsx +47 -31
  179. package/src/shared/views/CometChatEmojiKeyboard/EmojiKeyboardConfiguration.ts +5 -5
  180. package/src/shared/views/CometChatEmojiKeyboard/EmojiKeyboardStyle.ts +12 -13
  181. package/src/shared/views/CometChatFileBubble/CometChatFileBubble.tsx +52 -5
  182. package/src/shared/views/CometChatFileBubble/style.ts +4 -2
  183. package/src/shared/views/CometChatImageBubble/CometChatImageBubble.tsx +25 -2
  184. package/src/shared/views/CometChatList/CometChatList.tsx +2 -1
  185. package/src/shared/views/CometChatMessageBubble/CometChatMessageBubble.tsx +51 -2
  186. package/src/shared/views/CometChatQuickReactions/CometChatQuickReactions.tsx +76 -0
  187. package/src/shared/views/CometChatQuickReactions/QuickReactionsConfiguration.tsx +12 -0
  188. package/src/shared/views/CometChatQuickReactions/QuickReactionsStyle.tsx +35 -0
  189. package/src/shared/views/CometChatQuickReactions/index.ts +12 -0
  190. package/src/shared/views/CometChatReactions/CometChatReactions.tsx +166 -0
  191. package/src/shared/views/CometChatReactions/ReactionsConfiguration.tsx +12 -0
  192. package/src/shared/views/CometChatReactions/ReactionsStyle.tsx +43 -0
  193. package/src/shared/views/CometChatReactions/index.ts +12 -0
  194. package/src/{extensions/Reactions/CometChatMessageReactions → shared/views/CometChatReactions}/style.ts +7 -7
  195. package/src/shared/views/CometChatReactionsList/CometChatReactionsList.tsx +335 -0
  196. package/src/shared/views/CometChatReactionsList/ReactionsListConfiguration.tsx +14 -0
  197. package/src/shared/views/CometChatReactionsList/ReactionsListStyle.tsx +67 -0
  198. package/src/shared/views/CometChatReactionsList/index.ts +12 -0
  199. package/src/shared/views/CometChatReactionsList/resources/Spineer.png +0 -0
  200. package/src/shared/views/CometChatReactionsList/resources/index.ts +5 -0
  201. package/src/shared/views/CometChatReceipt/CometChatReceipt.tsx +21 -4
  202. package/src/shared/views/CometChatReceipt/MessageConfiguration.ts +12 -0
  203. package/src/shared/views/CometChatReceipt/resources/error.png +0 -0
  204. package/src/shared/views/CometChatTextBubble/CometChatTextBubble.tsx +1 -1
  205. package/src/shared/views/CometChatVideoBubble/CometChatVideoBubble.tsx +78 -12
  206. package/src/shared/views/CometChatVideoBubble/VideoBubbleStyle.ts +52 -2
  207. package/src/shared/views/CometChatVideoPlayer/CometChatVideoPlayer.tsx +134 -0
  208. package/src/shared/views/CometChatVideoPlayer/index.tsx +1 -0
  209. package/src/shared/views/index.ts +30 -0
  210. package/android/.gradle/7.4.2/checksums/checksums.lock +0 -0
  211. package/android/.gradle/7.4.2/fileChanges/last-build.bin +0 -0
  212. package/android/.gradle/7.4.2/fileHashes/fileHashes.lock +0 -0
  213. package/android/.gradle/7.4.2/gc.properties +0 -0
  214. package/android/.gradle/checksums/checksums.lock +0 -0
  215. package/android/.idea/gradle.xml +0 -13
  216. package/android/.idea/misc.xml +0 -8
  217. package/android/.idea/modules/android.iml +0 -18
  218. package/android/.idea/modules.xml +0 -8
  219. package/android/.idea/vcs.xml +0 -6
  220. package/android/local.properties +0 -8
  221. package/src/extensions/Reactions/CometChatMessageReactions/CometChatMessageReactions.tsx +0 -249
  222. package/src/extensions/Reactions/CometChatMessageReactions/index.ts +0 -3
  223. package/src/extensions/Reactions/ReactionsDecorator.tsx +0 -164
  224. package/src/extensions/Reactions/ReactionsExtension.tsx +0 -48
  225. package/src/extensions/Reactions/index.ts +0 -4
  226. /package/src/{extensions/Reactions → shared/views/CometChatQuickReactions}/resources/AddReactions.png +0 -0
  227. /package/src/{extensions/Reactions → shared/views/CometChatQuickReactions}/resources/index.ts +0 -0
@@ -110,7 +110,7 @@ const CometChatBottomSheet = forwardRef((props: CometChatBottomSheetInterface, r
110
110
  >
111
111
  <KeyboardAvoidingView style={{ flex: 1 }} behavior={Platform.OS === 'ios' ? 'padding' : 'height'}
112
112
  >
113
- <ScrollView contentContainerStyle={Styles.wrapperStyle}>
113
+ <View style={Styles.wrapperStyle}>
114
114
  <View
115
115
  style={Styles.greyWrapperStyle}
116
116
  onStartShouldSetResponder={() => togglePanel()}
@@ -124,6 +124,7 @@ const CometChatBottomSheet = forwardRef((props: CometChatBottomSheetInterface, r
124
124
  style?.backgroundColor ?? theme.palette.getBackgroundColor(),
125
125
  shadowColor: style?.shadowColor ?? theme.palette.getAccent(),
126
126
  maxHeight: sliderMaxHeight,
127
+ minHeight: sliderMinHeight,
127
128
  transform: [
128
129
  { translateY: panelHeightValue },
129
130
  { scale: isOpen ? 1 : 0 },
@@ -135,7 +136,7 @@ const CometChatBottomSheet = forwardRef((props: CometChatBottomSheetInterface, r
135
136
  >
136
137
  <View
137
138
  style={Styles.outerContentStyle}
138
- {..._childPanResponder?.panHandlers}
139
+ // {..._childPanResponder?.panHandlers}
139
140
  >
140
141
  <TouchableOpacity
141
142
  onPress={togglePanel.bind(this)}
@@ -161,7 +162,7 @@ const CometChatBottomSheet = forwardRef((props: CometChatBottomSheetInterface, r
161
162
  </View>
162
163
  </View>
163
164
  </Animated.View>
164
- </ScrollView>
165
+ </View>
165
166
  </KeyboardAvoidingView>
166
167
  </Modal>
167
168
  );
@@ -1,4 +1,4 @@
1
- import React, { useCallback, useImperativeHandle, useRef, useState } from 'react';
1
+ import React, { useCallback, useImperativeHandle, useRef, useState, useContext } from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import { Emojis } from './emojis';
4
4
  import { Styles } from './style';
@@ -10,6 +10,7 @@ import {
10
10
  TouchableOpacity,
11
11
  Image,
12
12
  } from 'react-native';
13
+ import { EmojiKeyboardConfiguration } from './EmojiKeyboardConfiguration';
13
14
 
14
15
  const emojiValues = Object.values(Emojis);
15
16
 
@@ -20,7 +21,11 @@ const viewConfig = {
20
21
 
21
22
  type CategoryListInterface = {
22
23
  theme: CometChatTheme,
23
- onCategorySelected: (id: string, index: number) => void
24
+ onCategorySelected: (id: string, index: number) => void,
25
+ style?: {
26
+ categoryIconTint?: string
27
+ selectedCategoryIconTint?: string
28
+ }
24
29
  }
25
30
 
26
31
  type CategoryListActions = {
@@ -28,10 +33,10 @@ type CategoryListActions = {
28
33
  }
29
34
 
30
35
  const CategoryList = React.forwardRef<
31
- CategoryListActions,
32
- CategoryListInterface
36
+ CategoryListActions,
37
+ CategoryListInterface
33
38
  >((
34
- {theme, onCategorySelected}, ref) => {
39
+ { theme, onCategorySelected, style }, ref) => {
35
40
  const [activeCategory, setActiveCategory] = useState('people');
36
41
 
37
42
  useImperativeHandle(ref, () => {
@@ -53,14 +58,14 @@ CategoryListInterface
53
58
  style={[Styles.getListStyle]}
54
59
  key={emojiCategory.id}
55
60
  onPress={() => {
56
- onCategorySelected && onCategorySelected(emojiCategory.id,index);
61
+ onCategorySelected && onCategorySelected(emojiCategory.id, index);
57
62
  }}
58
63
  >
59
64
  <Image
60
65
  style={{
61
66
  tintColor: activeCategory == emojiCategory.id
62
- ? theme?.palette?.getPrimary()
63
- : theme?.palette?.getAccent600(),
67
+ ? (style?.selectedCategoryIconTint || theme?.palette?.getPrimary())
68
+ : (style?.categoryIconTint || theme?.palette?.getAccent600()),
64
69
  }}
65
70
  source={emojiCategory.symbol}
66
71
  />
@@ -84,8 +89,21 @@ CategoryListInterface
84
89
  *
85
90
  */
86
91
 
87
- const CometChatEmojiKeyboard = (props) => {
88
- const theme = new CometChatTheme(props?.theme ?? {});
92
+ const CometChatEmojiKeyboard = (props: EmojiKeyboardConfiguration) => {
93
+ const theme: CometChatTheme = new CometChatTheme(props?.theme ?? {});
94
+
95
+ const { onClick, style } = props;
96
+
97
+ const {
98
+ categoryBackground,
99
+ categoryIconTint,
100
+ sectionHeaderColor,
101
+ sectionHeaderFont,
102
+ selectedCategoryIconTint,
103
+ backgroundColor,
104
+ height,
105
+ width
106
+ } = style;
89
107
 
90
108
  const emojiRef = useRef(null);
91
109
  const categoryRef = useRef(null);
@@ -95,8 +113,8 @@ const CometChatEmojiKeyboard = (props) => {
95
113
  emojiRef.current.scrollToIndex({ index, animated: true });
96
114
  };
97
115
 
98
- const handleEvent = (obj) => {
99
- props.onClick(obj);
116
+ const handleEvent = (emoji: string) => {
117
+ onClick && onClick(emoji);
100
118
  };
101
119
 
102
120
  const emojiRender = useCallback(({ item }) => {
@@ -107,7 +125,7 @@ const CometChatEmojiKeyboard = (props) => {
107
125
  Styles.listStyle,
108
126
  {
109
127
  backgroundColor:
110
- props.style?.backgroundColor ||
128
+ backgroundColor ||
111
129
  theme?.palette?.getBackgroundColor(),
112
130
  },
113
131
  ]}
@@ -137,8 +155,8 @@ const CometChatEmojiKeyboard = (props) => {
137
155
  style={[
138
156
  Styles.emojiCategoryTitle,
139
157
  theme?.typography?.caption1,
140
- ...props.style?.sectionHeaderFont,
141
- { color: theme?.palette?.getAccent500() },
158
+ sectionHeaderFont,
159
+ { color: sectionHeaderColor || theme?.palette?.getAccent500() },
142
160
  ]}
143
161
  >
144
162
  {name}
@@ -164,10 +182,10 @@ const CometChatEmojiKeyboard = (props) => {
164
182
  style={[
165
183
  Styles.emojiContainerStyle,
166
184
  {
167
- width: props.style?.width,
168
- height: props.style?.height,
185
+ width: width,
186
+ height: height,
169
187
  backgroundColor:
170
- props.style?.backgroundColor ||
188
+ backgroundColor ||
171
189
  theme?.palette?.getBackgroundColor(),
172
190
  },
173
191
  ]}
@@ -184,23 +202,23 @@ const CometChatEmojiKeyboard = (props) => {
184
202
  ]}
185
203
  data={emojiValues}
186
204
  viewabilityConfig={viewConfig}
187
- onViewableItemsChanged={({changed, viewableItems}) => {
205
+ onViewableItemsChanged={({ changed, viewableItems }) => {
188
206
  let changedItem = changed[0];
189
207
  if (changedItem.isViewable) {
190
208
  categoryRef.current?.updateCategory(changedItem.key);
191
209
  }
192
210
  }}
193
211
  windowSize={50}
194
- onScrollToIndexFailed={(error) => {}}
212
+ onScrollToIndexFailed={(error) => { }}
195
213
  renderItem={emojiListRender}
196
214
  />
197
215
  <View
198
216
  style={[
199
217
  Styles.emojiTabLsitStyle,
200
218
  {
201
- width: props.style?.width,
219
+ width: width,
202
220
  backgroundColor:
203
- props.style?.categoryBackground ||
221
+ categoryBackground ||
204
222
  theme?.palette?.getBackgroundColor(),
205
223
  },
206
224
  ]}
@@ -209,6 +227,10 @@ const CometChatEmojiKeyboard = (props) => {
209
227
  ref={categoryRef}
210
228
  theme={theme}
211
229
  onCategorySelected={(id, index) => changeCategory(id, index)}
230
+ style={{
231
+ categoryIconTint: categoryIconTint,
232
+ selectedCategoryIconTint: selectedCategoryIconTint,
233
+ }}
212
234
  />
213
235
  </View>
214
236
  </View>
@@ -217,24 +239,18 @@ const CometChatEmojiKeyboard = (props) => {
217
239
 
218
240
  // Specifies the default values for props:
219
241
  CometChatEmojiKeyboard.defaultProps = {
220
- hideSearch: false,
221
- onClick: () => {},
242
+ // hideSearch: false,
243
+ onClick: () => { },
222
244
  style: {
223
245
  width: '100%',
224
246
  height: 310,
225
247
  border: {},
226
- backgroundColor: 'rgb(255,255,255)',
227
248
  borderRadius: 8,
228
- sectionHeaderFont: '',
229
- sectionHeaderColor: 'rgba(20,20,20,0.58)',
230
- categoryIconTint: 'RGBA(20, 20, 20, 0.58)',
231
- selectedCategoryIconTint: '#39f',
232
- categoryBackground: 'rgb(255,255,255)',
233
249
  },
234
250
  };
235
251
 
236
252
  CometChatEmojiKeyboard.propTypes = {
237
- hideSearch: PropTypes.bool,
253
+ // hideSearch: PropTypes.bool,
238
254
  onClick: PropTypes.func,
239
255
  style: PropTypes.object,
240
256
  };
@@ -3,21 +3,21 @@ import { EmojiKeyboardStyle } from "./EmojiKeyboardStyle";
3
3
  /**
4
4
  * @class EmojiKeyboardConfiguration
5
5
  * @description EmojiKeyboardConfiguration class is used for defining the EmojiKeyboard templates.
6
- * @param {Boolean} hideSearch
6
+ // * @param {Boolean} hideSearch
7
7
  * @param {Function} onClick
8
8
  * @param {Object} style
9
9
  */
10
10
 
11
11
  class EmojiKeyboardConfiguration {
12
- hideSearch: boolean;
13
- onClick: any;
14
- style: EmojiKeyboardStyle;
12
+ // hideSearch?: boolean;
13
+ onClick?: (emoji: string) => void;
14
+ style?: EmojiKeyboardStyle;
15
15
  constructor({
16
16
  hideSearch = true,
17
17
  onClick = null,
18
18
  style = new EmojiKeyboardStyle({}),
19
19
  }) {
20
- this.hideSearch = hideSearch;
20
+ // this.hideSearch = hideSearch;
21
21
  this.onClick = onClick;
22
22
  this.style = style;
23
23
  }
@@ -1,4 +1,4 @@
1
- import { BaseStyle,FontStyle } from "../../../shared/base";
1
+ import { BaseStyle, FontStyle } from "../../../shared/base";
2
2
  /**
3
3
  * @class EmojiKeyboardStyle
4
4
  * @param {String} sectionHeaderFont
@@ -8,21 +8,20 @@ import { BaseStyle,FontStyle } from "../../../shared/base";
8
8
  */
9
9
 
10
10
  class EmojiKeyboardStyle extends BaseStyle {
11
- sectionHeaderFont: FontStyle;
12
- sectionHeaderColor: string;
13
- categoryIconTint: string;
14
- selectedCategoryIconTint: string;
15
- categoryBackground: string;
11
+ sectionHeaderFont?: FontStyle;
12
+ sectionHeaderColor?: string;
13
+ categoryIconTint?: string;
14
+ selectedCategoryIconTint?: string;
15
+ categoryBackground?: string;
16
16
  constructor({
17
- sectionHeaderFont = {},
18
- sectionHeaderColor = "",
19
- categoryIconTint = "",
20
- selectedCategoryIconTint = "",
21
- categoryBackground = "",
22
-
17
+ sectionHeaderFont,
18
+ sectionHeaderColor,
19
+ categoryIconTint,
20
+ selectedCategoryIconTint,
21
+ categoryBackground,
23
22
  width = "100%",
24
23
  height = 330,
25
- backgroundColor = "",
24
+ backgroundColor,
26
25
  // border = 0,
27
26
  borderRadius = 8,
28
27
  }) {
@@ -1,5 +1,5 @@
1
- import React, { useContext } from "react";
2
- import { TouchableOpacity, View, Image, NativeModules, Text, Platform } from "react-native";
1
+ import React, { useContext, useRef } from "react";
2
+ import { View, Image, NativeModules, Text, Platform } from "react-native";
3
3
  import { downloadIcon, fileIcon } from "./resources";
4
4
  import { CometChatContext } from "../../CometChatContext"
5
5
  import { FileBubbleStyle, FileBubbleStyleInterface } from "./FileBubbleStyle";
@@ -89,13 +89,60 @@ export const CometChatFileBubble = ({
89
89
  return (fileUrl.substring(fileUrl.lastIndexOf("/") + 1, fileUrl.length)).replace(" ", "_");
90
90
  }
91
91
 
92
+ const wrapperPressTime = useRef(0);
92
93
  let viewProps = Platform.OS === "ios" ? {
93
- onTouchEnd: downloadAndOpen
94
+ onTouchStart: () => {
95
+ wrapperPressTime.current = Date.now();
96
+ },
97
+ // onTouchMove: () => {
98
+ // wrapperPressTime.current = null
99
+ // },
100
+ onTouchEnd: () => {
101
+ // if (wrapperPressTime.current === null) return;
102
+ const endTime = Date.now();
103
+ const pressDuration = endTime - wrapperPressTime.current;
104
+ if (pressDuration < 500) {
105
+ downloadAndOpen();
106
+ }
107
+ }
94
108
  } : {};
95
109
 
110
+ const pressTimeOnAndroid = useRef(0);
111
+
112
+ let viewPropsForAndroid = Platform.OS === "android" ? {
113
+ onTouchStart: () => {
114
+ pressTimeOnAndroid.current = Date.now();
115
+ },
116
+ // onTouchMove: () => {
117
+ // pressTimeOnAndroid.current = null
118
+ // }
119
+ } : {};
120
+
121
+ const shouldDownloadAndOpen = () => {
122
+ if (Platform.OS === "android") {
123
+ // if (pressTimeOnAndroid.current === null) return;
124
+ const endTime = Date.now();
125
+ const pressDuration = endTime - pressTimeOnAndroid.current;
126
+ if (pressDuration < 500) {
127
+ downloadAndOpen();
128
+ }
129
+ }
130
+ }
131
+
132
+ const shouldDownload = () => {
133
+ if (Platform.OS === "android") {
134
+ if (pressTimeOnAndroid.current === null) return;
135
+ const endTime = Date.now();
136
+ const pressDuration = endTime - pressTimeOnAndroid.current;
137
+ if (pressDuration < 500) {
138
+ downloadFile();
139
+ }
140
+ }
141
+ }
142
+
96
143
  return (
97
144
  <View {...viewProps} style={[Style.container, { backgroundColor, borderWidth: border.borderWidth, borderColor: border.borderColor, borderRadius, height, width }]}>
98
- <View onTouchEnd={Platform.OS === "android" ? downloadAndOpen : () => { }} style={Style.messageInfoStyle}>
145
+ <View {...viewPropsForAndroid} onTouchEnd={shouldDownloadAndOpen} style={Style.messageInfoStyle}>
99
146
  {
100
147
  title && <Text
101
148
  numberOfLines={1}
@@ -115,7 +162,7 @@ export const CometChatFileBubble = ({
115
162
  </Text>
116
163
  }
117
164
  </View>
118
- <View onTouchEnd={Platform.OS === "android" ? downloadFile.bind(this) : () => { }} style={Style.downloadImage}>
165
+ <View {...viewPropsForAndroid} onTouchEnd={shouldDownload} style={Style.downloadImage}>
119
166
  <Image source={icon || (Platform.OS === "ios" ? fileIcon : downloadIcon)} style={[Style.imageStyle, { tintColor: iconTint }]} />
120
167
  </View>
121
168
  </View>
@@ -9,7 +9,8 @@ export const Style = StyleSheet.create({
9
9
  borderRadius: 8,
10
10
  opacity: 1,
11
11
  backgroundColor: "rgba(20, 20, 20, 0.04)",
12
- padding: 8
12
+ padding: 8,
13
+ paddingBottom: 0
13
14
  },
14
15
  messageInfoStyle: {
15
16
  flex: 1,
@@ -21,7 +22,8 @@ export const Style = StyleSheet.create({
21
22
  downloadImage: {
22
23
  height: 24,
23
24
  width: 24,
24
- margin: 8,
25
+ marginRight: 8,
26
+ marginLeft: 4,
25
27
  alignSelf: 'center'
26
28
  },
27
29
  titleStyle: {
@@ -96,10 +96,33 @@ export const CometChatImageBubble = (props: CometChatImageBubbleInterface) => {
96
96
  }
97
97
  }, []);
98
98
 
99
+ const pressTime = useRef(0);
100
+
101
+ const handleTouchStart = () => {
102
+ pressTime.current = Date.now();
103
+ };
104
+
105
+ const handleTouchEnd = () => {
106
+ // if (pressTime.current === null) return;
107
+ const endTime = Date.now();
108
+ const pressDuration = endTime - pressTime.current;
109
+ if (pressDuration < 500) {
110
+ openImage();
111
+ }
112
+ };
113
+
114
+ // const onTouchMove = () => {
115
+ // pressTime.current = null
116
+ // }
117
+
99
118
  return (
100
- <View onTouchEnd={openImage}>
119
+ <View
120
+ onTouchStart={handleTouchStart}
121
+ onTouchEnd={handleTouchEnd}
122
+ // onTouchMove={onTouchMove}
123
+ >
101
124
  <Image
102
- resizeMode={resizeMode || (Platform.OS == "android" ? "cover" : "contain")}
125
+ resizeMode={resizeMode || "cover"}
103
126
  loadingIndicatorSource={placeHolderImage}
104
127
  source={thumbnailUrl ?? imageUrl} style={{
105
128
  height, width,
@@ -34,6 +34,7 @@ import { ListItemStyleInterface } from '../CometChatListItem/ListItemStyle';
34
34
  import { AvatarStyleInterface } from '../CometChatAvatar/AvatarStyle';
35
35
  import { CometChatContextType } from '../../base/Types';
36
36
  import { CometChat } from '@cometchat/chat-sdk-react-native';
37
+ import { StatusIndicatorStyleInterface } from '../CometChatStatusIndicator';
37
38
 
38
39
  export interface CometChatListActionsInterface {
39
40
  updateList: (prop: any) => void;
@@ -98,7 +99,7 @@ export interface CometChatListProps {
98
99
  onBack?: Function;
99
100
  selectionIcon?: ImageType;
100
101
  listItemKey: 'uid' | 'guid' | 'conversationId';
101
- statusIndicatorStyle?: StyleProp<ViewStyle>;
102
+ statusIndicatorStyle?: StatusIndicatorStyleInterface;
102
103
  avatarStyle?: AvatarStyleInterface;
103
104
  listItemStyle?: ListItemStyleInterface;
104
105
  headViewContainerStyle?: StyleProp<ViewStyle>;
@@ -7,20 +7,66 @@ import { MessageBubbleStyle } from "./MessageBubbleStyle";
7
7
  import { memo } from "react";
8
8
 
9
9
  export interface CometChatMessageBubbleInterface {
10
+ /**
11
+ * The id of the message bubble.
12
+ * @type string
13
+ */
10
14
  id: string,
15
+ /**
16
+ * The leading view of the message bubble.
17
+ * @type () => JSX.Element
18
+ */
11
19
  LeadingView?: () => JSX.Element,
20
+ /**
21
+ * The header view of the message bubble.
22
+ * @type () => JSX.Element
23
+ */
12
24
  HeaderView?: () => JSX.Element,
25
+ /**
26
+ * The status info view of the message bubble.
27
+ * @type () => JSX.Element
28
+ */
29
+ StatusInfoView?: () => JSX.Element,
30
+ /**
31
+ * The reply view of the message bubble.
32
+ * @type () => JSX.Element
33
+ */
13
34
  ReplyView?: () => JSX.Element,
35
+ /**
36
+ * The bottom view of the message bubble.
37
+ * @type () => JSX.Element
38
+ */
14
39
  BottomView?: () => JSX.Element,
40
+ /**
41
+ * The content view of the message bubble.
42
+ * @type () => JSX.Element
43
+ */
15
44
  ContentView?: () => JSX.Element,
45
+ /**
46
+ * The thread view of the message bubble.
47
+ * @type () => JSX.Element
48
+ */
16
49
  ThreadView?: () => JSX.Element,
50
+ /**
51
+ * The footer view of the message bubble.
52
+ * @type () => JSX.Element
53
+ */
17
54
  FooterView?: () => JSX.Element,
55
+ /**
56
+ * The alignment of the message bubble.
57
+ * @type MessageBubbleAlignmentType
58
+ */
18
59
  alignment?: MessageBubbleAlignmentType,
60
+ /**
61
+ * The style of the message bubble.
62
+ * @type BaseStyleInterface
63
+ */
19
64
  style?: BaseStyleInterface,
20
65
  }
21
66
 
22
67
  export const CometChatMessageBubble = memo(({
23
68
  HeaderView,
69
+ StatusInfoView,
24
70
  ReplyView,
25
71
  ContentView,
26
72
  FooterView,
@@ -74,15 +120,18 @@ export const CometChatMessageBubble = memo(({
74
120
  ContentView && <ContentView />
75
121
  }
76
122
  {
77
- BottomView && <BottomView />
123
+ StatusInfoView && <StatusInfoView />
78
124
  }
79
125
  {
80
- ThreadView && <ThreadView />
126
+ BottomView && <BottomView />
81
127
  }
82
128
  </View>
83
129
  {
84
130
  FooterView && <FooterView />
85
131
  }
132
+ {
133
+ ThreadView && <ThreadView />
134
+ }
86
135
  </View>
87
136
  </View>
88
137
 
@@ -0,0 +1,76 @@
1
+ import { View, Text, TouchableOpacity, Image } from 'react-native'
2
+ import React, { useContext } from 'react'
3
+ import { QuickReactionsStyle, QuickReactionsStyleInterface } from './QuickReactionsStyle';
4
+ import { CometChatContext } from '../../CometChatContext';
5
+ import { ICONS } from './resources';
6
+ import { ImageType } from '../../base';
7
+
8
+ export interface CometChatQuickReactionsInterface {
9
+ quickReactions?: [string, string?, string?, string?, string?];
10
+ style?: QuickReactionsStyleInterface,
11
+ onReactionPress?: (emoji: string) => void;
12
+ onAddReactionPress?: () => void;
13
+ addReactionUrl?: ImageType;
14
+ }
15
+
16
+ export const CometChatQuickReactions = (props: CometChatQuickReactionsInterface) => {
17
+ const { quickReactions, style, onReactionPress, onAddReactionPress, addReactionUrl } = props;
18
+ const { theme } = useContext(CometChatContext);
19
+
20
+ const _style = new QuickReactionsStyle({
21
+ backgroundColor: style?.backgroundColor || theme.palette.getBackgroundColor(),
22
+ emojiBackgroundColor: style?.emojiBackgroundColor || theme.palette.getSecondary(),
23
+ addReactionIconTint: style?.addReactionIconTint || theme?.palette?.getAccent700(),
24
+ borderBottomColor: style?.borderBottomColor || theme?.palette?.getAccent300(),
25
+ ...style,
26
+ })
27
+
28
+ const {
29
+ addReactionIconTint,
30
+ backgroundColor,
31
+ emojiBackgroundColor,
32
+ borderBottomColor,
33
+ } = _style;
34
+
35
+ function getEmojis() {
36
+ let defaultEmojis = (Array.isArray(quickReactions) && quickReactions) || ["👍", "❤️", "😂", "😢", "🙏"];
37
+ return defaultEmojis;
38
+ }
39
+
40
+ return (
41
+ <View style={{
42
+ flexDirection: "row", justifyContent: "space-between", alignItems: "center", width: "100%",
43
+ borderBottomWidth: .5, borderBottomColor: borderBottomColor,
44
+ backgroundColor: backgroundColor, paddingHorizontal: 20, paddingVertical: 5, marginVertical: 5
45
+ }}>
46
+ {getEmojis().map((item, index) =>
47
+ <TouchableOpacity key={index} style={{
48
+ marginRight: 10,
49
+ width: 45, height: 45,
50
+ backgroundColor: emojiBackgroundColor, borderRadius: 40,
51
+ alignItems: "center", justifyContent: "center"
52
+ }} onPress={() => onReactionPress && onReactionPress(item)}>
53
+ <Text style={[{ fontSize: 25, color: theme?.palette?.getPrimary(), }, theme?.typography?.heading]}>{item}</Text>
54
+ </TouchableOpacity>
55
+ )}
56
+ <TouchableOpacity
57
+ onPress={() => onAddReactionPress && onAddReactionPress()}
58
+ style={{
59
+ marginRight: 10,
60
+ width: 45, height: 45,
61
+ backgroundColor: emojiBackgroundColor, borderRadius: 40,
62
+ alignItems: "center", justifyContent: "center"
63
+ }}
64
+ >
65
+ <Image
66
+ source={addReactionUrl || ICONS.ADDREACTION}
67
+ style={{
68
+ height: 25,
69
+ width: 25,
70
+ tintColor: addReactionIconTint,
71
+ }}
72
+ />
73
+ </TouchableOpacity>
74
+ </View>
75
+ )
76
+ }
@@ -0,0 +1,12 @@
1
+ import { CometChatQuickReactionsInterface } from './CometChatQuickReactions';
2
+
3
+ export interface QuickReactionsConfigurationInterface extends CometChatQuickReactionsInterface { }
4
+
5
+ export class QuickReactionsConfiguration {
6
+ constructor(props: QuickReactionsConfigurationInterface) {
7
+ if (props)
8
+ for (const [key, value] of Object.entries(props)) {
9
+ this[key] = value;
10
+ }
11
+ }
12
+ }
@@ -0,0 +1,35 @@
1
+ import { BaseStyle, FontStyle } from "../../base";
2
+
3
+ export interface QuickReactionsStyleInterface extends BaseStyle {
4
+ emojiBackgroundColor?: string;
5
+ addReactionIconTint?: string;
6
+ borderBottomColor?: string;
7
+ }
8
+
9
+ export class QuickReactionsStyle extends BaseStyle {
10
+ emojiBackgroundColor?: string;
11
+ addReactionIconTint?: string;
12
+ borderBottomColor?: string;
13
+
14
+ constructor({
15
+ height,
16
+ width,
17
+ backgroundColor,
18
+ border,
19
+ borderRadius,
20
+ emojiBackgroundColor,
21
+ addReactionIconTint,
22
+ borderBottomColor,
23
+ }: QuickReactionsStyleInterface) {
24
+ super({
25
+ backgroundColor,
26
+ border,
27
+ borderRadius,
28
+ height,
29
+ width
30
+ })
31
+ this.emojiBackgroundColor = emojiBackgroundColor;
32
+ this.addReactionIconTint = addReactionIconTint;
33
+ this.borderBottomColor = borderBottomColor;
34
+ }
35
+ }
@@ -0,0 +1,12 @@
1
+ import { CometChatQuickReactions, CometChatQuickReactionsInterface } from './CometChatQuickReactions';
2
+ import { QuickReactionsStyle, QuickReactionsStyleInterface } from './QuickReactionsStyle';
3
+ import { QuickReactionsConfiguration, QuickReactionsConfigurationInterface } from './QuickReactionsConfiguration';
4
+
5
+ export {
6
+ CometChatQuickReactions,
7
+ CometChatQuickReactionsInterface,
8
+ QuickReactionsStyle,
9
+ QuickReactionsStyleInterface,
10
+ QuickReactionsConfiguration,
11
+ QuickReactionsConfigurationInterface
12
+ }