@sendbird/uikit-react-native 3.1.1 → 3.2.0

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 (327) hide show
  1. package/README.md +67 -42
  2. package/lib/commonjs/components/ChannelInput/MessageToReplyPreview.js +145 -0
  3. package/lib/commonjs/components/ChannelInput/MessageToReplyPreview.js.map +1 -0
  4. package/lib/commonjs/components/ChannelInput/SendInput.js +147 -312
  5. package/lib/commonjs/components/ChannelInput/SendInput.js.map +1 -1
  6. package/lib/commonjs/components/ChannelInput/VoiceMessageInput.js +238 -0
  7. package/lib/commonjs/components/ChannelInput/VoiceMessageInput.js.map +1 -0
  8. package/lib/commonjs/components/ChannelInput/index.js +5 -1
  9. package/lib/commonjs/components/ChannelInput/index.js.map +1 -1
  10. package/lib/commonjs/components/ChannelMessageList/index.js +1 -1
  11. package/lib/commonjs/components/ChannelMessageList/index.js.map +1 -1
  12. package/lib/commonjs/components/ChatFlatList/index.js +15 -3
  13. package/lib/commonjs/components/ChatFlatList/index.js.map +1 -1
  14. package/lib/commonjs/components/GroupChannelMessageRenderer/GroupChannelMessageParentMessage.js +24 -13
  15. package/lib/commonjs/components/GroupChannelMessageRenderer/GroupChannelMessageParentMessage.js.map +1 -1
  16. package/lib/commonjs/components/GroupChannelMessageRenderer/index.js +100 -5
  17. package/lib/commonjs/components/GroupChannelMessageRenderer/index.js.map +1 -1
  18. package/lib/commonjs/components/MessageSearchResultItem.js +1 -0
  19. package/lib/commonjs/components/MessageSearchResultItem.js.map +1 -1
  20. package/lib/commonjs/components/OpenChannelMessageRenderer/index.js +1 -0
  21. package/lib/commonjs/components/OpenChannelMessageRenderer/index.js.map +1 -1
  22. package/lib/commonjs/components/ReactionBottomSheets/ReactionUserListBottomSheet.js +2 -2
  23. package/lib/commonjs/components/ReactionBottomSheets/ReactionUserListBottomSheet.js.map +1 -1
  24. package/lib/commonjs/components/ReactionBottomSheets/index.js.map +1 -1
  25. package/lib/commonjs/components/StatusComposition.js.map +1 -1
  26. package/lib/commonjs/constants.js +5 -1
  27. package/lib/commonjs/constants.js.map +1 -1
  28. package/lib/commonjs/containers/GroupChannelPreviewContainer.js +1 -0
  29. package/lib/commonjs/containers/GroupChannelPreviewContainer.js.map +1 -1
  30. package/lib/commonjs/containers/InternalErrorBoundaryContainer.js.map +1 -1
  31. package/lib/commonjs/containers/SendbirdUIKitContainer.js +84 -34
  32. package/lib/commonjs/containers/SendbirdUIKitContainer.js.map +1 -1
  33. package/lib/commonjs/contexts/PlatformServiceCtx.js +16 -12
  34. package/lib/commonjs/contexts/PlatformServiceCtx.js.map +1 -1
  35. package/lib/commonjs/contexts/ReactionCtx.js +3 -2
  36. package/lib/commonjs/contexts/ReactionCtx.js.map +1 -1
  37. package/lib/commonjs/contexts/SendbirdChatCtx.js +2 -0
  38. package/lib/commonjs/contexts/SendbirdChatCtx.js.map +1 -1
  39. package/lib/commonjs/domain/groupChannel/component/GroupChannelMessageList.js +27 -42
  40. package/lib/commonjs/domain/groupChannel/component/GroupChannelMessageList.js.map +1 -1
  41. package/lib/commonjs/domain/groupChannel/module/moduleContext.js +109 -5
  42. package/lib/commonjs/domain/groupChannel/module/moduleContext.js.map +1 -1
  43. package/lib/commonjs/domain/groupChannel/types.js.map +1 -1
  44. package/lib/commonjs/domain/userList/types.js.map +1 -1
  45. package/lib/commonjs/fragments/createGroupChannelFragment.js +30 -4
  46. package/lib/commonjs/fragments/createGroupChannelFragment.js.map +1 -1
  47. package/lib/commonjs/fragments/createMessageSearchFragment.js +1 -1
  48. package/lib/commonjs/fragments/createMessageSearchFragment.js.map +1 -1
  49. package/lib/commonjs/hooks/useChannelInputItems.js +211 -0
  50. package/lib/commonjs/hooks/useChannelInputItems.js.map +1 -0
  51. package/lib/commonjs/hooks/useConnection.js +1 -1
  52. package/lib/commonjs/hooks/useConnection.js.map +1 -1
  53. package/lib/commonjs/hooks/useMentionSuggestion.js +1 -1
  54. package/lib/commonjs/hooks/useMentionSuggestion.js.map +1 -1
  55. package/lib/commonjs/hooks/useVoiceMessageInput.js +207 -0
  56. package/lib/commonjs/hooks/useVoiceMessageInput.js.map +1 -0
  57. package/lib/commonjs/index.js +32 -0
  58. package/lib/commonjs/index.js.map +1 -1
  59. package/lib/commonjs/libs/MentionManager.js.map +1 -1
  60. package/lib/commonjs/libs/SBUUtils.js +4 -0
  61. package/lib/commonjs/libs/SBUUtils.js.map +1 -1
  62. package/lib/commonjs/libs/VoiceMessageConfig.js +30 -0
  63. package/lib/commonjs/libs/VoiceMessageConfig.js.map +1 -0
  64. package/lib/commonjs/localization/StringSet.type.js.map +1 -1
  65. package/lib/commonjs/localization/createBaseStringSet.js +24 -9
  66. package/lib/commonjs/localization/createBaseStringSet.js.map +1 -1
  67. package/lib/commonjs/platform/createFileService.expo.js +10 -0
  68. package/lib/commonjs/platform/createFileService.expo.js.map +1 -1
  69. package/lib/commonjs/platform/createFileService.native.js +19 -0
  70. package/lib/commonjs/platform/createFileService.native.js.map +1 -1
  71. package/lib/commonjs/platform/createPlayerService.expo.js +137 -0
  72. package/lib/commonjs/platform/createPlayerService.expo.js.map +1 -0
  73. package/lib/commonjs/platform/createPlayerService.native.js +139 -0
  74. package/lib/commonjs/platform/createPlayerService.native.js.map +1 -0
  75. package/lib/commonjs/platform/createRecorderService.expo.js +158 -0
  76. package/lib/commonjs/platform/createRecorderService.expo.js.map +1 -0
  77. package/lib/commonjs/platform/createRecorderService.native.js +157 -0
  78. package/lib/commonjs/platform/createRecorderService.native.js.map +1 -0
  79. package/lib/commonjs/platform/types.js.map +1 -1
  80. package/lib/commonjs/types.js.map +1 -1
  81. package/lib/commonjs/version.js +1 -1
  82. package/lib/commonjs/version.js.map +1 -1
  83. package/lib/module/components/ChannelInput/MessageToReplyPreview.js +137 -0
  84. package/lib/module/components/ChannelInput/MessageToReplyPreview.js.map +1 -0
  85. package/lib/module/components/ChannelInput/SendInput.js +149 -314
  86. package/lib/module/components/ChannelInput/SendInput.js.map +1 -1
  87. package/lib/module/components/ChannelInput/VoiceMessageInput.js +228 -0
  88. package/lib/module/components/ChannelInput/VoiceMessageInput.js.map +1 -0
  89. package/lib/module/components/ChannelInput/index.js +5 -1
  90. package/lib/module/components/ChannelInput/index.js.map +1 -1
  91. package/lib/module/components/ChannelMessageList/index.js +2 -2
  92. package/lib/module/components/ChannelMessageList/index.js.map +1 -1
  93. package/lib/module/components/ChatFlatList/index.js +15 -3
  94. package/lib/module/components/ChatFlatList/index.js.map +1 -1
  95. package/lib/module/components/GroupChannelMessageRenderer/GroupChannelMessageParentMessage.js +24 -13
  96. package/lib/module/components/GroupChannelMessageRenderer/GroupChannelMessageParentMessage.js.map +1 -1
  97. package/lib/module/components/GroupChannelMessageRenderer/index.js +99 -6
  98. package/lib/module/components/GroupChannelMessageRenderer/index.js.map +1 -1
  99. package/lib/module/components/MessageSearchResultItem.js +2 -1
  100. package/lib/module/components/MessageSearchResultItem.js.map +1 -1
  101. package/lib/module/components/OpenChannelMessageRenderer/index.js +1 -0
  102. package/lib/module/components/OpenChannelMessageRenderer/index.js.map +1 -1
  103. package/lib/module/components/ReactionBottomSheets/ReactionUserListBottomSheet.js +2 -2
  104. package/lib/module/components/ReactionBottomSheets/ReactionUserListBottomSheet.js.map +1 -1
  105. package/lib/module/components/ReactionBottomSheets/index.js.map +1 -1
  106. package/lib/module/components/StatusComposition.js.map +1 -1
  107. package/lib/module/constants.js +2 -0
  108. package/lib/module/constants.js.map +1 -1
  109. package/lib/module/containers/GroupChannelPreviewContainer.js +2 -1
  110. package/lib/module/containers/GroupChannelPreviewContainer.js.map +1 -1
  111. package/lib/module/containers/InternalErrorBoundaryContainer.js.map +1 -1
  112. package/lib/module/containers/SendbirdUIKitContainer.js +86 -36
  113. package/lib/module/containers/SendbirdUIKitContainer.js.map +1 -1
  114. package/lib/module/contexts/PlatformServiceCtx.js +14 -11
  115. package/lib/module/contexts/PlatformServiceCtx.js.map +1 -1
  116. package/lib/module/contexts/ReactionCtx.js +3 -2
  117. package/lib/module/contexts/ReactionCtx.js.map +1 -1
  118. package/lib/module/contexts/SendbirdChatCtx.js +2 -0
  119. package/lib/module/contexts/SendbirdChatCtx.js.map +1 -1
  120. package/lib/module/domain/groupChannel/component/GroupChannelMessageList.js +28 -43
  121. package/lib/module/domain/groupChannel/component/GroupChannelMessageList.js.map +1 -1
  122. package/lib/module/domain/groupChannel/module/moduleContext.js +111 -7
  123. package/lib/module/domain/groupChannel/module/moduleContext.js.map +1 -1
  124. package/lib/module/domain/groupChannel/types.js.map +1 -1
  125. package/lib/module/domain/userList/types.js.map +1 -1
  126. package/lib/module/fragments/createGroupChannelFragment.js +32 -6
  127. package/lib/module/fragments/createGroupChannelFragment.js.map +1 -1
  128. package/lib/module/fragments/createMessageSearchFragment.js +1 -1
  129. package/lib/module/fragments/createMessageSearchFragment.js.map +1 -1
  130. package/lib/module/hooks/useChannelInputItems.js +203 -0
  131. package/lib/module/hooks/useChannelInputItems.js.map +1 -0
  132. package/lib/module/hooks/useConnection.js +1 -1
  133. package/lib/module/hooks/useConnection.js.map +1 -1
  134. package/lib/module/hooks/useMentionSuggestion.js +1 -1
  135. package/lib/module/hooks/useMentionSuggestion.js.map +1 -1
  136. package/lib/module/hooks/useVoiceMessageInput.js +199 -0
  137. package/lib/module/hooks/useVoiceMessageInput.js.map +1 -0
  138. package/lib/module/index.js +4 -0
  139. package/lib/module/index.js.map +1 -1
  140. package/lib/module/libs/MentionManager.js.map +1 -1
  141. package/lib/module/libs/SBUUtils.js +4 -0
  142. package/lib/module/libs/SBUUtils.js.map +1 -1
  143. package/lib/module/libs/VoiceMessageConfig.js +23 -0
  144. package/lib/module/libs/VoiceMessageConfig.js.map +1 -0
  145. package/lib/module/localization/StringSet.type.js.map +1 -1
  146. package/lib/module/localization/createBaseStringSet.js +25 -10
  147. package/lib/module/localization/createBaseStringSet.js.map +1 -1
  148. package/lib/module/platform/createFileService.expo.js +10 -0
  149. package/lib/module/platform/createFileService.expo.js.map +1 -1
  150. package/lib/module/platform/createFileService.native.js +19 -0
  151. package/lib/module/platform/createFileService.native.js.map +1 -1
  152. package/lib/module/platform/createPlayerService.expo.js +129 -0
  153. package/lib/module/platform/createPlayerService.expo.js.map +1 -0
  154. package/lib/module/platform/createPlayerService.native.js +132 -0
  155. package/lib/module/platform/createPlayerService.native.js.map +1 -0
  156. package/lib/module/platform/createRecorderService.expo.js +150 -0
  157. package/lib/module/platform/createRecorderService.expo.js.map +1 -0
  158. package/lib/module/platform/createRecorderService.native.js +149 -0
  159. package/lib/module/platform/createRecorderService.native.js.map +1 -0
  160. package/lib/module/platform/types.js.map +1 -1
  161. package/lib/module/types.js.map +1 -1
  162. package/lib/module/version.js +1 -1
  163. package/lib/module/version.js.map +1 -1
  164. package/lib/typescript/src/components/ChannelCover.d.ts +2 -1
  165. package/lib/typescript/src/components/ChannelInput/AttachmentsButton.d.ts +2 -1
  166. package/lib/typescript/src/components/ChannelInput/MessageToReplyPreview.d.ts +7 -0
  167. package/lib/typescript/src/components/ChannelInput/VoiceMessageInput.d.ts +11 -0
  168. package/lib/typescript/src/components/ChannelInput/index.d.ts +7 -3
  169. package/lib/typescript/src/components/ChannelMessageList/index.d.ts +1 -1
  170. package/lib/typescript/src/components/FileViewer.d.ts +2 -1
  171. package/lib/typescript/src/components/GroupChannelMessageRenderer/GroupChannelMessageDateSeparator.d.ts +2 -1
  172. package/lib/typescript/src/components/GroupChannelMessageRenderer/GroupChannelMessageFocusAnimation.d.ts +1 -1
  173. package/lib/typescript/src/components/GroupChannelMessageRenderer/GroupChannelMessageOutgoingStatus.d.ts +1 -1
  174. package/lib/typescript/src/components/GroupChannelMessageRenderer/GroupChannelMessageParentMessage.d.ts +4 -2
  175. package/lib/typescript/src/components/NewMessagesButton.d.ts +1 -1
  176. package/lib/typescript/src/components/OpenChannelMessageRenderer/OpenChannelMessageDateSeparator.d.ts +2 -1
  177. package/lib/typescript/src/components/ProviderLayout.d.ts +1 -1
  178. package/lib/typescript/src/components/ReactionAddons/BottomSheetReactionAddon.d.ts +2 -1
  179. package/lib/typescript/src/components/ReactionAddons/MessageReactionAddon.d.ts +2 -1
  180. package/lib/typescript/src/components/ReactionAddons/ReactionRoundedButton.d.ts +3 -2
  181. package/lib/typescript/src/components/ReactionAddons/index.d.ts +3 -2
  182. package/lib/typescript/src/components/ReactionBottomSheets/ReactionListBottomSheet.d.ts +2 -1
  183. package/lib/typescript/src/components/ReactionBottomSheets/ReactionUserListBottomSheet.d.ts +2 -1
  184. package/lib/typescript/src/components/ReactionBottomSheets/index.d.ts +4 -4
  185. package/lib/typescript/src/components/ScrollToBottomButton.d.ts +1 -1
  186. package/lib/typescript/src/components/StatusComposition.d.ts +4 -4
  187. package/lib/typescript/src/components/TypedPlaceholder.d.ts +2 -1
  188. package/lib/typescript/src/components/UserActionBar.d.ts +2 -1
  189. package/lib/typescript/src/components/UserSelectableBar.d.ts +2 -1
  190. package/lib/typescript/src/constants.d.ts +2 -0
  191. package/lib/typescript/src/containers/GroupChannelPreviewContainer.d.ts +2 -1
  192. package/lib/typescript/src/containers/InternalErrorBoundaryContainer.d.ts +3 -3
  193. package/lib/typescript/src/containers/SendbirdUIKitContainer.d.ts +18 -6
  194. package/lib/typescript/src/contexts/LocalizationCtx.d.ts +1 -1
  195. package/lib/typescript/src/contexts/PlatformServiceCtx.d.ts +8 -8
  196. package/lib/typescript/src/contexts/ReactionCtx.d.ts +5 -2
  197. package/lib/typescript/src/contexts/SendbirdChatCtx.d.ts +6 -3
  198. package/lib/typescript/src/contexts/UserProfileCtx.d.ts +1 -1
  199. package/lib/typescript/src/domain/groupChannel/component/GroupChannelHeader.d.ts +2 -1
  200. package/lib/typescript/src/domain/groupChannel/component/GroupChannelInput.d.ts +1 -1
  201. package/lib/typescript/src/domain/groupChannel/component/GroupChannelMessageList.d.ts +1 -1
  202. package/lib/typescript/src/domain/groupChannel/component/GroupChannelStatusEmpty.d.ts +2 -1
  203. package/lib/typescript/src/domain/groupChannel/component/GroupChannelStatusLoading.d.ts +2 -1
  204. package/lib/typescript/src/domain/groupChannel/component/GroupChannelSuggestedMentionList.d.ts +2 -1
  205. package/lib/typescript/src/domain/groupChannel/types.d.ts +45 -0
  206. package/lib/typescript/src/domain/groupChannelBannedUsers/component/GroupChannelBannedUsersHeader.d.ts +2 -1
  207. package/lib/typescript/src/domain/groupChannelBannedUsers/component/GroupChannelBannedUsersList.d.ts +2 -1
  208. package/lib/typescript/src/domain/groupChannelBannedUsers/component/GroupChannelBannedUsersStatusEmpty.d.ts +2 -1
  209. package/lib/typescript/src/domain/groupChannelBannedUsers/component/GroupChannelBannedUsersStatusLoading.d.ts +2 -1
  210. package/lib/typescript/src/domain/groupChannelList/component/GroupChannelListHeader.d.ts +2 -1
  211. package/lib/typescript/src/domain/groupChannelList/component/GroupChannelListList.d.ts +2 -1
  212. package/lib/typescript/src/domain/groupChannelList/component/GroupChannelListStatusEmpty.d.ts +2 -1
  213. package/lib/typescript/src/domain/groupChannelList/component/GroupChannelListStatusLoading.d.ts +2 -1
  214. package/lib/typescript/src/domain/groupChannelList/component/GroupChannelListTypeSelector.d.ts +2 -1
  215. package/lib/typescript/src/domain/groupChannelModeration/component/GroupChannelModerationHeader.d.ts +2 -1
  216. package/lib/typescript/src/domain/groupChannelModeration/component/GroupChannelModerationMenu.d.ts +2 -1
  217. package/lib/typescript/src/domain/groupChannelMutedMembers/component/GroupChannelMutedMembersHeader.d.ts +2 -1
  218. package/lib/typescript/src/domain/groupChannelMutedMembers/component/GroupChannelMutedMembersList.d.ts +2 -1
  219. package/lib/typescript/src/domain/groupChannelMutedMembers/component/GroupChannelMutedMembersStatusEmpty.d.ts +2 -1
  220. package/lib/typescript/src/domain/groupChannelMutedMembers/component/GroupChannelMutedMembersStatusLoading.d.ts +2 -1
  221. package/lib/typescript/src/domain/groupChannelNotifications/component/GroupChannelNotificationsHeader.d.ts +2 -1
  222. package/lib/typescript/src/domain/groupChannelNotifications/component/GroupChannelNotificationsView.d.ts +2 -1
  223. package/lib/typescript/src/domain/groupChannelOperators/component/GroupChannelOperatorsHeader.d.ts +2 -1
  224. package/lib/typescript/src/domain/groupChannelOperators/component/GroupChannelOperatorsList.d.ts +2 -1
  225. package/lib/typescript/src/domain/groupChannelOperators/component/GroupChannelOperatorsStatusEmpty.d.ts +2 -1
  226. package/lib/typescript/src/domain/groupChannelOperators/component/GroupChannelOperatorsStatusLoading.d.ts +2 -1
  227. package/lib/typescript/src/domain/groupChannelSettings/component/GroupChannelSettingsHeader.d.ts +2 -1
  228. package/lib/typescript/src/domain/groupChannelSettings/component/GroupChannelSettingsInfo.d.ts +2 -1
  229. package/lib/typescript/src/domain/groupChannelSettings/component/GroupChannelSettingsMenu.d.ts +2 -1
  230. package/lib/typescript/src/domain/messageSearch/component/MessageSearchHeader.d.ts +2 -1
  231. package/lib/typescript/src/domain/messageSearch/component/MessageSearchList.d.ts +2 -1
  232. package/lib/typescript/src/domain/messageSearch/component/MessageSearchStatusEmpty.d.ts +2 -1
  233. package/lib/typescript/src/domain/messageSearch/component/MessageSearchStatusLoading.d.ts +2 -1
  234. package/lib/typescript/src/domain/openChannel/component/OpenChannelHeader.d.ts +2 -2
  235. package/lib/typescript/src/domain/openChannel/component/OpenChannelInput.d.ts +1 -1
  236. package/lib/typescript/src/domain/openChannel/component/OpenChannelMessageList.d.ts +1 -1
  237. package/lib/typescript/src/domain/openChannel/component/OpenChannelStatusEmpty.d.ts +2 -1
  238. package/lib/typescript/src/domain/openChannel/component/OpenChannelStatusLoading.d.ts +2 -1
  239. package/lib/typescript/src/domain/openChannelBannedUsers/component/OpenChannelBannedUsersHeader.d.ts +2 -1
  240. package/lib/typescript/src/domain/openChannelBannedUsers/component/OpenChannelBannedUsersList.d.ts +2 -1
  241. package/lib/typescript/src/domain/openChannelBannedUsers/component/OpenChannelBannedUsersStatusEmpty.d.ts +2 -1
  242. package/lib/typescript/src/domain/openChannelBannedUsers/component/OpenChannelBannedUsersStatusLoading.d.ts +2 -1
  243. package/lib/typescript/src/domain/openChannelCreate/component/OpenChannelCreateHeader.d.ts +2 -1
  244. package/lib/typescript/src/domain/openChannelCreate/component/OpenChannelCreateProfileInput.d.ts +2 -1
  245. package/lib/typescript/src/domain/openChannelCreate/component/OpenChannelCreateStatusLoading.d.ts +2 -1
  246. package/lib/typescript/src/domain/openChannelList/component/OpenChannelListHeader.d.ts +2 -1
  247. package/lib/typescript/src/domain/openChannelList/component/OpenChannelListList.d.ts +2 -1
  248. package/lib/typescript/src/domain/openChannelList/component/OpenChannelListStatusEmpty.d.ts +2 -1
  249. package/lib/typescript/src/domain/openChannelList/component/OpenChannelListStatusLoading.d.ts +2 -1
  250. package/lib/typescript/src/domain/openChannelModeration/component/OpenChannelModerationHeader.d.ts +2 -1
  251. package/lib/typescript/src/domain/openChannelModeration/component/OpenChannelModerationMenu.d.ts +2 -1
  252. package/lib/typescript/src/domain/openChannelMutedParticipants/component/OpenChannelMutedParticipantsHeader.d.ts +2 -1
  253. package/lib/typescript/src/domain/openChannelMutedParticipants/component/OpenChannelMutedParticipantsList.d.ts +2 -1
  254. package/lib/typescript/src/domain/openChannelMutedParticipants/component/OpenChannelMutedParticipantsStatusEmpty.d.ts +2 -1
  255. package/lib/typescript/src/domain/openChannelMutedParticipants/component/OpenChannelMutedParticipantsStatusLoading.d.ts +2 -1
  256. package/lib/typescript/src/domain/openChannelOperators/component/OpenChannelOperatorsHeader.d.ts +2 -1
  257. package/lib/typescript/src/domain/openChannelOperators/component/OpenChannelOperatorsList.d.ts +2 -1
  258. package/lib/typescript/src/domain/openChannelOperators/component/OpenChannelOperatorsStatusEmpty.d.ts +2 -1
  259. package/lib/typescript/src/domain/openChannelOperators/component/OpenChannelOperatorsStatusLoading.d.ts +2 -1
  260. package/lib/typescript/src/domain/openChannelSettings/component/OpenChannelSettingsHeader.d.ts +2 -1
  261. package/lib/typescript/src/domain/openChannelSettings/component/OpenChannelSettingsInfo.d.ts +2 -1
  262. package/lib/typescript/src/domain/openChannelSettings/component/OpenChannelSettingsMenu.d.ts +2 -1
  263. package/lib/typescript/src/domain/userList/component/UserListHeader.d.ts +3 -3
  264. package/lib/typescript/src/domain/userList/component/UserListList.d.ts +1 -1
  265. package/lib/typescript/src/domain/userList/component/UserListStatusEmpty.d.ts +2 -1
  266. package/lib/typescript/src/domain/userList/component/UserListStatusLoading.d.ts +2 -1
  267. package/lib/typescript/src/domain/userList/types.d.ts +2 -2
  268. package/lib/typescript/src/hooks/useChannelInputItems.d.ts +10 -0
  269. package/lib/typescript/src/hooks/useVoiceMessageInput.d.ts +53 -0
  270. package/lib/typescript/src/index.d.ts +4 -0
  271. package/lib/typescript/src/libs/MentionManager.d.ts +2 -1
  272. package/lib/typescript/src/libs/SBUUtils.d.ts +1 -0
  273. package/lib/typescript/src/libs/VoiceMessageConfig.d.ts +25 -0
  274. package/lib/typescript/src/localization/StringSet.type.d.ts +7 -0
  275. package/lib/typescript/src/platform/createPlayerService.expo.d.ts +7 -0
  276. package/lib/typescript/src/platform/createPlayerService.native.d.ts +9 -0
  277. package/lib/typescript/src/platform/createRecorderService.expo.d.ts +7 -0
  278. package/lib/typescript/src/platform/createRecorderService.native.d.ts +9 -0
  279. package/lib/typescript/src/platform/types.d.ts +100 -1
  280. package/lib/typescript/src/types.d.ts +1 -1
  281. package/lib/typescript/src/version.d.ts +1 -1
  282. package/package.json +9 -11
  283. package/src/components/ChannelInput/MessageToReplyPreview.tsx +133 -0
  284. package/src/components/ChannelInput/SendInput.tsx +129 -320
  285. package/src/components/ChannelInput/VoiceMessageInput.tsx +206 -0
  286. package/src/components/ChannelInput/index.tsx +12 -4
  287. package/src/components/ChannelMessageList/index.tsx +3 -1
  288. package/src/components/ChatFlatList/index.tsx +14 -3
  289. package/src/components/GroupChannelMessageRenderer/GroupChannelMessageParentMessage.tsx +24 -11
  290. package/src/components/GroupChannelMessageRenderer/index.tsx +80 -3
  291. package/src/components/MessageSearchResultItem.tsx +2 -1
  292. package/src/components/OpenChannelMessageRenderer/index.tsx +1 -0
  293. package/src/components/ReactionBottomSheets/ReactionUserListBottomSheet.tsx +2 -2
  294. package/src/components/ReactionBottomSheets/index.tsx +3 -2
  295. package/src/components/StatusComposition.tsx +3 -3
  296. package/src/constants.ts +2 -0
  297. package/src/containers/GroupChannelPreviewContainer.tsx +2 -0
  298. package/src/containers/InternalErrorBoundaryContainer.tsx +1 -1
  299. package/src/containers/SendbirdUIKitContainer.tsx +105 -54
  300. package/src/contexts/PlatformServiceCtx.tsx +22 -20
  301. package/src/contexts/ReactionCtx.tsx +7 -5
  302. package/src/contexts/SendbirdChatCtx.tsx +10 -2
  303. package/src/domain/groupChannel/component/GroupChannelMessageList.tsx +29 -43
  304. package/src/domain/groupChannel/module/moduleContext.tsx +119 -7
  305. package/src/domain/groupChannel/types.ts +41 -0
  306. package/src/domain/userList/types.ts +2 -2
  307. package/src/fragments/createGroupChannelFragment.tsx +32 -5
  308. package/src/fragments/createMessageSearchFragment.tsx +1 -1
  309. package/src/hooks/useChannelInputItems.ts +215 -0
  310. package/src/hooks/useConnection.ts +1 -1
  311. package/src/hooks/useMentionSuggestion.ts +2 -1
  312. package/src/hooks/useVoiceMessageInput.ts +237 -0
  313. package/src/index.ts +4 -0
  314. package/src/libs/MentionManager.tsx +1 -1
  315. package/src/libs/SBUUtils.ts +5 -0
  316. package/src/libs/VoiceMessageConfig.ts +28 -0
  317. package/src/localization/StringSet.type.ts +8 -0
  318. package/src/localization/createBaseStringSet.ts +27 -11
  319. package/src/platform/createFileService.expo.ts +10 -0
  320. package/src/platform/createFileService.native.ts +19 -0
  321. package/src/platform/createPlayerService.expo.tsx +142 -0
  322. package/src/platform/createPlayerService.native.tsx +148 -0
  323. package/src/platform/createRecorderService.expo.tsx +160 -0
  324. package/src/platform/createRecorderService.native.tsx +170 -0
  325. package/src/platform/types.ts +114 -1
  326. package/src/types.ts +1 -1
  327. package/src/version.ts +1 -1
@@ -2,7 +2,7 @@ import React, { useLayoutEffect, useMemo, useRef, useState } from 'react';
2
2
  import { Platform } from 'react-native';
3
3
  import { SafeAreaProvider } from 'react-native-safe-area-context';
4
4
 
5
- import Sendbird, { DeviceOsPlatform, SendbirdPlatform, SendbirdProduct } from '@sendbird/chat';
5
+ import SendbirdChat, { DeviceOsPlatform, SendbirdChatParams, SendbirdPlatform, SendbirdProduct } from '@sendbird/chat';
6
6
  import { GroupChannelModule } from '@sendbird/chat/groupChannel';
7
7
  import { OpenChannelModule } from '@sendbird/chat/openChannel';
8
8
  import type { HeaderStyleContextType, UIKitTheme } from '@sendbird/uikit-react-native-foundation';
@@ -37,6 +37,7 @@ import ImageCompressionConfig from '../libs/ImageCompressionConfig';
37
37
  import InternalLocalCacheStorage from '../libs/InternalLocalCacheStorage';
38
38
  import MentionConfig, { MentionConfigInterface } from '../libs/MentionConfig';
39
39
  import MentionManager from '../libs/MentionManager';
40
+ import VoiceMessageConfig, { VoiceMessageConfigInterface } from '../libs/VoiceMessageConfig';
40
41
  import StringSetEn from '../localization/StringSet.en';
41
42
  import type { StringSet } from '../localization/StringSet.type';
42
43
  import SBUDynamicModule from '../platform/dynamicModule';
@@ -45,13 +46,14 @@ import type {
45
46
  FileServiceInterface,
46
47
  MediaServiceInterface,
47
48
  NotificationServiceInterface,
49
+ PlayerServiceInterface,
50
+ RecorderServiceInterface,
48
51
  } from '../platform/types';
49
52
  import type { ErrorBoundaryProps, LocalCacheStorage } from '../types';
50
53
  import VERSION from '../version';
51
54
  import InternalErrorBoundaryContainer from './InternalErrorBoundaryContainer';
52
55
 
53
56
  const NetInfo = SBUDynamicModule.get('@react-native-community/netinfo', 'warn');
54
- type UnimplementedFeatures = 'enableVoiceMessage' | 'threadReplySelectType' | 'replyType';
55
57
  export const SendbirdUIKit = Object.freeze({
56
58
  VERSION,
57
59
  PLATFORM: Platform.OS.toLowerCase(),
@@ -62,6 +64,27 @@ export const SendbirdUIKit = Object.freeze({
62
64
  },
63
65
  });
64
66
 
67
+ type UnimplementedFeatures = 'threadReplySelectType' | 'replyType';
68
+ export type ChatOmittedInitParams = Omit<
69
+ SendbirdChatParams<[GroupChannelModule, OpenChannelModule]>,
70
+ (typeof chatOmitKeys)[number]
71
+ >;
72
+
73
+ const chatOmitKeys = [
74
+ 'appId',
75
+ 'newInstance',
76
+ 'modules',
77
+ 'debugMode',
78
+ 'appVersion',
79
+ 'localCacheEnabled',
80
+ 'useAsyncStorageStore',
81
+ ] as const;
82
+ function sanitizeChatOptions<T extends Record<string, unknown>>(chatOptions: T): T {
83
+ const opts = { ...chatOptions };
84
+ chatOmitKeys.forEach((key) => delete opts[key]);
85
+ return opts;
86
+ }
87
+
65
88
  export type SendbirdUIKitContainerProps = React.PropsWithChildren<{
66
89
  appId: string;
67
90
  platformServices: {
@@ -69,11 +92,14 @@ export type SendbirdUIKitContainerProps = React.PropsWithChildren<{
69
92
  notification: NotificationServiceInterface;
70
93
  clipboard: ClipboardServiceInterface;
71
94
  media: MediaServiceInterface;
95
+ player: PlayerServiceInterface;
96
+ recorder: RecorderServiceInterface;
72
97
  };
73
98
  chatOptions: {
74
99
  localCacheStorage: LocalCacheStorage;
75
100
  onInitialized?: (sdkInstance: SendbirdChatSDK) => SendbirdChatSDK;
76
- } & Partial<ChatRelatedFeaturesInUIKit>;
101
+ } & Partial<ChatOmittedInitParams> &
102
+ Partial<ChatRelatedFeaturesInUIKit>;
77
103
  uikitOptions?: PartialDeep<{
78
104
  common: SBUConfig['common'];
79
105
  groupChannel: Omit<SBUConfig['groupChannel']['channel'], UnimplementedFeatures> & {
@@ -96,7 +122,7 @@ export type SendbirdUIKitContainerProps = React.PropsWithChildren<{
96
122
  errorBoundary?: {
97
123
  disabled?: boolean;
98
124
  onError?: (props: ErrorBoundaryProps) => void;
99
- ErrorInfoComponent?: (props: ErrorBoundaryProps) => JSX.Element;
125
+ ErrorInfoComponent?: (props: ErrorBoundaryProps) => React.ReactNode;
100
126
  };
101
127
  toast?: {
102
128
  dismissTimeout?: number;
@@ -108,24 +134,29 @@ export type SendbirdUIKitContainerProps = React.PropsWithChildren<{
108
134
  users: SendbirdUser[] | SendbirdMember[],
109
135
  ) => SendbirdGroupChannelCreateParams | Promise<SendbirdGroupChannelCreateParams>;
110
136
  };
137
+ reaction?: {
138
+ onPressUserProfile?: (user: SendbirdUser | SendbirdMember) => void;
139
+ };
111
140
  userMention?: Pick<Partial<MentionConfigInterface>, 'mentionLimit' | 'suggestionLimit' | 'debounceMills'>;
112
141
  imageCompression?: Partial<ImageCompressionConfigInterface>;
142
+ voiceMessage?: PartialDeep<VoiceMessageConfigInterface>;
113
143
  }>;
114
144
 
115
- const SendbirdUIKitContainer = ({
116
- children,
117
- appId,
118
- chatOptions,
119
- uikitOptions,
120
- platformServices,
121
- localization,
122
- styles,
123
- errorBoundary,
124
- toast,
125
- userProfile,
126
- userMention,
127
- imageCompression,
128
- }: SendbirdUIKitContainerProps) => {
145
+ const SendbirdUIKitContainer = (props: SendbirdUIKitContainerProps) => {
146
+ const {
147
+ children,
148
+ appId,
149
+ chatOptions,
150
+ uikitOptions,
151
+ platformServices,
152
+ localization,
153
+ styles,
154
+ errorBoundary,
155
+ toast,
156
+ userProfile,
157
+ reaction,
158
+ } = props;
159
+
129
160
  if (!chatOptions.localCacheStorage) {
130
161
  throw new Error('SendbirdUIKitContainer: chatOptions.localCacheStorage is required');
131
162
  }
@@ -137,35 +168,18 @@ const SendbirdUIKitContainer = ({
137
168
 
138
169
  const [internalStorage] = useState(() => new InternalLocalCacheStorage(chatOptions.localCacheStorage));
139
170
  const [sdkInstance, setSdkInstance] = useState<SendbirdChatSDK>(() => {
140
- const sendbird = initializeSendbird(appId, internalStorage, chatOptions.onInitialized);
171
+ const sendbird = initializeSendbird(appId, { internalStorage, ...sanitizeChatOptions(chatOptions) });
141
172
  unsubscribes.current = sendbird.unsubscribes;
142
173
  return sendbird.chatSDK;
143
174
  });
144
175
 
176
+ const { imageCompressionConfig, voiceMessageConfig, mentionConfig } = useConfigInstance(props);
145
177
  const emojiManager = useMemo(() => new EmojiManager(internalStorage), [internalStorage]);
146
-
147
- const mentionManager = useMemo(() => {
148
- const config = new MentionConfig({
149
- mentionLimit: userMention?.mentionLimit || MentionConfig.DEFAULT.MENTION_LIMIT,
150
- suggestionLimit: userMention?.suggestionLimit || MentionConfig.DEFAULT.SUGGESTION_LIMIT,
151
- debounceMills: userMention?.debounceMills ?? MentionConfig.DEFAULT.DEBOUNCE_MILLS,
152
- delimiter: MentionConfig.DEFAULT.DELIMITER,
153
- trigger: MentionConfig.DEFAULT.TRIGGER,
154
- });
155
- return new MentionManager(config);
156
- }, [userMention?.mentionLimit, userMention?.suggestionLimit, userMention?.debounceMills]);
157
-
158
- const imageCompressionConfig = useMemo(() => {
159
- return new ImageCompressionConfig({
160
- compressionRate: imageCompression?.compressionRate || ImageCompressionConfig.DEFAULT.COMPRESSION_RATE,
161
- width: imageCompression?.width,
162
- height: imageCompression?.height,
163
- });
164
- }, [imageCompression?.compressionRate, imageCompression?.width, imageCompression?.height]);
178
+ const mentionManager = useMemo(() => new MentionManager(mentionConfig), [mentionConfig]);
165
179
 
166
180
  useLayoutEffect(() => {
167
181
  if (!isFirstMount) {
168
- const sendbird = initializeSendbird(appId, internalStorage, chatOptions.onInitialized);
182
+ const sendbird = initializeSendbird(appId, { internalStorage, ...sanitizeChatOptions(chatOptions) });
169
183
  setSdkInstance(sendbird.chatSDK);
170
184
  unsubscribes.current = sendbird.unsubscribes;
171
185
  }
@@ -208,6 +222,7 @@ const SendbirdUIKitContainer = ({
208
222
  emojiManager={emojiManager}
209
223
  mentionManager={mentionManager}
210
224
  imageCompressionConfig={imageCompressionConfig}
225
+ voiceMessageConfig={voiceMessageConfig}
211
226
  enableAutoPushTokenRegistration={
212
227
  chatOptions.enableAutoPushTokenRegistration ?? SendbirdUIKit.DEFAULT.AUTO_PUSH_TOKEN_REGISTRATION
213
228
  }
@@ -222,6 +237,9 @@ const SendbirdUIKitContainer = ({
222
237
  notificationService={platformServices.notification}
223
238
  clipboardService={platformServices.clipboard}
224
239
  mediaService={platformServices.media}
240
+ playerService={platformServices.player}
241
+ recorderService={platformServices.recorder}
242
+ voiceMessageConfig={voiceMessageConfig}
225
243
  >
226
244
  <UIKitThemeProvider theme={styles?.theme ?? LightUIKitTheme}>
227
245
  <HeaderStyleProvider
@@ -230,12 +248,8 @@ const SendbirdUIKitContainer = ({
230
248
  statusBarTranslucent={styles?.statusBarTranslucent ?? true}
231
249
  >
232
250
  <ToastProvider dismissTimeout={toast?.dismissTimeout}>
233
- <UserProfileProvider
234
- onCreateChannel={userProfile?.onCreateChannel}
235
- onBeforeCreateChannel={userProfile?.onBeforeCreateChannel}
236
- statusBarTranslucent={styles?.statusBarTranslucent ?? true}
237
- >
238
- <ReactionProvider>
251
+ <UserProfileProvider {...userProfile} statusBarTranslucent={styles?.statusBarTranslucent ?? true}>
252
+ <ReactionProvider {...reaction}>
239
253
  <LocalizationContext.Consumer>
240
254
  {(value) => {
241
255
  const STRINGS = value?.STRINGS || defaultStringSet;
@@ -268,20 +282,22 @@ const SendbirdUIKitContainer = ({
268
282
  );
269
283
  };
270
284
 
271
- const initializeSendbird = (
272
- appId: string,
273
- internalStorage?: InternalLocalCacheStorage,
274
- onInitialized?: (sdk: SendbirdChatSDK) => SendbirdChatSDK,
275
- ) => {
276
- const unsubscribes: Array<() => void> = [];
285
+ interface InitOptions extends ChatOmittedInitParams {
286
+ internalStorage: InternalLocalCacheStorage;
287
+ onInitialized?: (sdk: SendbirdChatSDK) => SendbirdChatSDK;
288
+ }
289
+ const initializeSendbird = (appId: string, options: InitOptions) => {
277
290
  let chatSDK: SendbirdChatSDK;
291
+ const unsubscribes: Array<() => void> = [];
292
+ const { internalStorage, onInitialized, ...chatInitParams } = options;
278
293
 
279
- chatSDK = Sendbird.init({
294
+ chatSDK = SendbirdChat.init({
295
+ ...chatInitParams,
280
296
  appId,
297
+ newInstance: true,
281
298
  modules: [new GroupChannelModule(), new OpenChannelModule()],
282
- localCacheEnabled: Boolean(internalStorage),
299
+ localCacheEnabled: true,
283
300
  useAsyncStorageStore: internalStorage as never,
284
- newInstance: true,
285
301
  });
286
302
 
287
303
  if (onInitialized) {
@@ -361,4 +377,39 @@ function getReactNativeVersion() {
361
377
  return `${major}.${minor}.${patch}`;
362
378
  }
363
379
 
380
+ const useConfigInstance = ({ imageCompression, userMention, voiceMessage }: SendbirdUIKitContainerProps) => {
381
+ const mentionConfig = useMemo(() => {
382
+ return new MentionConfig({
383
+ mentionLimit: userMention?.mentionLimit || MentionConfig.DEFAULT.MENTION_LIMIT,
384
+ suggestionLimit: userMention?.suggestionLimit || MentionConfig.DEFAULT.SUGGESTION_LIMIT,
385
+ debounceMills: userMention?.debounceMills ?? MentionConfig.DEFAULT.DEBOUNCE_MILLS,
386
+ delimiter: MentionConfig.DEFAULT.DELIMITER,
387
+ trigger: MentionConfig.DEFAULT.TRIGGER,
388
+ });
389
+ }, [userMention?.mentionLimit, userMention?.suggestionLimit, userMention?.debounceMills]);
390
+
391
+ const imageCompressionConfig = useMemo(() => {
392
+ return new ImageCompressionConfig({
393
+ compressionRate: imageCompression?.compressionRate || ImageCompressionConfig.DEFAULT.COMPRESSION_RATE,
394
+ width: imageCompression?.width,
395
+ height: imageCompression?.height,
396
+ });
397
+ }, [imageCompression?.compressionRate, imageCompression?.width, imageCompression?.height]);
398
+
399
+ const voiceMessageConfig = useMemo(() => {
400
+ return new VoiceMessageConfig({
401
+ recorder: {
402
+ minDuration: voiceMessage?.recorder?.minDuration ?? VoiceMessageConfig.DEFAULT.RECORDER.MIN_DURATION,
403
+ maxDuration: voiceMessage?.recorder?.maxDuration ?? VoiceMessageConfig.DEFAULT.RECORDER.MAX_DURATION,
404
+ },
405
+ });
406
+ }, [voiceMessage?.recorder?.minDuration, voiceMessage?.recorder?.maxDuration]);
407
+
408
+ return {
409
+ mentionConfig,
410
+ imageCompressionConfig,
411
+ voiceMessageConfig,
412
+ };
413
+ };
414
+
364
415
  export default SendbirdUIKitContainer;
@@ -1,37 +1,39 @@
1
- import React from 'react';
1
+ import React, { useEffect } from 'react';
2
2
 
3
+ import { useAppState } from '@sendbird/uikit-utils';
4
+
5
+ import VoiceMessageConfig from '../libs/VoiceMessageConfig';
3
6
  import type {
4
7
  ClipboardServiceInterface,
5
8
  FileServiceInterface,
6
9
  MediaServiceInterface,
7
10
  NotificationServiceInterface,
11
+ PlayerServiceInterface,
12
+ RecorderServiceInterface,
8
13
  } from '../platform/types';
9
14
 
10
- type Props = React.PropsWithChildren<{
11
- fileService: FileServiceInterface;
12
- clipboardService: ClipboardServiceInterface;
13
- notificationService: NotificationServiceInterface;
14
- mediaService: MediaServiceInterface;
15
- }>;
16
-
17
15
  export type PlatformServiceContextType = {
18
16
  fileService: FileServiceInterface;
19
17
  clipboardService: ClipboardServiceInterface;
20
18
  notificationService: NotificationServiceInterface;
21
19
  mediaService: MediaServiceInterface;
20
+ recorderService: RecorderServiceInterface;
21
+ playerService: PlayerServiceInterface;
22
22
  };
23
+ type Props = React.PropsWithChildren<PlatformServiceContextType & { voiceMessageConfig: VoiceMessageConfig }>;
23
24
 
24
25
  export const PlatformServiceContext = React.createContext<PlatformServiceContextType | null>(null);
25
- export const PlatformServiceProvider = ({
26
- children,
27
- fileService,
28
- clipboardService,
29
- notificationService,
30
- mediaService,
31
- }: Props) => {
32
- return (
33
- <PlatformServiceContext.Provider value={{ fileService, clipboardService, notificationService, mediaService }}>
34
- {children}
35
- </PlatformServiceContext.Provider>
36
- );
26
+ export const PlatformServiceProvider = ({ children, voiceMessageConfig, ...services }: Props) => {
27
+ useEffect(() => {
28
+ services.recorderService.options.minDuration = voiceMessageConfig.recorder.minDuration;
29
+ services.recorderService.options.maxDuration = voiceMessageConfig.recorder.maxDuration;
30
+ }, [voiceMessageConfig]);
31
+
32
+ useAppState('change', (state) => {
33
+ if (state !== 'active') {
34
+ Promise.allSettled([services.playerService.reset(), services.recorderService.reset()]);
35
+ }
36
+ });
37
+
38
+ return <PlatformServiceContext.Provider value={services}>{children}</PlatformServiceContext.Provider>;
37
39
  };
@@ -3,7 +3,7 @@ import React, { useCallback, useContext, useReducer, useRef, useState } from 're
3
3
  import type { SendbirdBaseChannel, SendbirdBaseMessage } from '@sendbird/uikit-utils';
4
4
  import { NOOP } from '@sendbird/uikit-utils';
5
5
 
6
- import { ReactionBottomSheets } from '../components/ReactionBottomSheets';
6
+ import { ReactionBottomSheetProps, ReactionBottomSheets } from '../components/ReactionBottomSheets';
7
7
  import { LocalizationContext } from '../contexts/LocalizationCtx';
8
8
  import { SendbirdChatContext } from '../contexts/SendbirdChatCtx';
9
9
  import { UserProfileContext } from '../contexts/UserProfileCtx';
@@ -19,10 +19,12 @@ export type ReactionContextType = {
19
19
  focusIndex: number;
20
20
  } & State;
21
21
 
22
- type Props = React.PropsWithChildren<{}>;
22
+ type Props = React.PropsWithChildren<{
23
+ onPressUserProfile?: ReactionBottomSheetProps['onPressUserProfile'];
24
+ }>;
23
25
 
24
26
  export const ReactionContext = React.createContext<ReactionContextType | null>(null);
25
- export const ReactionProvider = ({ children }: Props) => {
27
+ export const ReactionProvider = ({ children, onPressUserProfile }: Props) => {
26
28
  const chatCtx = useContext(SendbirdChatContext);
27
29
  const localizationCtx = useContext(LocalizationContext);
28
30
  const userProfileCtx = useContext(UserProfileContext);
@@ -73,11 +75,11 @@ export const ReactionProvider = ({ children }: Props) => {
73
75
  focusIndex: reactionUserListFocusIndex,
74
76
  };
75
77
 
76
- const sheetProps = {
78
+ const sheetProps: Omit<ReactionBottomSheetProps, 'visible' | 'onClose'> = {
77
79
  chatCtx,
78
80
  reactionCtx,
79
81
  localizationCtx,
80
- userProfileCtx,
82
+ onPressUserProfile: onPressUserProfile ?? userProfileCtx.show,
81
83
  onDismiss: () => {
82
84
  setState({});
83
85
  closeResolver.current?.();
@@ -13,6 +13,7 @@ import { confirmAndMarkAsDelivered, useAppState, useForceUpdate } from '@sendbir
13
13
  import type EmojiManager from '../libs/EmojiManager';
14
14
  import type ImageCompressionConfig from '../libs/ImageCompressionConfig';
15
15
  import type MentionManager from '../libs/MentionManager';
16
+ import type VoiceMessageConfig from '../libs/VoiceMessageConfig';
16
17
  import type { FileType } from '../platform/types';
17
18
 
18
19
  export interface ChatRelatedFeaturesInUIKit {
@@ -23,18 +24,23 @@ export interface ChatRelatedFeaturesInUIKit {
23
24
 
24
25
  interface Props extends ChatRelatedFeaturesInUIKit, React.PropsWithChildren {
25
26
  sdkInstance: SendbirdChatSDK;
27
+
26
28
  emojiManager: EmojiManager;
27
29
  mentionManager: MentionManager;
28
30
  imageCompressionConfig: ImageCompressionConfig;
31
+ voiceMessageConfig: VoiceMessageConfig;
29
32
  }
30
33
 
31
34
  export type SendbirdChatContextType = {
32
35
  sdk: SendbirdChatSDK;
36
+ currentUser?: SendbirdUser;
37
+ setCurrentUser: React.Dispatch<React.SetStateAction<SendbirdUser | undefined>>;
38
+
39
+ // feature related instances
33
40
  emojiManager: EmojiManager;
34
41
  mentionManager: MentionManager;
35
42
  imageCompressionConfig: ImageCompressionConfig;
36
- currentUser?: SendbirdUser;
37
- setCurrentUser: React.Dispatch<React.SetStateAction<SendbirdUser | undefined>>;
43
+ voiceMessageConfig: VoiceMessageConfig;
38
44
 
39
45
  // helper functions
40
46
  updateCurrentUserInfo: (nickname?: string, profile?: string | FileType) => Promise<SendbirdUser>;
@@ -84,6 +90,7 @@ export const SendbirdChatProvider = ({
84
90
  emojiManager,
85
91
  mentionManager,
86
92
  imageCompressionConfig,
93
+ voiceMessageConfig,
87
94
  enableAutoPushTokenRegistration,
88
95
  enableUseUserIdForNickname,
89
96
  enableImageCompression,
@@ -155,6 +162,7 @@ export const SendbirdChatProvider = ({
155
162
  emojiManager,
156
163
  mentionManager,
157
164
  imageCompressionConfig,
165
+ voiceMessageConfig,
158
166
  currentUser,
159
167
  setCurrentUser,
160
168
 
@@ -1,5 +1,4 @@
1
- import React, { useContext, useEffect, useRef } from 'react';
2
- import type { FlatList } from 'react-native';
1
+ import React, { useContext, useEffect } from 'react';
3
2
 
4
3
  import { useChannelHandler } from '@sendbird/uikit-chat-hooks';
5
4
  import { useToast } from '@sendbird/uikit-react-native-foundation';
@@ -18,45 +17,32 @@ const GroupChannelMessageList = (props: GroupChannelProps['MessageList']) => {
18
17
  const { sdk } = useSendbirdChat();
19
18
  const { setMessageToEdit, setMessageToReply } = useContext(GroupChannelContexts.Fragment);
20
19
  const { subscribe } = useContext(GroupChannelContexts.PubSub);
20
+ const { flatListRef, lazyScrollToBottom, lazyScrollToIndex } = useContext(GroupChannelContexts.MessageList);
21
21
 
22
22
  const id = useUniqHandlerId('GroupChannelMessageList');
23
- const ref = useRef<FlatList<SendbirdMessage>>(null);
24
23
  const isFirstMount = useIsFirstMount();
25
24
 
26
- // FIXME: Workaround, should run after data has been applied to UI.
27
- const lazyScrollToBottom = (animated = false, timeout = 0) => {
28
- setTimeout(() => {
29
- ref.current?.scrollToOffset({ offset: 0, animated });
30
- }, timeout);
31
- };
25
+ const scrollToMessageWithCreatedAt = useFreshCallback(
26
+ (createdAt: number, focusAnimated: boolean, timeout: number): boolean => {
27
+ const foundMessageIndex = props.messages.findIndex((it) => it.createdAt === createdAt);
28
+ const isIncludedInList = foundMessageIndex > -1;
32
29
 
33
- // FIXME: Workaround, should run after data has been applied to UI.
34
- const lazyScrollToIndex = (index = 0, animated = false, timeout = 0) => {
35
- setTimeout(() => {
36
- ref.current?.scrollToIndex({ index, animated, viewPosition: 0.5 });
37
- }, timeout);
38
- };
39
-
40
- const scrollToMessage = useFreshCallback((createdAt: number, focusAnimated = false): boolean => {
41
- const foundMessageIndex = props.messages.findIndex((it) => it.createdAt === createdAt);
42
- const isIncludedInList = foundMessageIndex > -1;
43
-
44
- if (isIncludedInList) {
45
- if (focusAnimated) {
46
- setTimeout(() => props.onUpdateSearchItem({ startingPoint: createdAt }), MESSAGE_FOCUS_ANIMATION_DELAY);
47
- }
48
- lazyScrollToIndex(foundMessageIndex, true, isFirstMount ? MESSAGE_SEARCH_SAFE_SCROLL_DELAY : 0);
49
- } else {
50
- if (props.channel.messageOffsetTimestamp <= createdAt) {
51
- if (focusAnimated) props.onUpdateSearchItem({ startingPoint: createdAt });
52
- props.onResetMessageListWithStartingPoint(createdAt);
30
+ if (isIncludedInList) {
31
+ if (focusAnimated) {
32
+ setTimeout(() => props.onUpdateSearchItem({ startingPoint: createdAt }), MESSAGE_FOCUS_ANIMATION_DELAY);
33
+ }
34
+ lazyScrollToIndex({ index: foundMessageIndex, animated: true, timeout });
53
35
  } else {
54
- return false;
36
+ if (props.channel.messageOffsetTimestamp <= createdAt) {
37
+ if (focusAnimated) props.onUpdateSearchItem({ startingPoint: createdAt });
38
+ props.onResetMessageListWithStartingPoint(createdAt);
39
+ } else {
40
+ return false;
41
+ }
55
42
  }
56
- }
57
-
58
- return true;
59
- });
43
+ return true;
44
+ },
45
+ );
60
46
 
61
47
  const scrollToBottom = useFreshCallback((animated = false) => {
62
48
  if (props.hasNext()) {
@@ -65,10 +51,10 @@ const GroupChannelMessageList = (props: GroupChannelProps['MessageList']) => {
65
51
 
66
52
  props.onResetMessageList(() => {
67
53
  props.onScrolledAwayFromBottom(false);
68
- lazyScrollToBottom(animated);
54
+ lazyScrollToBottom({ animated });
69
55
  });
70
56
  } else {
71
- lazyScrollToBottom(animated);
57
+ lazyScrollToBottom({ animated });
72
58
  }
73
59
  });
74
60
 
@@ -79,7 +65,7 @@ const GroupChannelMessageList = (props: GroupChannelProps['MessageList']) => {
79
65
  const isRecentMessage = recentMessage && recentMessage.messageId === event.messageId;
80
66
  const scrollReachedBottomAndCanScroll = !props.scrolledAwayFromBottom && !props.hasNext();
81
67
  if (isRecentMessage && scrollReachedBottomAndCanScroll) {
82
- lazyScrollToBottom(true, 250);
68
+ lazyScrollToBottom({ animated: true, timeout: 250 });
83
69
  }
84
70
  },
85
71
  });
@@ -102,24 +88,24 @@ const GroupChannelMessageList = (props: GroupChannelProps['MessageList']) => {
102
88
  });
103
89
  }, [props.scrolledAwayFromBottom]);
104
90
 
105
- // Only trigger once when message list mount with initial props.searchItem
106
- // - Search screen + searchItem > mount message list
107
- // - Reset message list + searchItem > re-mount message list
108
91
  useEffect(() => {
92
+ // Only trigger once when message list mount with initial props.searchItem
93
+ // - Search screen + searchItem > mount message list
94
+ // - Reset message list + searchItem > re-mount message list
109
95
  if (isFirstMount && props.searchItem) {
110
- scrollToMessage(props.searchItem.startingPoint);
96
+ scrollToMessageWithCreatedAt(props.searchItem.startingPoint, false, MESSAGE_SEARCH_SAFE_SCROLL_DELAY);
111
97
  }
112
98
  }, [isFirstMount]);
113
99
 
114
100
  const onPressParentMessage = useFreshCallback((message: SendbirdMessage) => {
115
- const canScrollToParent = scrollToMessage(message.createdAt, true);
101
+ const canScrollToParent = scrollToMessageWithCreatedAt(message.createdAt, true, 0);
116
102
  if (!canScrollToParent) toast.show(STRINGS.TOAST.FIND_PARENT_MSG_ERROR, 'error');
117
103
  });
118
104
 
119
105
  return (
120
106
  <ChannelMessageList
121
107
  {...props}
122
- ref={ref}
108
+ ref={flatListRef}
123
109
  onReplyMessage={setMessageToReply}
124
110
  onEditMessage={setMessageToEdit}
125
111
  onPressParentMessage={onPressParentMessage}