@sendbird/uikit-react-native 2.1.0 → 2.3.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 (431) hide show
  1. package/README.md +42 -17
  2. package/lib/commonjs/components/ChatFlatList.js +2 -1
  3. package/lib/commonjs/components/ChatFlatList.js.map +1 -1
  4. package/lib/commonjs/components/FileViewer.js +2 -5
  5. package/lib/commonjs/components/FileViewer.js.map +1 -1
  6. package/lib/commonjs/components/MessageRenderer/FileMessage/BaseFileMessage.js +11 -6
  7. package/lib/commonjs/components/MessageRenderer/FileMessage/BaseFileMessage.js.map +1 -1
  8. package/lib/commonjs/components/MessageRenderer/FileMessage/ImageFileMessage.js +12 -2
  9. package/lib/commonjs/components/MessageRenderer/FileMessage/ImageFileMessage.js.map +1 -1
  10. package/lib/commonjs/components/MessageRenderer/FileMessage/VideoFileMessage.js +26 -11
  11. package/lib/commonjs/components/MessageRenderer/FileMessage/VideoFileMessage.js.map +1 -1
  12. package/lib/commonjs/components/MessageRenderer/FileMessage/index.js +1 -6
  13. package/lib/commonjs/components/MessageRenderer/FileMessage/index.js.map +1 -1
  14. package/lib/commonjs/components/MessageRenderer/UserMessage/BaseUserMessage.js +86 -10
  15. package/lib/commonjs/components/MessageRenderer/UserMessage/BaseUserMessage.js.map +1 -1
  16. package/lib/commonjs/components/MessageRenderer/UserMessage/OpenGraphUserMessage.js +102 -15
  17. package/lib/commonjs/components/MessageRenderer/UserMessage/OpenGraphUserMessage.js.map +1 -1
  18. package/lib/commonjs/components/MessageRenderer/UserMessage/index.js.map +1 -1
  19. package/lib/commonjs/components/MessageRenderer/index.js +22 -3
  20. package/lib/commonjs/components/MessageRenderer/index.js.map +1 -1
  21. package/lib/commonjs/components/ReactionAddons/BottomSheetReactionAddon.js +150 -0
  22. package/lib/commonjs/components/ReactionAddons/BottomSheetReactionAddon.js.map +1 -0
  23. package/lib/commonjs/components/ReactionAddons/MessageReactionAddon.js +135 -0
  24. package/lib/commonjs/components/ReactionAddons/MessageReactionAddon.js.map +1 -0
  25. package/lib/commonjs/components/ReactionAddons/ReactionRoundedButton.js +87 -0
  26. package/lib/commonjs/components/ReactionAddons/ReactionRoundedButton.js.map +1 -0
  27. package/lib/commonjs/components/ReactionAddons/index.js +19 -0
  28. package/lib/commonjs/components/ReactionAddons/index.js.map +1 -0
  29. package/lib/commonjs/components/ReactionBottomSheets/ReactionListBottomSheet.js +150 -0
  30. package/lib/commonjs/components/ReactionBottomSheets/ReactionListBottomSheet.js.map +1 -0
  31. package/lib/commonjs/components/ReactionBottomSheets/ReactionUserListBottomSheet.js +276 -0
  32. package/lib/commonjs/components/ReactionBottomSheets/ReactionUserListBottomSheet.js.map +1 -0
  33. package/lib/commonjs/components/ReactionBottomSheets/index.js +19 -0
  34. package/lib/commonjs/components/ReactionBottomSheets/index.js.map +1 -0
  35. package/lib/commonjs/constants.js +3 -1
  36. package/lib/commonjs/constants.js.map +1 -1
  37. package/lib/commonjs/containers/GroupChannelPreviewContainer.js +4 -1
  38. package/lib/commonjs/containers/GroupChannelPreviewContainer.js.map +1 -1
  39. package/lib/commonjs/containers/SendbirdUIKitContainer.js +130 -79
  40. package/lib/commonjs/containers/SendbirdUIKitContainer.js.map +1 -1
  41. package/lib/commonjs/contexts/PlatformServiceCtx.js.map +1 -1
  42. package/lib/commonjs/contexts/ReactionCtx.js +107 -0
  43. package/lib/commonjs/contexts/ReactionCtx.js.map +1 -0
  44. package/lib/commonjs/contexts/SendbirdChatCtx.js +26 -18
  45. package/lib/commonjs/contexts/SendbirdChatCtx.js.map +1 -1
  46. package/lib/commonjs/contexts/UserProfileCtx.js +9 -0
  47. package/lib/commonjs/contexts/UserProfileCtx.js.map +1 -1
  48. package/lib/commonjs/domain/groupChannel/component/GroupChannelInput/EditInput.js +33 -37
  49. package/lib/commonjs/domain/groupChannel/component/GroupChannelInput/EditInput.js.map +1 -1
  50. package/lib/commonjs/domain/groupChannel/component/GroupChannelInput/SendInput.js +95 -23
  51. package/lib/commonjs/domain/groupChannel/component/GroupChannelInput/SendInput.js.map +1 -1
  52. package/lib/commonjs/domain/groupChannel/component/GroupChannelInput/index.js +121 -31
  53. package/lib/commonjs/domain/groupChannel/component/GroupChannelInput/index.js.map +1 -1
  54. package/lib/commonjs/domain/groupChannel/component/GroupChannelMessageList.js +34 -13
  55. package/lib/commonjs/domain/groupChannel/component/GroupChannelMessageList.js.map +1 -1
  56. package/lib/commonjs/domain/groupChannel/component/GroupChannelSuggestedMentionList.js +210 -0
  57. package/lib/commonjs/domain/groupChannel/component/GroupChannelSuggestedMentionList.js.map +1 -0
  58. package/lib/commonjs/domain/groupChannel/index.js +8 -0
  59. package/lib/commonjs/domain/groupChannel/index.js.map +1 -1
  60. package/lib/commonjs/domain/groupChannel/module/createGroupChannelModule.js +4 -0
  61. package/lib/commonjs/domain/groupChannel/module/createGroupChannelModule.js.map +1 -1
  62. package/lib/commonjs/domain/groupChannel/module/moduleContext.js +4 -4
  63. package/lib/commonjs/domain/groupChannel/module/moduleContext.js.map +1 -1
  64. package/lib/commonjs/domain/groupChannel/types.js.map +1 -1
  65. package/lib/commonjs/domain/groupChannelBannedUsers/component/GroupChannelBannedUsersList.js +3 -2
  66. package/lib/commonjs/domain/groupChannelBannedUsers/component/GroupChannelBannedUsersList.js.map +1 -1
  67. package/lib/commonjs/domain/groupChannelList/component/GroupChannelListList.js +2 -1
  68. package/lib/commonjs/domain/groupChannelList/component/GroupChannelListList.js.map +1 -1
  69. package/lib/commonjs/domain/groupChannelMutedMembers/component/GroupChannelMutedMembersList.js +2 -1
  70. package/lib/commonjs/domain/groupChannelMutedMembers/component/GroupChannelMutedMembersList.js.map +1 -1
  71. package/lib/commonjs/domain/groupChannelNotifications/component/GroupChannelNotificationsHeader.js +39 -0
  72. package/lib/commonjs/domain/groupChannelNotifications/component/GroupChannelNotificationsHeader.js.map +1 -0
  73. package/lib/commonjs/domain/groupChannelNotifications/component/GroupChannelNotificationsView.js +140 -0
  74. package/lib/commonjs/domain/groupChannelNotifications/component/GroupChannelNotificationsView.js.map +1 -0
  75. package/lib/commonjs/domain/groupChannelNotifications/index.js +46 -0
  76. package/lib/commonjs/domain/groupChannelNotifications/index.js.map +1 -0
  77. package/lib/commonjs/domain/groupChannelNotifications/module/createGroupChannelNotificationsModule.js +33 -0
  78. package/lib/commonjs/domain/groupChannelNotifications/module/createGroupChannelNotificationsModule.js.map +1 -0
  79. package/lib/commonjs/domain/groupChannelNotifications/module/moduleContext.js +45 -0
  80. package/lib/commonjs/domain/groupChannelNotifications/module/moduleContext.js.map +1 -0
  81. package/lib/commonjs/domain/groupChannelNotifications/types.js +6 -0
  82. package/lib/commonjs/domain/groupChannelNotifications/types.js.map +1 -0
  83. package/lib/commonjs/domain/groupChannelOperators/component/GroupChannelOperatorsList.js +2 -1
  84. package/lib/commonjs/domain/groupChannelOperators/component/GroupChannelOperatorsList.js.map +1 -1
  85. package/lib/commonjs/domain/groupChannelSettings/component/GroupChannelSettingsMenu.js +49 -6
  86. package/lib/commonjs/domain/groupChannelSettings/component/GroupChannelSettingsMenu.js.map +1 -1
  87. package/lib/commonjs/domain/groupChannelSettings/module/moduleContext.js +11 -16
  88. package/lib/commonjs/domain/groupChannelSettings/module/moduleContext.js.map +1 -1
  89. package/lib/commonjs/domain/groupChannelSettings/types.js.map +1 -1
  90. package/lib/commonjs/domain/groupChannelUserList/types.js.map +1 -1
  91. package/lib/commonjs/domain/userList/component/UserListList.js +4 -1
  92. package/lib/commonjs/domain/userList/component/UserListList.js.map +1 -1
  93. package/lib/commonjs/domain/userList/module/createUserListModule.js.map +1 -1
  94. package/lib/commonjs/fragments/createGroupChannelCreateFragment.js.map +1 -1
  95. package/lib/commonjs/fragments/createGroupChannelFragment.js +11 -4
  96. package/lib/commonjs/fragments/createGroupChannelFragment.js.map +1 -1
  97. package/lib/commonjs/fragments/createGroupChannelInviteFragment.js.map +1 -1
  98. package/lib/commonjs/fragments/createGroupChannelListFragment.js +4 -14
  99. package/lib/commonjs/fragments/createGroupChannelListFragment.js.map +1 -1
  100. package/lib/commonjs/fragments/createGroupChannelNotificationsFragment.js +34 -0
  101. package/lib/commonjs/fragments/createGroupChannelNotificationsFragment.js.map +1 -0
  102. package/lib/commonjs/fragments/createGroupChannelSettingsFragment.js +3 -1
  103. package/lib/commonjs/fragments/createGroupChannelSettingsFragment.js.map +1 -1
  104. package/lib/commonjs/hooks/useConnection.js +3 -0
  105. package/lib/commonjs/hooks/useConnection.js.map +1 -1
  106. package/lib/commonjs/hooks/useContext.js +11 -1
  107. package/lib/commonjs/hooks/useContext.js.map +1 -1
  108. package/lib/commonjs/hooks/useKeyboardStatus.js +97 -0
  109. package/lib/commonjs/hooks/useKeyboardStatus.js.map +1 -0
  110. package/lib/commonjs/hooks/useMentionSuggestion.js +110 -0
  111. package/lib/commonjs/hooks/useMentionSuggestion.js.map +1 -0
  112. package/lib/commonjs/hooks/useMentionTextInput.js +139 -0
  113. package/lib/commonjs/hooks/useMentionTextInput.js.map +1 -0
  114. package/lib/commonjs/index.js +95 -40
  115. package/lib/commonjs/index.js.map +1 -1
  116. package/lib/commonjs/libs/EmojiManager.js +100 -0
  117. package/lib/commonjs/libs/EmojiManager.js.map +1 -0
  118. package/lib/commonjs/libs/ImageCompressionConfig.js +38 -0
  119. package/lib/commonjs/libs/ImageCompressionConfig.js.map +1 -0
  120. package/lib/commonjs/libs/MentionConfig.js +47 -0
  121. package/lib/commonjs/libs/MentionConfig.js.map +1 -0
  122. package/lib/commonjs/libs/MentionManager.js +235 -0
  123. package/lib/commonjs/libs/MentionManager.js.map +1 -0
  124. package/lib/commonjs/libs/SBUUtils.js +27 -0
  125. package/lib/commonjs/libs/SBUUtils.js.map +1 -1
  126. package/lib/commonjs/localization/StringSet.type.js +20 -5
  127. package/lib/commonjs/localization/StringSet.type.js.map +1 -1
  128. package/lib/commonjs/platform/createMediaService.expo.js +35 -1
  129. package/lib/commonjs/platform/createMediaService.expo.js.map +1 -1
  130. package/lib/commonjs/platform/createMediaService.native.js +41 -6
  131. package/lib/commonjs/platform/createMediaService.native.js.map +1 -1
  132. package/lib/commonjs/platform/dynamicModule.js +9 -57
  133. package/lib/commonjs/platform/dynamicModule.js.map +1 -1
  134. package/lib/commonjs/platform/types.js.map +1 -1
  135. package/lib/commonjs/types.js.map +1 -1
  136. package/lib/commonjs/version.js +1 -1
  137. package/lib/commonjs/version.js.map +1 -1
  138. package/lib/module/components/ChatFlatList.js +3 -2
  139. package/lib/module/components/ChatFlatList.js.map +1 -1
  140. package/lib/module/components/FileViewer.js +2 -5
  141. package/lib/module/components/FileViewer.js.map +1 -1
  142. package/lib/module/components/MessageRenderer/FileMessage/BaseFileMessage.js +11 -6
  143. package/lib/module/components/MessageRenderer/FileMessage/BaseFileMessage.js.map +1 -1
  144. package/lib/module/components/MessageRenderer/FileMessage/ImageFileMessage.js +12 -2
  145. package/lib/module/components/MessageRenderer/FileMessage/ImageFileMessage.js.map +1 -1
  146. package/lib/module/components/MessageRenderer/FileMessage/VideoFileMessage.js +26 -11
  147. package/lib/module/components/MessageRenderer/FileMessage/VideoFileMessage.js.map +1 -1
  148. package/lib/module/components/MessageRenderer/FileMessage/index.js +1 -5
  149. package/lib/module/components/MessageRenderer/FileMessage/index.js.map +1 -1
  150. package/lib/module/components/MessageRenderer/UserMessage/BaseUserMessage.js +86 -12
  151. package/lib/module/components/MessageRenderer/UserMessage/BaseUserMessage.js.map +1 -1
  152. package/lib/module/components/MessageRenderer/UserMessage/OpenGraphUserMessage.js +103 -19
  153. package/lib/module/components/MessageRenderer/UserMessage/OpenGraphUserMessage.js.map +1 -1
  154. package/lib/module/components/MessageRenderer/UserMessage/index.js.map +1 -1
  155. package/lib/module/components/MessageRenderer/index.js +21 -4
  156. package/lib/module/components/MessageRenderer/index.js.map +1 -1
  157. package/lib/module/components/ReactionAddons/BottomSheetReactionAddon.js +132 -0
  158. package/lib/module/components/ReactionAddons/BottomSheetReactionAddon.js.map +1 -0
  159. package/lib/module/components/ReactionAddons/MessageReactionAddon.js +118 -0
  160. package/lib/module/components/ReactionAddons/MessageReactionAddon.js.map +1 -0
  161. package/lib/module/components/ReactionAddons/ReactionRoundedButton.js +74 -0
  162. package/lib/module/components/ReactionAddons/ReactionRoundedButton.js.map +1 -0
  163. package/lib/module/components/ReactionAddons/index.js +7 -0
  164. package/lib/module/components/ReactionAddons/index.js.map +1 -0
  165. package/lib/module/components/ReactionBottomSheets/ReactionListBottomSheet.js +135 -0
  166. package/lib/module/components/ReactionBottomSheets/ReactionListBottomSheet.js.map +1 -0
  167. package/lib/module/components/ReactionBottomSheets/ReactionUserListBottomSheet.js +259 -0
  168. package/lib/module/components/ReactionBottomSheets/ReactionUserListBottomSheet.js.map +1 -0
  169. package/lib/module/components/ReactionBottomSheets/index.js +7 -0
  170. package/lib/module/components/ReactionBottomSheets/index.js.map +1 -0
  171. package/lib/module/constants.js +1 -0
  172. package/lib/module/constants.js.map +1 -1
  173. package/lib/module/containers/GroupChannelPreviewContainer.js +4 -1
  174. package/lib/module/containers/GroupChannelPreviewContainer.js.map +1 -1
  175. package/lib/module/containers/SendbirdUIKitContainer.js +127 -81
  176. package/lib/module/containers/SendbirdUIKitContainer.js.map +1 -1
  177. package/lib/module/contexts/PlatformServiceCtx.js.map +1 -1
  178. package/lib/module/contexts/ReactionCtx.js +85 -0
  179. package/lib/module/contexts/ReactionCtx.js.map +1 -0
  180. package/lib/module/contexts/SendbirdChatCtx.js +28 -18
  181. package/lib/module/contexts/SendbirdChatCtx.js.map +1 -1
  182. package/lib/module/contexts/UserProfileCtx.js +7 -0
  183. package/lib/module/contexts/UserProfileCtx.js.map +1 -1
  184. package/lib/module/domain/groupChannel/component/GroupChannelInput/EditInput.js +34 -39
  185. package/lib/module/domain/groupChannel/component/GroupChannelInput/EditInput.js.map +1 -1
  186. package/lib/module/domain/groupChannel/component/GroupChannelInput/SendInput.js +92 -26
  187. package/lib/module/domain/groupChannel/component/GroupChannelInput/SendInput.js.map +1 -1
  188. package/lib/module/domain/groupChannel/component/GroupChannelInput/index.js +118 -33
  189. package/lib/module/domain/groupChannel/component/GroupChannelInput/index.js.map +1 -1
  190. package/lib/module/domain/groupChannel/component/GroupChannelMessageList.js +35 -16
  191. package/lib/module/domain/groupChannel/component/GroupChannelMessageList.js.map +1 -1
  192. package/lib/module/domain/groupChannel/component/GroupChannelSuggestedMentionList.js +188 -0
  193. package/lib/module/domain/groupChannel/component/GroupChannelSuggestedMentionList.js.map +1 -0
  194. package/lib/module/domain/groupChannel/index.js +1 -0
  195. package/lib/module/domain/groupChannel/index.js.map +1 -1
  196. package/lib/module/domain/groupChannel/module/createGroupChannelModule.js +3 -0
  197. package/lib/module/domain/groupChannel/module/createGroupChannelModule.js.map +1 -1
  198. package/lib/module/domain/groupChannel/module/moduleContext.js +4 -4
  199. package/lib/module/domain/groupChannel/module/moduleContext.js.map +1 -1
  200. package/lib/module/domain/groupChannel/types.js.map +1 -1
  201. package/lib/module/domain/groupChannelBannedUsers/component/GroupChannelBannedUsersList.js +4 -3
  202. package/lib/module/domain/groupChannelBannedUsers/component/GroupChannelBannedUsersList.js.map +1 -1
  203. package/lib/module/domain/groupChannelList/component/GroupChannelListList.js +3 -2
  204. package/lib/module/domain/groupChannelList/component/GroupChannelListList.js.map +1 -1
  205. package/lib/module/domain/groupChannelMutedMembers/component/GroupChannelMutedMembersList.js +3 -2
  206. package/lib/module/domain/groupChannelMutedMembers/component/GroupChannelMutedMembersList.js.map +1 -1
  207. package/lib/module/domain/groupChannelNotifications/component/GroupChannelNotificationsHeader.js +25 -0
  208. package/lib/module/domain/groupChannelNotifications/component/GroupChannelNotificationsHeader.js.map +1 -0
  209. package/lib/module/domain/groupChannelNotifications/component/GroupChannelNotificationsView.js +122 -0
  210. package/lib/module/domain/groupChannelNotifications/component/GroupChannelNotificationsView.js.map +1 -0
  211. package/lib/module/domain/groupChannelNotifications/index.js +5 -0
  212. package/lib/module/domain/groupChannelNotifications/index.js.map +1 -0
  213. package/lib/module/domain/groupChannelNotifications/module/createGroupChannelNotificationsModule.js +21 -0
  214. package/lib/module/domain/groupChannelNotifications/module/createGroupChannelNotificationsModule.js.map +1 -0
  215. package/lib/module/domain/groupChannelNotifications/module/moduleContext.js +25 -0
  216. package/lib/module/domain/groupChannelNotifications/module/moduleContext.js.map +1 -0
  217. package/lib/module/domain/groupChannelNotifications/types.js +2 -0
  218. package/lib/module/domain/groupChannelNotifications/types.js.map +1 -0
  219. package/lib/module/domain/groupChannelOperators/component/GroupChannelOperatorsList.js +3 -2
  220. package/lib/module/domain/groupChannelOperators/component/GroupChannelOperatorsList.js.map +1 -1
  221. package/lib/module/domain/groupChannelSettings/component/GroupChannelSettingsMenu.js +46 -6
  222. package/lib/module/domain/groupChannelSettings/component/GroupChannelSettingsMenu.js.map +1 -1
  223. package/lib/module/domain/groupChannelSettings/module/moduleContext.js +12 -17
  224. package/lib/module/domain/groupChannelSettings/module/moduleContext.js.map +1 -1
  225. package/lib/module/domain/groupChannelSettings/types.js.map +1 -1
  226. package/lib/module/domain/groupChannelUserList/types.js.map +1 -1
  227. package/lib/module/domain/userList/component/UserListList.js +3 -1
  228. package/lib/module/domain/userList/component/UserListList.js.map +1 -1
  229. package/lib/module/domain/userList/module/createUserListModule.js.map +1 -1
  230. package/lib/module/fragments/createGroupChannelCreateFragment.js.map +1 -1
  231. package/lib/module/fragments/createGroupChannelFragment.js +11 -4
  232. package/lib/module/fragments/createGroupChannelFragment.js.map +1 -1
  233. package/lib/module/fragments/createGroupChannelInviteFragment.js.map +1 -1
  234. package/lib/module/fragments/createGroupChannelListFragment.js +5 -9
  235. package/lib/module/fragments/createGroupChannelListFragment.js.map +1 -1
  236. package/lib/module/fragments/createGroupChannelNotificationsFragment.js +22 -0
  237. package/lib/module/fragments/createGroupChannelNotificationsFragment.js.map +1 -0
  238. package/lib/module/fragments/createGroupChannelSettingsFragment.js +3 -1
  239. package/lib/module/fragments/createGroupChannelSettingsFragment.js.map +1 -1
  240. package/lib/module/hooks/useConnection.js +3 -0
  241. package/lib/module/hooks/useConnection.js.map +1 -1
  242. package/lib/module/hooks/useContext.js +6 -0
  243. package/lib/module/hooks/useContext.js.map +1 -1
  244. package/lib/module/hooks/useKeyboardStatus.js +78 -0
  245. package/lib/module/hooks/useKeyboardStatus.js.map +1 -0
  246. package/lib/module/hooks/useMentionSuggestion.js +100 -0
  247. package/lib/module/hooks/useMentionSuggestion.js.map +1 -0
  248. package/lib/module/hooks/useMentionTextInput.js +128 -0
  249. package/lib/module/hooks/useMentionTextInput.js.map +1 -0
  250. package/lib/module/index.js +8 -3
  251. package/lib/module/index.js.map +1 -1
  252. package/lib/module/libs/EmojiManager.js +90 -0
  253. package/lib/module/libs/EmojiManager.js.map +1 -0
  254. package/lib/module/libs/ImageCompressionConfig.js +30 -0
  255. package/lib/module/libs/ImageCompressionConfig.js.map +1 -0
  256. package/lib/module/libs/MentionConfig.js +39 -0
  257. package/lib/module/libs/MentionConfig.js.map +1 -0
  258. package/lib/module/libs/MentionManager.js +223 -0
  259. package/lib/module/libs/MentionManager.js.map +1 -0
  260. package/lib/module/libs/SBUUtils.js +26 -1
  261. package/lib/module/libs/SBUUtils.js.map +1 -1
  262. package/lib/module/localization/StringSet.type.js +21 -6
  263. package/lib/module/localization/StringSet.type.js.map +1 -1
  264. package/lib/module/platform/createMediaService.expo.js +33 -1
  265. package/lib/module/platform/createMediaService.expo.js.map +1 -1
  266. package/lib/module/platform/createMediaService.native.js +38 -5
  267. package/lib/module/platform/createMediaService.native.js.map +1 -1
  268. package/lib/module/platform/dynamicModule.js +10 -56
  269. package/lib/module/platform/dynamicModule.js.map +1 -1
  270. package/lib/module/platform/types.js.map +1 -1
  271. package/lib/module/types.js.map +1 -1
  272. package/lib/module/version.js +1 -1
  273. package/lib/module/version.js.map +1 -1
  274. package/lib/typescript/__template__/types.d.ts +3 -3
  275. package/lib/typescript/src/components/ChannelCover.d.ts +1 -1
  276. package/lib/typescript/src/components/ChatFlatList.d.ts +1 -1
  277. package/lib/typescript/src/components/FileViewer.d.ts +1 -1
  278. package/lib/typescript/src/components/MessageRenderer/AdminMessage/index.d.ts +1 -1
  279. package/lib/typescript/src/components/MessageRenderer/FileMessage/BaseFileMessage.d.ts +2 -2
  280. package/lib/typescript/src/components/MessageRenderer/FileMessage/ImageFileMessage.d.ts +1 -1
  281. package/lib/typescript/src/components/MessageRenderer/FileMessage/VideoFileMessage.d.ts +1 -1
  282. package/lib/typescript/src/components/MessageRenderer/FileMessage/index.d.ts +11 -2
  283. package/lib/typescript/src/components/MessageRenderer/MessageDateSeparator.d.ts +1 -1
  284. package/lib/typescript/src/components/MessageRenderer/MessageIncomingAvatar.d.ts +1 -1
  285. package/lib/typescript/src/components/MessageRenderer/MessageIncomingSenderName.d.ts +1 -1
  286. package/lib/typescript/src/components/MessageRenderer/MessageOutgoingStatus.d.ts +1 -1
  287. package/lib/typescript/src/components/MessageRenderer/MessageTime.d.ts +1 -1
  288. package/lib/typescript/src/components/MessageRenderer/UnknownMessage/index.d.ts +1 -1
  289. package/lib/typescript/src/components/MessageRenderer/UserMessage/BaseUserMessage.d.ts +1 -1
  290. package/lib/typescript/src/components/MessageRenderer/UserMessage/OpenGraphUserMessage.d.ts +2 -2
  291. package/lib/typescript/src/components/MessageRenderer/UserMessage/index.d.ts +4 -1
  292. package/lib/typescript/src/components/MessageRenderer/index.d.ts +4 -3
  293. package/lib/typescript/src/components/NewMessagesButton.d.ts +1 -1
  294. package/lib/typescript/src/components/ReactionAddons/BottomSheetReactionAddon.d.ts +8 -0
  295. package/lib/typescript/src/components/ReactionAddons/MessageReactionAddon.d.ts +6 -0
  296. package/lib/typescript/src/components/ReactionAddons/ReactionRoundedButton.d.ts +14 -0
  297. package/lib/typescript/src/components/ReactionAddons/index.d.ts +11 -0
  298. package/lib/typescript/src/components/ReactionBottomSheets/ReactionListBottomSheet.d.ts +3 -0
  299. package/lib/typescript/src/components/ReactionBottomSheets/ReactionUserListBottomSheet.d.ts +3 -0
  300. package/lib/typescript/src/components/ReactionBottomSheets/index.d.ts +20 -0
  301. package/lib/typescript/src/components/ScrollToBottomButton.d.ts +1 -1
  302. package/lib/typescript/src/components/StatusComposition.d.ts +1 -1
  303. package/lib/typescript/src/components/TypedPlaceholder.d.ts +1 -1
  304. package/lib/typescript/src/components/UserActionBar.d.ts +1 -1
  305. package/lib/typescript/src/components/UserSelectableBar.d.ts +1 -1
  306. package/lib/typescript/src/constants.d.ts +1 -0
  307. package/lib/typescript/src/containers/GroupChannelPreviewContainer.d.ts +1 -1
  308. package/lib/typescript/src/containers/SendbirdUIKitContainer.d.ts +20 -8
  309. package/lib/typescript/src/contexts/LocalizationCtx.d.ts +2 -2
  310. package/lib/typescript/src/contexts/PlatformServiceCtx.d.ts +9 -3
  311. package/lib/typescript/src/contexts/ReactionCtx.d.ts +18 -0
  312. package/lib/typescript/src/contexts/SendbirdChatCtx.d.ts +16 -3
  313. package/lib/typescript/src/contexts/UserProfileCtx.d.ts +4 -4
  314. package/lib/typescript/src/domain/groupChannel/component/GroupChannelInput/EditInput.d.ts +35 -7
  315. package/lib/typescript/src/domain/groupChannel/component/GroupChannelInput/SendInput.d.ts +32 -5
  316. package/lib/typescript/src/domain/groupChannel/component/GroupChannelInput/index.d.ts +19 -2
  317. package/lib/typescript/src/domain/groupChannel/component/GroupChannelSuggestedMentionList.d.ts +3 -0
  318. package/lib/typescript/src/domain/groupChannel/index.d.ts +1 -0
  319. package/lib/typescript/src/domain/groupChannel/module/createGroupChannelModule.d.ts +1 -1
  320. package/lib/typescript/src/domain/groupChannel/types.d.ts +24 -7
  321. package/lib/typescript/src/domain/groupChannelBannedUsers/types.d.ts +3 -3
  322. package/lib/typescript/src/domain/groupChannelList/types.d.ts +2 -2
  323. package/lib/typescript/src/domain/groupChannelModeration/types.d.ts +3 -3
  324. package/lib/typescript/src/domain/groupChannelMutedMembers/types.d.ts +3 -3
  325. package/lib/typescript/src/domain/groupChannelNotifications/component/GroupChannelNotificationsHeader.d.ts +3 -0
  326. package/lib/typescript/src/domain/groupChannelNotifications/component/GroupChannelNotificationsView.d.ts +2 -0
  327. package/lib/typescript/src/domain/groupChannelNotifications/index.d.ts +4 -0
  328. package/lib/typescript/src/domain/groupChannelNotifications/module/createGroupChannelNotificationsModule.d.ts +3 -0
  329. package/lib/typescript/src/domain/groupChannelNotifications/module/moduleContext.d.ts +3 -0
  330. package/lib/typescript/src/domain/groupChannelNotifications/types.d.ts +33 -0
  331. package/lib/typescript/src/domain/groupChannelOperators/types.d.ts +3 -3
  332. package/lib/typescript/src/domain/groupChannelSettings/component/GroupChannelSettingsMenu.d.ts +1 -1
  333. package/lib/typescript/src/domain/groupChannelSettings/types.d.ts +3 -1
  334. package/lib/typescript/src/domain/groupChannelUserList/types.d.ts +6 -6
  335. package/lib/typescript/src/domain/userList/component/UserListList.d.ts +2 -1
  336. package/lib/typescript/src/domain/userList/module/createUserListModule.d.ts +2 -1
  337. package/lib/typescript/src/fragments/createGroupChannelCreateFragment.d.ts +1 -1
  338. package/lib/typescript/src/fragments/createGroupChannelInviteFragment.d.ts +1 -1
  339. package/lib/typescript/src/fragments/createGroupChannelNotificationsFragment.d.ts +3 -0
  340. package/lib/typescript/src/hooks/useConnection.d.ts +1 -1
  341. package/lib/typescript/src/hooks/useContext.d.ts +3 -26
  342. package/lib/typescript/src/hooks/useKeyboardStatus.d.ts +6 -0
  343. package/lib/typescript/src/hooks/useMentionSuggestion.d.ts +17 -0
  344. package/lib/typescript/src/hooks/useMentionTextInput.d.ts +18 -0
  345. package/lib/typescript/src/index.d.ts +8 -3
  346. package/lib/typescript/src/libs/EmojiManager.d.ts +16 -0
  347. package/lib/typescript/src/libs/ImageCompressionConfig.d.ts +16 -0
  348. package/lib/typescript/src/libs/MentionConfig.d.ts +24 -0
  349. package/lib/typescript/src/libs/MentionManager.d.ts +61 -0
  350. package/lib/typescript/src/libs/SBUUtils.d.ts +6 -0
  351. package/lib/typescript/src/localization/StringSet.type.d.ts +19 -2
  352. package/lib/typescript/src/platform/createMediaService.expo.d.ts +6 -2
  353. package/lib/typescript/src/platform/createMediaService.native.d.ts +8 -6
  354. package/lib/typescript/src/platform/dynamicModule.d.ts +8 -13
  355. package/lib/typescript/src/platform/types.d.ts +33 -8
  356. package/lib/typescript/src/types.d.ts +13 -4
  357. package/lib/typescript/src/version.d.ts +1 -1
  358. package/package.json +16 -6
  359. package/src/components/ChatFlatList.tsx +2 -1
  360. package/src/components/FileViewer.tsx +2 -5
  361. package/src/components/MessageRenderer/FileMessage/BaseFileMessage.tsx +17 -12
  362. package/src/components/MessageRenderer/FileMessage/ImageFileMessage.tsx +30 -18
  363. package/src/components/MessageRenderer/FileMessage/VideoFileMessage.tsx +21 -11
  364. package/src/components/MessageRenderer/FileMessage/index.tsx +1 -4
  365. package/src/components/MessageRenderer/UserMessage/BaseUserMessage.tsx +82 -14
  366. package/src/components/MessageRenderer/UserMessage/OpenGraphUserMessage.tsx +136 -62
  367. package/src/components/MessageRenderer/UserMessage/index.tsx +8 -1
  368. package/src/components/MessageRenderer/index.tsx +39 -7
  369. package/src/components/ReactionAddons/BottomSheetReactionAddon.tsx +106 -0
  370. package/src/components/ReactionAddons/MessageReactionAddon.tsx +123 -0
  371. package/src/components/ReactionAddons/ReactionRoundedButton.tsx +71 -0
  372. package/src/components/ReactionAddons/index.tsx +7 -0
  373. package/src/components/ReactionBottomSheets/ReactionListBottomSheet.tsx +113 -0
  374. package/src/components/ReactionBottomSheets/ReactionUserListBottomSheet.tsx +249 -0
  375. package/src/components/ReactionBottomSheets/index.tsx +24 -0
  376. package/src/constants.ts +2 -0
  377. package/src/containers/GroupChannelPreviewContainer.tsx +3 -1
  378. package/src/containers/SendbirdUIKitContainer.tsx +165 -88
  379. package/src/contexts/PlatformServiceCtx.tsx +9 -2
  380. package/src/contexts/ReactionCtx.tsx +102 -0
  381. package/src/contexts/SendbirdChatCtx.tsx +46 -21
  382. package/src/contexts/UserProfileCtx.tsx +9 -0
  383. package/src/domain/groupChannel/component/GroupChannelInput/EditInput.tsx +56 -30
  384. package/src/domain/groupChannel/component/GroupChannelInput/SendInput.tsx +129 -32
  385. package/src/domain/groupChannel/component/GroupChannelInput/index.tsx +138 -43
  386. package/src/domain/groupChannel/component/GroupChannelMessageList.tsx +30 -12
  387. package/src/domain/groupChannel/component/GroupChannelSuggestedMentionList.tsx +173 -0
  388. package/src/domain/groupChannel/index.ts +1 -0
  389. package/src/domain/groupChannel/module/createGroupChannelModule.tsx +12 -1
  390. package/src/domain/groupChannel/module/moduleContext.tsx +4 -4
  391. package/src/domain/groupChannel/types.ts +28 -5
  392. package/src/domain/groupChannelBannedUsers/component/GroupChannelBannedUsersList.tsx +3 -2
  393. package/src/domain/groupChannelList/component/GroupChannelListList.tsx +2 -1
  394. package/src/domain/groupChannelMutedMembers/component/GroupChannelMutedMembersList.tsx +2 -1
  395. package/src/domain/groupChannelNotifications/component/GroupChannelNotificationsHeader.tsx +14 -0
  396. package/src/domain/groupChannelNotifications/component/GroupChannelNotificationsView.tsx +128 -0
  397. package/src/domain/groupChannelNotifications/index.ts +4 -0
  398. package/src/domain/groupChannelNotifications/module/createGroupChannelNotificationsModule.tsx +15 -0
  399. package/src/domain/groupChannelNotifications/module/moduleContext.tsx +31 -0
  400. package/src/domain/groupChannelNotifications/types.ts +38 -0
  401. package/src/domain/groupChannelOperators/component/GroupChannelOperatorsList.tsx +2 -1
  402. package/src/domain/groupChannelSettings/component/GroupChannelSettingsMenu.tsx +42 -3
  403. package/src/domain/groupChannelSettings/module/moduleContext.tsx +17 -14
  404. package/src/domain/groupChannelSettings/types.ts +2 -0
  405. package/src/domain/groupChannelUserList/types.ts +7 -2
  406. package/src/domain/userList/component/UserListList.tsx +5 -1
  407. package/src/domain/userList/module/createUserListModule.tsx +3 -1
  408. package/src/fragments/createGroupChannelCreateFragment.tsx +8 -2
  409. package/src/fragments/createGroupChannelFragment.tsx +19 -6
  410. package/src/fragments/createGroupChannelInviteFragment.tsx +2 -2
  411. package/src/fragments/createGroupChannelListFragment.tsx +5 -9
  412. package/src/fragments/createGroupChannelNotificationsFragment.tsx +27 -0
  413. package/src/fragments/createGroupChannelSettingsFragment.tsx +2 -0
  414. package/src/hooks/useConnection.ts +3 -1
  415. package/src/hooks/useContext.ts +7 -0
  416. package/src/hooks/useKeyboardStatus.ts +59 -0
  417. package/src/hooks/useMentionSuggestion.ts +106 -0
  418. package/src/hooks/useMentionTextInput.ts +139 -0
  419. package/src/index.ts +14 -2
  420. package/src/libs/EmojiManager.ts +80 -0
  421. package/src/libs/ImageCompressionConfig.ts +31 -0
  422. package/src/libs/MentionConfig.ts +40 -0
  423. package/src/libs/MentionManager.tsx +240 -0
  424. package/src/libs/SBUUtils.ts +28 -1
  425. package/src/localization/StringSet.type.ts +45 -8
  426. package/src/platform/createMediaService.expo.tsx +24 -1
  427. package/src/platform/createMediaService.native.tsx +31 -9
  428. package/src/platform/dynamicModule.ts +17 -59
  429. package/src/platform/types.ts +29 -7
  430. package/src/types.ts +12 -0
  431. package/src/version.ts +1 -1
@@ -21,6 +21,8 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
21
21
 
22
22
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
23
23
 
24
+ let WARN_onCreateChannel = false;
25
+
24
26
  const UserProfileContext = /*#__PURE__*/_react.default.createContext(null);
25
27
 
26
28
  exports.UserProfileContext = UserProfileContext;
@@ -35,6 +37,13 @@ const UserProfileProvider = _ref => {
35
37
  const localizationContext = (0, _react.useContext)(_LocalizationCtx.LocalizationContext);
36
38
  if (!chatContext) throw new Error('SendbirdChatContext is not provided');
37
39
  if (!localizationContext) throw new Error('LocalizationContext is not provided');
40
+
41
+ if (__DEV__ && !WARN_onCreateChannel && !onCreateChannel) {
42
+ _uikitUtils.Logger.warn('You should pass `userProfile.onCreateChannel` prop to SendbirdUIKitContainer if want to use message in a user profile');
43
+
44
+ WARN_onCreateChannel = true;
45
+ }
46
+
38
47
  const {
39
48
  bottom,
40
49
  left,
@@ -1 +1 @@
1
- {"version":3,"names":["UserProfileContext","React","createContext","UserProfileProvider","children","onCreateChannel","onBeforeCreateChannel","PASS","chatContext","useContext","SendbirdChatContext","localizationContext","LocalizationContext","Error","bottom","left","right","useSafeAreaInsets","user","setUser","useState","visible","setVisible","show","useCallback","hide","userProfileButton","useIIFE","isMe","currentUser","userId","undefined","onPressMessageButton","params","invitedUserIds","name","coverUrl","isDistinct","operatorUserIds","processedParams","channel","sdk","groupChannel","createChannel","Logger","warn","STRINGS","PROFILE_CARD","BUTTON_MESSAGE","Boolean","styles","modal","profileCardContainer","paddingLeft","paddingRight","paddingBottom","profileUrl","nickname","LABELS","USER_NO_NAME","BODY_LABEL","BODY","createStyleSheet","justifyContent","borderTopLeftRadius","borderTopRightRadius"],"sources":["UserProfileCtx.tsx"],"sourcesContent":["import React, { useCallback, useContext, useState } from 'react';\nimport { useSafeAreaInsets } from 'react-native-safe-area-context';\n\nimport { Modal, OutlinedButton, ProfileCard, createStyleSheet } from '@sendbird/uikit-react-native-foundation';\nimport type {\n SendbirdGroupChannel,\n SendbirdGroupChannelCreateParams,\n SendbirdMember,\n SendbirdUser,\n} from '@sendbird/uikit-utils';\nimport { Logger, PASS, useIIFE } from '@sendbird/uikit-utils';\n\nimport { LocalizationContext } from '../contexts/LocalizationCtx';\nimport { SendbirdChatContext } from '../contexts/SendbirdChatCtx';\n\ntype OnCreateChannel = (channel: SendbirdGroupChannel) => void;\ntype OnBeforeCreateChannel = (\n channelParams: SendbirdGroupChannelCreateParams,\n users: SendbirdUser[] | SendbirdMember[],\n) => SendbirdGroupChannelCreateParams | Promise<SendbirdGroupChannelCreateParams>;\n\nexport type UserProfileContextType = {\n show(user: SendbirdUser | SendbirdMember): void;\n hide(): void;\n};\n\ntype Props = React.PropsWithChildren<{\n onCreateChannel?: OnCreateChannel;\n onBeforeCreateChannel?: OnBeforeCreateChannel;\n}>;\n\nexport const UserProfileContext = React.createContext<UserProfileContextType | null>(null);\nexport const UserProfileProvider = ({ children, onCreateChannel, onBeforeCreateChannel = PASS }: Props) => {\n const chatContext = useContext(SendbirdChatContext);\n const localizationContext = useContext(LocalizationContext);\n\n if (!chatContext) throw new Error('SendbirdChatContext is not provided');\n if (!localizationContext) throw new Error('LocalizationContext is not provided');\n\n const { bottom, left, right } = useSafeAreaInsets();\n\n const [user, setUser] = useState<SendbirdUser | SendbirdMember>();\n const [visible, setVisible] = useState(false);\n\n const show: UserProfileContextType['show'] = useCallback((user) => {\n setUser(user);\n setVisible(true);\n }, []);\n\n const hide: UserProfileContextType['hide'] = useCallback(() => {\n setVisible(false);\n }, []);\n\n const userProfileButton = useIIFE(() => {\n const isMe = chatContext.currentUser && user?.userId === chatContext.currentUser.userId;\n if (isMe) return undefined;\n\n const onPressMessageButton = async () => {\n if (user) {\n const params: SendbirdGroupChannelCreateParams = {\n invitedUserIds: [user.userId],\n name: '',\n coverUrl: '',\n isDistinct: false,\n };\n\n if (chatContext.currentUser) params.operatorUserIds = [chatContext.currentUser.userId];\n const processedParams = await onBeforeCreateChannel(params, [user]);\n\n hide();\n const channel = await chatContext.sdk.groupChannel.createChannel(processedParams);\n\n if (onCreateChannel) {\n onCreateChannel(channel);\n } else {\n Logger.warn(\n 'Please set `onCreateChannel` before message to user from profile card, see `userProfile` prop in the `SendbirdUIKitContainer` props',\n );\n }\n }\n };\n\n return (\n <OutlinedButton onPress={onPressMessageButton}>\n {localizationContext.STRINGS.PROFILE_CARD.BUTTON_MESSAGE}\n </OutlinedButton>\n );\n });\n\n return (\n <UserProfileContext.Provider value={{ show, hide }}>\n {children}\n <Modal\n type={'slide'}\n onClose={hide}\n onDismiss={() => setUser(undefined)}\n visible={visible && Boolean(user)}\n backgroundStyle={styles.modal}\n >\n {user && (\n <ProfileCard\n containerStyle={[\n styles.profileCardContainer,\n { paddingLeft: left, paddingRight: right, paddingBottom: bottom },\n ]}\n uri={user.profileUrl}\n username={user.nickname || localizationContext.STRINGS.LABELS.USER_NO_NAME}\n bodyLabel={localizationContext.STRINGS.PROFILE_CARD.BODY_LABEL}\n body={localizationContext.STRINGS.PROFILE_CARD.BODY(user)}\n button={userProfileButton}\n />\n )}\n </Modal>\n </UserProfileContext.Provider>\n );\n};\n\nconst styles = createStyleSheet({\n modal: {\n justifyContent: 'flex-end',\n },\n profileCardContainer: {\n borderTopLeftRadius: 8,\n borderTopRightRadius: 8,\n },\n});\n"],"mappings":";;;;;;;AAAA;;AACA;;AAEA;;AAOA;;AAEA;;AACA;;;;;;AAkBO,MAAMA,kBAAkB,gBAAGC,cAAA,CAAMC,aAAN,CAAmD,IAAnD,CAA3B;;;;AACA,MAAMC,mBAAmB,GAAG,QAAwE;EAAA,IAAvE;IAAEC,QAAF;IAAYC,eAAZ;IAA6BC,qBAAqB,GAAGC;EAArD,CAAuE;EACzG,MAAMC,WAAW,GAAG,IAAAC,iBAAA,EAAWC,oCAAX,CAApB;EACA,MAAMC,mBAAmB,GAAG,IAAAF,iBAAA,EAAWG,oCAAX,CAA5B;EAEA,IAAI,CAACJ,WAAL,EAAkB,MAAM,IAAIK,KAAJ,CAAU,qCAAV,CAAN;EAClB,IAAI,CAACF,mBAAL,EAA0B,MAAM,IAAIE,KAAJ,CAAU,qCAAV,CAAN;EAE1B,MAAM;IAAEC,MAAF;IAAUC,IAAV;IAAgBC;EAAhB,IAA0B,IAAAC,6CAAA,GAAhC;EAEA,MAAM,CAACC,IAAD,EAAOC,OAAP,IAAkB,IAAAC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,EAAE;IACpBY,mBAAmB,EAAE,CADD;IAEpBC,oBAAoB,EAAE;EAFF;AAJQ,CAAjB,CAAf"}
1
+ {"version":3,"names":["WARN_onCreateChannel","UserProfileContext","React","createContext","UserProfileProvider","children","onCreateChannel","onBeforeCreateChannel","PASS","chatContext","useContext","SendbirdChatContext","localizationContext","LocalizationContext","Error","__DEV__","Logger","warn","bottom","left","right","useSafeAreaInsets","user","setUser","useState","visible","setVisible","show","useCallback","hide","userProfileButton","useIIFE","isMe","currentUser","userId","undefined","onPressMessageButton","params","invitedUserIds","name","coverUrl","isDistinct","operatorUserIds","processedParams","channel","sdk","groupChannel","createChannel","STRINGS","PROFILE_CARD","BUTTON_MESSAGE","Boolean","styles","modal","profileCardContainer","paddingLeft","paddingRight","paddingBottom","profileUrl","nickname","LABELS","USER_NO_NAME","BODY_LABEL","BODY","createStyleSheet","justifyContent","borderTopLeftRadius","borderTopRightRadius"],"sources":["UserProfileCtx.tsx"],"sourcesContent":["import React, { useCallback, useContext, useState } from 'react';\nimport { useSafeAreaInsets } from 'react-native-safe-area-context';\n\nimport { Modal, OutlinedButton, ProfileCard, createStyleSheet } from '@sendbird/uikit-react-native-foundation';\nimport type {\n SendbirdGroupChannel,\n SendbirdGroupChannelCreateParams,\n SendbirdMember,\n SendbirdUser,\n} from '@sendbird/uikit-utils';\nimport { Logger, PASS, useIIFE } from '@sendbird/uikit-utils';\n\nimport { LocalizationContext } from '../contexts/LocalizationCtx';\nimport { SendbirdChatContext } from '../contexts/SendbirdChatCtx';\n\ntype OnCreateChannel = (channel: SendbirdGroupChannel) => void;\ntype OnBeforeCreateChannel = (\n channelParams: SendbirdGroupChannelCreateParams,\n users: SendbirdUser[] | SendbirdMember[],\n) => SendbirdGroupChannelCreateParams | Promise<SendbirdGroupChannelCreateParams>;\n\nexport type UserProfileContextType = {\n show(user: SendbirdUser | SendbirdMember): void;\n hide(): void;\n};\n\ntype Props = React.PropsWithChildren<{\n onCreateChannel?: OnCreateChannel;\n onBeforeCreateChannel?: OnBeforeCreateChannel;\n}>;\n\nlet WARN_onCreateChannel = false;\n\nexport const UserProfileContext = React.createContext<UserProfileContextType | null>(null);\nexport const UserProfileProvider = ({ children, onCreateChannel, onBeforeCreateChannel = PASS }: Props) => {\n const chatContext = useContext(SendbirdChatContext);\n const localizationContext = useContext(LocalizationContext);\n\n if (!chatContext) throw new Error('SendbirdChatContext is not provided');\n if (!localizationContext) throw new Error('LocalizationContext is not provided');\n\n if (__DEV__ && !WARN_onCreateChannel && !onCreateChannel) {\n Logger.warn(\n 'You should pass `userProfile.onCreateChannel` prop to SendbirdUIKitContainer if want to use message in a user profile',\n );\n WARN_onCreateChannel = true;\n }\n\n const { bottom, left, right } = useSafeAreaInsets();\n\n const [user, setUser] = useState<SendbirdUser | SendbirdMember>();\n const [visible, setVisible] = useState(false);\n\n const show: UserProfileContextType['show'] = useCallback((user) => {\n setUser(user);\n setVisible(true);\n }, []);\n\n const hide: UserProfileContextType['hide'] = useCallback(() => {\n setVisible(false);\n }, []);\n\n const userProfileButton = useIIFE(() => {\n const isMe = chatContext.currentUser && user?.userId === chatContext.currentUser.userId;\n if (isMe) return undefined;\n\n const onPressMessageButton = async () => {\n if (user) {\n const params: SendbirdGroupChannelCreateParams = {\n invitedUserIds: [user.userId],\n name: '',\n coverUrl: '',\n isDistinct: false,\n };\n\n if (chatContext.currentUser) params.operatorUserIds = [chatContext.currentUser.userId];\n const processedParams = await onBeforeCreateChannel(params, [user]);\n\n hide();\n const channel = await chatContext.sdk.groupChannel.createChannel(processedParams);\n\n if (onCreateChannel) {\n onCreateChannel(channel);\n } else {\n Logger.warn(\n 'Please set `onCreateChannel` before message to user from profile card, see `userProfile` prop in the `SendbirdUIKitContainer` props',\n );\n }\n }\n };\n\n return (\n <OutlinedButton onPress={onPressMessageButton}>\n {localizationContext.STRINGS.PROFILE_CARD.BUTTON_MESSAGE}\n </OutlinedButton>\n );\n });\n\n return (\n <UserProfileContext.Provider value={{ show, hide }}>\n {children}\n <Modal\n type={'slide'}\n onClose={hide}\n onDismiss={() => setUser(undefined)}\n visible={visible && Boolean(user)}\n backgroundStyle={styles.modal}\n >\n {user && (\n <ProfileCard\n containerStyle={[\n styles.profileCardContainer,\n { paddingLeft: left, paddingRight: right, paddingBottom: bottom },\n ]}\n uri={user.profileUrl}\n username={user.nickname || localizationContext.STRINGS.LABELS.USER_NO_NAME}\n bodyLabel={localizationContext.STRINGS.PROFILE_CARD.BODY_LABEL}\n body={localizationContext.STRINGS.PROFILE_CARD.BODY(user)}\n button={userProfileButton}\n />\n )}\n </Modal>\n </UserProfileContext.Provider>\n );\n};\n\nconst styles = createStyleSheet({\n modal: {\n justifyContent: 'flex-end',\n },\n profileCardContainer: {\n borderTopLeftRadius: 8,\n borderTopRightRadius: 8,\n },\n});\n"],"mappings":";;;;;;;AAAA;;AACA;;AAEA;;AAOA;;AAEA;;AACA;;;;;;AAkBA,IAAIA,oBAAoB,GAAG,KAA3B;;AAEO,MAAMC,kBAAkB,gBAAGC,cAAA,CAAMC,aAAN,CAAmD,IAAnD,CAA3B;;;;AACA,MAAMC,mBAAmB,GAAG,QAAwE;EAAA,IAAvE;IAAEC,QAAF;IAAYC,eAAZ;IAA6BC,qBAAqB,GAAGC;EAArD,CAAuE;EACzG,MAAMC,WAAW,GAAG,IAAAC,iBAAA,EAAWC,oCAAX,CAApB;EACA,MAAMC,mBAAmB,GAAG,IAAAF,iBAAA,EAAWG,oCAAX,CAA5B;EAEA,IAAI,CAACJ,WAAL,EAAkB,MAAM,IAAIK,KAAJ,CAAU,qCAAV,CAAN;EAClB,IAAI,CAACF,mBAAL,EAA0B,MAAM,IAAIE,KAAJ,CAAU,qCAAV,CAAN;;EAE1B,IAAIC,OAAO,IAAI,CAACf,oBAAZ,IAAoC,CAACM,eAAzC,EAA0D;IACxDU,kBAAA,CAAOC,IAAP,CACE,uHADF;;IAGAjB,oBAAoB,GAAG,IAAvB;EACD;;EAED,MAAM;IAAEkB,MAAF;IAAUC,IAAV;IAA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AAG,IAAAY,4CAAA,EAAiB;EAC9BX,KAAK,EAAE;IACLY,cAAc,EAAE;EADX,CADuB;EAI9BX,oBAAoB,EAAE;IACpBY,mBAAmB,EAAE,CADD;IAEpBC,oBAAoB,EAAE;EAFF;AAJQ,CAAjB,CAAf"}
@@ -9,6 +9,8 @@ var _react = _interopRequireWildcard(require("react"));
9
9
 
10
10
  var _reactNative = require("react-native");
11
11
 
12
+ var _message = require("@sendbird/chat/message");
13
+
12
14
  var _uikitReactNativeFoundation = require("@sendbird/uikit-react-native-foundation");
13
15
 
14
16
  var _useContext = require("../../../../hooks/useContext");
@@ -17,49 +19,43 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
17
19
 
18
20
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
19
21
 
20
- const AUTO_FOCUS = _reactNative.Platform.select({
21
- ios: false,
22
- android: true,
23
- default: false
24
- });
25
-
26
- const EditInput = _ref => {
22
+ const EditInput = /*#__PURE__*/(0, _react.forwardRef)(function EditInput(_ref, ref) {
27
23
  let {
28
24
  text,
29
- setText,
30
- editMessage,
31
- setEditMessage,
25
+ onChangeText,
26
+ messageToEdit,
27
+ setMessageToEdit,
32
28
  onUpdateUserMessage,
33
- disabled
29
+ onSelectionChange,
30
+ disabled,
31
+ autoFocus,
32
+ mentionedUsers
34
33
  } = _ref;
34
+ const {
35
+ mentionManager
36
+ } = (0, _useContext.useSendbirdChat)();
35
37
  const {
36
38
  STRINGS
37
39
  } = (0, _useContext.useLocalization)();
38
- const inputRef = (0, _react.useRef)(null);
39
40
  const toast = (0, _uikitReactNativeFoundation.useToast)();
40
- (0, _react.useEffect)(() => {
41
- if (editMessage.isUserMessage()) {
42
- setText(editMessage.message ?? '');
43
- if (!AUTO_FOCUS) setTimeout(() => {
44
- var _inputRef$current;
45
-
46
- return (_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 ? void 0 : _inputRef$current.focus();
47
- }, 500);
48
- }
49
- }, [editMessage]);
50
41
 
51
42
  const onPressCancel = () => {
52
- setEditMessage();
53
- setText('');
43
+ setMessageToEdit();
44
+ onChangeText('');
54
45
  };
55
46
 
56
47
  const onPressSave = () => {
57
- if (editMessage.isUserMessage()) {
58
- onUpdateUserMessage(text, editMessage).catch(() => toast.show(STRINGS.TOAST.UPDATE_MSG_ERROR, 'error'));
48
+ if (messageToEdit.isUserMessage()) {
49
+ const mention = {
50
+ userIds: mentionedUsers.map(it => it.user.userId),
51
+ messageTemplate: mentionManager.textToMentionedMessageTemplate(text, mentionedUsers),
52
+ type: _message.MentionType.USERS
53
+ };
54
+ onUpdateUserMessage(text, messageToEdit, mention).catch(() => toast.show(STRINGS.TOAST.UPDATE_MSG_ERROR, 'error'));
59
55
  }
60
56
 
61
- setEditMessage();
62
- setText('');
57
+ setMessageToEdit();
58
+ onChangeText('');
63
59
  };
64
60
 
65
61
  return /*#__PURE__*/_react.default.createElement(_reactNative.View, {
@@ -67,15 +63,16 @@ const EditInput = _ref => {
67
63
  }, /*#__PURE__*/_react.default.createElement(_reactNative.View, {
68
64
  style: styles.inputWrapper
69
65
  }, /*#__PURE__*/_react.default.createElement(_uikitReactNativeFoundation.TextInput, {
70
- editable: !disabled,
71
- autoFocus: AUTO_FOCUS,
72
- ref: inputRef,
66
+ ref: ref,
73
67
  multiline: true,
74
- value: text,
75
- onChangeText: setText,
68
+ disableFullscreenUI: true,
69
+ editable: !disabled,
70
+ autoFocus: autoFocus,
71
+ onChangeText: onChangeText,
76
72
  style: styles.input,
77
- placeholder: STRINGS.GROUP_CHANNEL.INPUT_PLACEHOLDER_ACTIVE
78
- })), /*#__PURE__*/_react.default.createElement(_reactNative.View, {
73
+ placeholder: STRINGS.GROUP_CHANNEL.INPUT_PLACEHOLDER_ACTIVE,
74
+ onSelectionChange: onSelectionChange
75
+ }, mentionManager.textToMentionedComponents(text, mentionedUsers))), /*#__PURE__*/_react.default.createElement(_reactNative.View, {
79
76
  style: {
80
77
  marginTop: 8,
81
78
  flexDirection: 'row'
@@ -89,8 +86,7 @@ const EditInput = _ref => {
89
86
  variant: 'contained',
90
87
  onPress: onPressSave
91
88
  }, STRINGS.GROUP_CHANNEL.INPUT_EDIT_OK)));
92
- };
93
-
89
+ });
94
90
  const styles = (0, _uikitReactNativeFoundation.createStyleSheet)({
95
91
  editInputContainer: {
96
92
  paddingVertical: 10,
@@ -1 +1 @@
1
- {"version":3,"names":["AUTO_FOCUS","Platform","select","ios","android","default","EditInput","text","setText","editMessage","setEditMessage","onUpdateUserMessage","disabled","STRINGS","useLocalization","inputRef","useRef","toast","useToast","useEffect","isUserMessage","message","setTimeout","current","focus","onPressCancel","onPressSave","catch","show","TOAST","UPDATE_MSG_ERROR","styles","editInputContainer","inputWrapper","input","GROUP_CHANNEL","INPUT_PLACEHOLDER_ACTIVE","marginTop","flexDirection","INPUT_EDIT_CANCEL","space","INPUT_EDIT_OK","createStyleSheet","paddingVertical","paddingHorizontal","alignItems","flex","marginRight","minHeight","maxHeight","borderRadius"],"sources":["EditInput.tsx"],"sourcesContent":["import React, { useEffect, useRef } from 'react';\nimport { Platform, TextInput as RNTextInput, View } from 'react-native';\n\nimport { Button, TextInput, createStyleSheet, useToast } from '@sendbird/uikit-react-native-foundation';\nimport type { SendbirdFileMessage, SendbirdUserMessage } from '@sendbird/uikit-utils';\n\nimport { useLocalization } from '../../../../hooks/useContext';\nimport type { GroupChannelProps } from '../../types';\n\ntype EditInputProps = GroupChannelProps['Input'] & {\n text: string;\n setText: (val: string) => void;\n editMessage: SendbirdUserMessage | SendbirdFileMessage;\n setEditMessage: (msg?: SendbirdUserMessage | SendbirdFileMessage) => void;\n disabled: boolean;\n};\n\nconst AUTO_FOCUS = Platform.select({ ios: false, android: true, default: false });\nconst EditInput = ({ text, setText, editMessage, setEditMessage, onUpdateUserMessage, disabled }: EditInputProps) => {\n const { STRINGS } = useLocalization();\n const inputRef = useRef<RNTextInput>(null);\n const toast = useToast();\n\n useEffect(() => {\n if (editMessage.isUserMessage()) {\n setText(editMessage.message ?? '');\n\n if (!AUTO_FOCUS) setTimeout(() => inputRef.current?.focus(), 500);\n }\n }, [editMessage]);\n\n const onPressCancel = () => {\n setEditMessage();\n setText('');\n };\n\n const onPressSave = () => {\n if (editMessage.isUserMessage()) {\n onUpdateUserMessage(text, editMessage).catch(() => toast.show(STRINGS.TOAST.UPDATE_MSG_ERROR, 'error'));\n }\n setEditMessage();\n setText('');\n };\n\n return (\n <View style={styles.editInputContainer}>\n <View style={styles.inputWrapper}>\n <TextInput\n editable={!disabled}\n autoFocus={AUTO_FOCUS}\n ref={inputRef}\n multiline\n value={text}\n onChangeText={setText}\n style={styles.input}\n placeholder={STRINGS.GROUP_CHANNEL.INPUT_PLACEHOLDER_ACTIVE}\n />\n </View>\n <View style={{ marginTop: 8, flexDirection: 'row' }}>\n <Button variant={'text'} onPress={onPressCancel}>\n {STRINGS.GROUP_CHANNEL.INPUT_EDIT_CANCEL}\n </Button>\n <View style={styles.space} />\n <Button variant={'contained'} onPress={onPressSave}>\n {STRINGS.GROUP_CHANNEL.INPUT_EDIT_OK}\n </Button>\n </View>\n </View>\n );\n};\n\nconst styles = createStyleSheet({\n editInputContainer: {\n paddingVertical: 10,\n paddingHorizontal: 16,\n flexDirection: 'column',\n alignItems: 'center',\n },\n input: {\n flex: 1,\n marginRight: 4,\n minHeight: 36,\n maxHeight: 36 * Platform.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,CAAgB;MAAEC,GAAG,EAAE,GAAP;MAAYE,OAAO,EAAE;IAArB,CAAhB,CAJX;IAKL6C,YAAY,EAAE;EALT,CAPuB;EAc9BjB,YAAY,EAAE;IACZK,aAAa,EAAE;EADH,CAdgB;EAiB9BE,KAAK,EAAE;IACLM,IAAI,EAAE;EADD;AAjBuB,CAAjB,CAAf;eAsBexC,S"}
1
+ {"version":3,"names":["EditInput","forwardRef","ref","text","onChangeText","messageToEdit","setMessageToEdit","onUpdateUserMessage","onSelectionChange","disabled","autoFocus","mentionedUsers","mentionManager","useSendbirdChat","STRINGS","useLocalization","toast","useToast","onPressCancel","onPressSave","isUserMessage","mention","userIds","map","it","user","userId","messageTemplate","textToMentionedMessageTemplate","type","MentionType","USERS","catch","show","TOAST","UPDATE_MSG_ERROR","styles","editInputContainer","inputWrapper","input","GROUP_CHANNEL","INPUT_PLACEHOLDER_ACTIVE","textToMentionedComponents","marginTop","flexDirection","INPUT_EDIT_CANCEL","space","INPUT_EDIT_OK","createStyleSheet","paddingVertical","paddingHorizontal","alignItems","flex","marginRight","minHeight","maxHeight","Platform","select","ios","default","borderRadius"],"sources":["EditInput.tsx"],"sourcesContent":["import React, { forwardRef } from 'react';\nimport {\n NativeSyntheticEvent,\n Platform,\n TextInput as RNTextInput,\n TextInputSelectionChangeEventData,\n View,\n} from 'react-native';\n\nimport { MentionType } from '@sendbird/chat/message';\nimport { Button, TextInput, createStyleSheet, useToast } from '@sendbird/uikit-react-native-foundation';\nimport type { SendbirdFileMessage, SendbirdUserMessage } from '@sendbird/uikit-utils';\n\nimport { useLocalization, useSendbirdChat } from '../../../../hooks/useContext';\nimport type { MentionedUser } from '../../../../types';\nimport type { GroupChannelProps } from '../../types';\n\ntype EditInputProps = GroupChannelProps['Input'] & {\n text: string;\n onChangeText: (val: string) => void;\n messageToEdit: SendbirdUserMessage | SendbirdFileMessage;\n setMessageToEdit: (msg?: SendbirdUserMessage | SendbirdFileMessage) => void;\n onSelectionChange: (e: NativeSyntheticEvent<TextInputSelectionChangeEventData>) => void;\n disabled: boolean;\n autoFocus: boolean;\n mentionedUsers: MentionedUser[];\n};\n\nconst EditInput = forwardRef<RNTextInput, EditInputProps>(function EditInput(\n {\n text,\n onChangeText,\n messageToEdit,\n setMessageToEdit,\n onUpdateUserMessage,\n onSelectionChange,\n disabled,\n autoFocus,\n mentionedUsers,\n },\n ref,\n) {\n const { mentionManager } = useSendbirdChat();\n const { STRINGS } = useLocalization();\n const toast = useToast();\n\n const onPressCancel = () => {\n setMessageToEdit();\n onChangeText('');\n };\n\n const onPressSave = () => {\n if (messageToEdit.isUserMessage()) {\n const mention = {\n userIds: mentionedUsers.map((it) => it.user.userId),\n messageTemplate: mentionManager.textToMentionedMessageTemplate(text, mentionedUsers),\n type: MentionType.USERS,\n };\n\n onUpdateUserMessage(text, messageToEdit, mention).catch(() =>\n toast.show(STRINGS.TOAST.UPDATE_MSG_ERROR, 'error'),\n );\n }\n setMessageToEdit();\n onChangeText('');\n };\n\n return (\n <View style={styles.editInputContainer}>\n <View style={styles.inputWrapper}>\n <TextInput\n ref={ref}\n multiline\n disableFullscreenUI\n editable={!disabled}\n autoFocus={autoFocus}\n onChangeText={onChangeText}\n style={styles.input}\n placeholder={STRINGS.GROUP_CHANNEL.INPUT_PLACEHOLDER_ACTIVE}\n onSelectionChange={onSelectionChange}\n >\n {mentionManager.textToMentionedComponents(text, mentionedUsers)}\n </TextInput>\n </View>\n <View style={{ marginTop: 8, flexDirection: 'row' }}>\n <Button variant={'text'} onPress={onPressCancel}>\n {STRINGS.GROUP_CHANNEL.INPUT_EDIT_CANCEL}\n </Button>\n <View style={styles.space} />\n <Button variant={'contained'} onPress={onPressSave}>\n {STRINGS.GROUP_CHANNEL.INPUT_EDIT_OK}\n </Button>\n </View>\n </View>\n );\n});\n\nconst styles = createStyleSheet({\n editInputContainer: {\n paddingVertical: 10,\n paddingHorizontal: 16,\n flexDirection: 'column',\n alignItems: 'center',\n },\n input: {\n flex: 1,\n marginRight: 4,\n minHeight: 36,\n maxHeight: 36 * Platform.select({ ios: 2.5, default: 2 }),\n borderRadius: 20,\n },\n inputWrapper: {\n flexDirection: 'row',\n },\n space: {\n flex: 1,\n },\n});\n\nexport default EditInput;\n"],"mappings":";;;;;;;AAAA;;AACA;;AAQA;;AACA;;AAGA;;;;;;AAeA,MAAMA,SAAS,gBAAG,IAAAC,iBAAA,EAAwC,SAASD,SAAT,OAYxDE,GAZwD,EAaxD;EAAA,IAZA;IACEC,IADF;IAEEC,YAFF;IAGEC,aAHF;IAIEC,gBAJF;IAKEC,mBALF;IAMEC,iBANF;IAOEC,QAPF;IAQEC,SARF;IASEC;EATF,CAYA;EACA,MAAM;IAAEC;EAAF,IAAqB,IAAAC,2BAAA,GAA3B;EACA,MAAM;IAAEC;EAAF,IAAc,IAAAC,2BAAA,GAApB;EACA,MAAMC,KAAK,GAAG,IAAAC,oCAAA,GAAd;;EAEA,MAAMC,aAAa,GAAG,MAAM;IAC1BZ,gBAAgB;IAChBF,YAAY,CAAC,EAAD,CAAZ;EACD,CAHD;;EAKA,MAAMe,WAAW,GAAG,MAAM;IACxB,IAAId,aAAa,CAACe,aAAd,EAAJ,EAAmC;MACjC,MAAMC,OAAO,GAAG;QACdC,OAAO,EAAEX,cAAc,CAACY,GAAf,CAAoBC,EAAD,IAAQA,EAAE,CAACC,IAAH,CAAQC,MAAnC,CADK;QAEdC,eAAe,EAAEf,cAAc,CAACgB,8BAAf,CAA8CzB,IAA9C,EAAoDQ,cAApD,CAFH;QAGdkB,IAAI,EAAEC,oBAAA,CAAYC;MAHJ,CAAhB;MAMAxB,mBAAmB,CAACJ,IAAD,EAAOE,aAAP,EAAsBgB,OAAtB,CAAnB,CAAkDW,KAAlD,CAAwD,MACtDhB,KAAK,CAACiB,IAAN,CAAWnB,OAAO,CAACoB,KAAR,CAAcC,gBAAzB,EAA2C,OAA3C,CADF;IAGD;;IACD7B,gBAAgB;IAChBF,YAAY,CAAC,EAAD,CAAZ;EACD,CAdD;;E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AAA,CAASC,MAAT,CAAgB;MAAEC,GAAG,EAAE,GAAP;MAAYC,OAAO,EAAE;IAArB,CAAhB,CAJX;IAKLC,YAAY,EAAE;EALT,CAPuB;EAc9BtB,YAAY,EAAE;IACZM,aAAa,EAAE;EADH,CAdgB;EAiB9BE,KAAK,EAAE;IACLM,IAAI,EAAE;EADD;AAjBuB,CAAjB,CAAf;eAsBepD,S"}
@@ -5,10 +5,12 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = void 0;
7
7
 
8
- var _react = _interopRequireDefault(require("react"));
8
+ var _react = _interopRequireWildcard(require("react"));
9
9
 
10
10
  var _reactNative = require("react-native");
11
11
 
12
+ var _message = require("@sendbird/chat/message");
13
+
12
14
  var _uikitReactNativeFoundation = require("@sendbird/uikit-react-native-foundation");
13
15
 
14
16
  var _uikitUtils = require("@sendbird/uikit-utils");
@@ -21,21 +23,33 @@ var _SBUUtils = _interopRequireDefault(require("../../../../libs/SBUUtils"));
21
23
 
22
24
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
23
25
 
24
- const SendInput = _ref => {
26
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
27
+
28
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
29
+
30
+ const SendInput = /*#__PURE__*/(0, _react.forwardRef)(function SendInput(_ref, ref) {
25
31
  let {
26
32
  onSendUserMessage,
27
33
  onSendFileMessage,
28
34
  text,
29
- setText,
35
+ onChangeText,
30
36
  disabled,
31
37
  frozen,
32
- muted
38
+ muted,
39
+ onSelectionChange,
40
+ mentionedUsers
33
41
  } = _ref;
42
+ const {
43
+ mentionManager,
44
+ imageCompressionConfig,
45
+ features
46
+ } = (0, _useContext.useSendbirdChat)();
34
47
  const {
35
48
  STRINGS
36
49
  } = (0, _useContext.useLocalization)();
37
50
  const {
38
- fileService
51
+ fileService,
52
+ mediaService
39
53
  } = (0, _useContext.usePlatformService)();
40
54
  const {
41
55
  colors
@@ -49,8 +63,13 @@ const SendInput = _ref => {
49
63
  const toast = (0, _uikitReactNativeFoundation.useToast)();
50
64
 
51
65
  const onPressSend = () => {
52
- onSendUserMessage(text).catch(() => toast.show(STRINGS.TOAST.SEND_MSG_ERROR, 'error'));
53
- setText('');
66
+ const mention = {
67
+ userIds: mentionedUsers.map(it => it.user.userId),
68
+ messageTemplate: mentionManager.textToMentionedMessageTemplate(text, mentionedUsers),
69
+ type: _message.MentionType.USERS
70
+ };
71
+ onSendUserMessage(text, mention).catch(() => toast.show(STRINGS.TOAST.SEND_MSG_ERROR, 'error'));
72
+ onChangeText('');
54
73
  };
55
74
 
56
75
  const onPressAttachment = () => {
@@ -59,13 +78,13 @@ const SendInput = _ref => {
59
78
  title: STRINGS.GROUP_CHANNEL.DIALOG_ATTACHMENT_CAMERA,
60
79
  icon: 'camera',
61
80
  onPress: async () => {
62
- const photo = await fileService.openCamera({
81
+ const mediaFile = await fileService.openCamera({
63
82
  mediaType: 'all',
64
83
  onOpenFailure: error => {
65
84
  if (error.code === _SBUError.default.CODE.ERR_PERMISSIONS_DENIED) {
66
85
  alert({
67
86
  title: STRINGS.DIALOG.ALERT_PERMISSIONS_TITLE,
68
- message: STRINGS.DIALOG.ALERT_PERMISSIONS_MESSAGE('camera', 'UIKitSample'),
87
+ message: STRINGS.DIALOG.ALERT_PERMISSIONS_MESSAGE(STRINGS.LABELS.PERMISSION_CAMERA, STRINGS.LABELS.PERMISSION_APP_NAME),
69
88
  buttons: [{
70
89
  text: STRINGS.DIALOG.ALERT_PERMISSIONS_OK,
71
90
  onPress: () => _SBUUtils.default.openSettings()
@@ -77,22 +96,39 @@ const SendInput = _ref => {
77
96
  }
78
97
  });
79
98
 
80
- if (photo) {
81
- onSendFileMessage(photo).catch(() => toast.show(STRINGS.TOAST.SEND_MSG_ERROR, 'error'));
99
+ if (mediaFile) {
100
+ // Image compression
101
+ if ((0, _uikitUtils.isImage)(mediaFile.uri, mediaFile.type) && (0, _uikitUtils.shouldCompressImage)(mediaFile.uri, features.imageCompressionEnabled)) {
102
+ await _SBUUtils.default.safeRun(async () => {
103
+ const compressed = await mediaService.compressImage({
104
+ uri: mediaFile.uri,
105
+ maxWidth: imageCompressionConfig.width,
106
+ maxHeight: imageCompressionConfig.height,
107
+ compressionRate: imageCompressionConfig.compressionRate
108
+ });
109
+
110
+ if (compressed) {
111
+ mediaFile.uri = compressed.uri;
112
+ mediaFile.size = compressed.size;
113
+ }
114
+ });
115
+ }
116
+
117
+ onSendFileMessage(mediaFile).catch(() => toast.show(STRINGS.TOAST.SEND_MSG_ERROR, 'error'));
82
118
  }
83
119
  }
84
120
  }, {
85
121
  title: STRINGS.GROUP_CHANNEL.DIALOG_ATTACHMENT_PHOTO_LIBRARY,
86
122
  icon: 'photo',
87
123
  onPress: async () => {
88
- const photo = await fileService.openMediaLibrary({
124
+ const mediaFiles = await fileService.openMediaLibrary({
89
125
  selectionLimit: 1,
90
126
  mediaType: 'all',
91
127
  onOpenFailure: error => {
92
128
  if (error.code === _SBUError.default.CODE.ERR_PERMISSIONS_DENIED) {
93
129
  alert({
94
130
  title: STRINGS.DIALOG.ALERT_PERMISSIONS_TITLE,
95
- message: STRINGS.DIALOG.ALERT_PERMISSIONS_MESSAGE('device storage', 'UIKitSample'),
131
+ message: STRINGS.DIALOG.ALERT_PERMISSIONS_MESSAGE(STRINGS.LABELS.PERMISSION_DEVICE_STORAGE, STRINGS.LABELS.PERMISSION_APP_NAME),
96
132
  buttons: [{
97
133
  text: STRINGS.DIALOG.ALERT_PERMISSIONS_OK,
98
134
  onPress: () => _SBUUtils.default.openSettings()
@@ -104,20 +140,55 @@ const SendInput = _ref => {
104
140
  }
105
141
  });
106
142
 
107
- if (photo && photo[0]) {
108
- onSendFileMessage(photo[0]).catch(() => toast.show(STRINGS.TOAST.SEND_MSG_ERROR, 'error'));
143
+ if (mediaFiles && mediaFiles[0]) {
144
+ const mediaFile = mediaFiles[0]; // Image compression
145
+
146
+ if ((0, _uikitUtils.isImage)(mediaFile.uri, mediaFile.type) && (0, _uikitUtils.shouldCompressImage)(mediaFile.uri, features.imageCompressionEnabled)) {
147
+ await _SBUUtils.default.safeRun(async () => {
148
+ const compressed = await mediaService.compressImage({
149
+ uri: mediaFile.uri,
150
+ maxWidth: imageCompressionConfig.width,
151
+ maxHeight: imageCompressionConfig.height,
152
+ compressionRate: imageCompressionConfig.compressionRate
153
+ });
154
+
155
+ if (compressed) {
156
+ mediaFile.uri = compressed.uri;
157
+ mediaFile.size = compressed.size;
158
+ }
159
+ });
160
+ }
161
+
162
+ onSendFileMessage(mediaFiles[0]).catch(() => toast.show(STRINGS.TOAST.SEND_MSG_ERROR, 'error'));
109
163
  }
110
164
  }
111
165
  }, {
112
166
  title: STRINGS.GROUP_CHANNEL.DIALOG_ATTACHMENT_FILES,
113
167
  icon: 'document',
114
168
  onPress: async () => {
115
- const file = await fileService.openDocument({
169
+ const documentFile = await fileService.openDocument({
116
170
  onOpenFailure: () => toast.show(STRINGS.TOAST.OPEN_FILES_ERROR, 'error')
117
171
  });
118
172
 
119
- if (file) {
120
- onSendFileMessage(file).catch(() => toast.show(STRINGS.TOAST.SEND_MSG_ERROR, 'error'));
173
+ if (documentFile) {
174
+ // Image compression
175
+ if ((0, _uikitUtils.isImage)(documentFile.uri, documentFile.type) && (0, _uikitUtils.shouldCompressImage)(documentFile.uri, features.imageCompressionEnabled)) {
176
+ await _SBUUtils.default.safeRun(async () => {
177
+ const compressed = await mediaService.compressImage({
178
+ uri: documentFile.uri,
179
+ maxWidth: imageCompressionConfig.width,
180
+ maxHeight: imageCompressionConfig.height,
181
+ compressionRate: imageCompressionConfig.compressionRate
182
+ });
183
+
184
+ if (compressed) {
185
+ documentFile.uri = compressed.uri;
186
+ documentFile.size = compressed.size;
187
+ }
188
+ });
189
+ }
190
+
191
+ onSendFileMessage(documentFile).catch(() => toast.show(STRINGS.TOAST.SEND_MSG_ERROR, 'error'));
121
192
  }
122
193
  }
123
194
  }]
@@ -135,13 +206,15 @@ const SendInput = _ref => {
135
206
  size: 24,
136
207
  containerStyle: styles.iconAttach
137
208
  })), /*#__PURE__*/_react.default.createElement(_uikitReactNativeFoundation.TextInput, {
209
+ ref: ref,
138
210
  multiline: true,
211
+ disableFullscreenUI: true,
212
+ onSelectionChange: onSelectionChange,
139
213
  editable: !disabled,
140
- value: text,
141
- onChangeText: setText,
214
+ onChangeText: onChangeText,
142
215
  style: styles.input,
143
216
  placeholder: (0, _uikitUtils.conditionChaining)([frozen, muted], [STRINGS.GROUP_CHANNEL.INPUT_PLACEHOLDER_DISABLED, STRINGS.GROUP_CHANNEL.INPUT_PLACEHOLDER_MUTED, STRINGS.GROUP_CHANNEL.INPUT_PLACEHOLDER_ACTIVE])
144
- }), Boolean(text.trim()) && /*#__PURE__*/_react.default.createElement(_reactNative.TouchableOpacity, {
217
+ }, mentionManager.textToMentionedComponents(text, mentionedUsers)), Boolean(text.trim()) && /*#__PURE__*/_react.default.createElement(_reactNative.TouchableOpacity, {
145
218
  onPress: onPressSend,
146
219
  disabled: disabled
147
220
  }, /*#__PURE__*/_react.default.createElement(_uikitReactNativeFoundation.Icon, {
@@ -150,8 +223,7 @@ const SendInput = _ref => {
150
223
  size: 24,
151
224
  containerStyle: styles.iconSend
152
225
  })));
153
- };
154
-
226
+ });
155
227
  const styles = (0, _uikitReactNativeFoundation.createStyleSheet)({
156
228
  sendInputContainer: {
157
229
  paddingVertical: 10,
@@ -1 +1 @@
1
- {"version":3,"names":["SendInput","onSendUserMessage","onSendFileMessage","text","setText","disabled","frozen","muted","STRINGS","useLocalization","fileService","usePlatformService","colors","useUIKitTheme","openSheet","useBottomSheet","alert","useAlert","toast","useToast","onPressSend","catch","show","TOAST","SEND_MSG_ERROR","onPressAttachment","sheetItems","title","GROUP_CHANNEL","DIALOG_ATTACHMENT_CAMERA","icon","onPress","photo","openCamera","mediaType","onOpenFailure","error","code","SBUError","CODE","ERR_PERMISSIONS_DENIED","DIALOG","ALERT_PERMISSIONS_TITLE","message","ALERT_PERMISSIONS_MESSAGE","buttons","ALERT_PERMISSIONS_OK","SBUUtils","openSettings","OPEN_CAMERA_ERROR","DIALOG_ATTACHMENT_PHOTO_LIBRARY","openMediaLibrary","selectionLimit","OPEN_PHOTO_LIBRARY_ERROR","DIALOG_ATTACHMENT_FILES","file","openDocument","OPEN_FILES_ERROR","styles","sendInputContainer","ui","input","default","highlight","active","iconAttach","conditionChaining","INPUT_PLACEHOLDER_DISABLED","INPUT_PLACEHOLDER_MUTED","INPUT_PLACEHOLDER_ACTIVE","Boolean","trim","iconSend","createStyleSheet","paddingVertical","paddingHorizontal","alignItems","flexDirection","flex","marginRight","minHeight","maxHeight","Platform","select","ios","borderRadius","padding","marginLeft"],"sources":["SendInput.tsx"],"sourcesContent":["import React from 'react';\nimport { Platform, TouchableOpacity, View } from 'react-native';\n\nimport {\n Icon,\n TextInput,\n createStyleSheet,\n useAlert,\n useBottomSheet,\n useToast,\n useUIKitTheme,\n} from '@sendbird/uikit-react-native-foundation';\nimport { conditionChaining } from '@sendbird/uikit-utils';\n\nimport { useLocalization, usePlatformService } from '../../../../hooks/useContext';\nimport SBUError from '../../../../libs/SBUError';\nimport SBUUtils from '../../../../libs/SBUUtils';\nimport type { GroupChannelProps } from '../../types';\n\ntype SendInputProps = GroupChannelProps['Input'] & {\n text: string;\n setText: (val: string) => void;\n frozen: boolean;\n muted: boolean;\n disabled: boolean;\n};\nconst SendInput = ({\n onSendUserMessage,\n onSendFileMessage,\n text,\n setText,\n disabled,\n frozen,\n muted,\n}: SendInputProps) => {\n const { STRINGS } = useLocalization();\n const { fileService } = usePlatformService();\n const { colors } = useUIKitTheme();\n const { openSheet } = useBottomSheet();\n const { alert } = useAlert();\n const toast = useToast();\n\n const onPressSend = () => {\n onSendUserMessage(text).catch(() => toast.show(STRINGS.TOAST.SEND_MSG_ERROR, 'error'));\n setText('');\n };\n const onPressAttachment = () => {\n openSheet({\n sheetItems: [\n {\n title: STRINGS.GROUP_CHANNEL.DIALOG_ATTACHMENT_CAMERA,\n icon: 'camera',\n onPress: async () => {\n const photo = await fileService.openCamera({\n mediaType: 'all',\n onOpenFailure: (error) => {\n if (error.code === SBUError.CODE.ERR_PERMISSIONS_DENIED) {\n alert({\n title: STRINGS.DIALOG.ALERT_PERMISSIONS_TITLE,\n message: STRINGS.DIALOG.ALERT_PERMISSIONS_MESSAGE('camera', 'UIKitSample'),\n buttons: [{ text: STRINGS.DIALOG.ALERT_PERMISSIONS_OK, onPress: () => SBUUtils.openSettings() }],\n });\n } else {\n toast.show(STRINGS.TOAST.OPEN_CAMERA_ERROR, 'error');\n }\n },\n });\n\n if (photo) {\n onSendFileMessage(photo).catch(() => toast.show(STRINGS.TOAST.SEND_MSG_ERROR, 'error'));\n }\n },\n },\n {\n title: STRINGS.GROUP_CHANNEL.DIALOG_ATTACHMENT_PHOTO_LIBRARY,\n icon: 'photo',\n onPress: async () => {\n const photo = await fileService.openMediaLibrary({\n selectionLimit: 1,\n mediaType: 'all',\n onOpenFailure: (error) => {\n if (error.code === SBUError.CODE.ERR_PERMISSIONS_DENIED) {\n alert({\n title: STRINGS.DIALOG.ALERT_PERMISSIONS_TITLE,\n message: STRINGS.DIALOG.ALERT_PERMISSIONS_MESSAGE('device storage', 'UIKitSample'),\n buttons: [{ text: STRINGS.DIALOG.ALERT_PERMISSIONS_OK, onPress: () => SBUUtils.openSettings() }],\n });\n } else {\n toast.show(STRINGS.TOAST.OPEN_PHOTO_LIBRARY_ERROR, 'error');\n }\n },\n });\n\n if (photo && photo[0]) {\n onSendFileMessage(photo[0]).catch(() => toast.show(STRINGS.TOAST.SEND_MSG_ERROR, 'error'));\n }\n },\n },\n {\n title: STRINGS.GROUP_CHANNEL.DIALOG_ATTACHMENT_FILES,\n icon: 'document',\n onPress: async () => {\n const file = await fileService.openDocument({\n onOpenFailure: () => toast.show(STRINGS.TOAST.OPEN_FILES_ERROR, 'error'),\n });\n\n if (file) {\n onSendFileMessage(file).catch(() => toast.show(STRINGS.TOAST.SEND_MSG_ERROR, 'error'));\n }\n },\n },\n ],\n });\n };\n\n return (\n <View style={styles.sendInputContainer}>\n <TouchableOpacity onPress={onPressAttachment} disabled={disabled}>\n <Icon\n color={disabled ? colors.ui.input.default.disabled.highlight : colors.ui.input.default.active.highlight}\n icon={'add'}\n size={24}\n containerStyle={styles.iconAttach}\n />\n </TouchableOpacity>\n <TextInput\n multiline\n editable={!disabled}\n value={text}\n onChangeText={setText}\n style={styles.input}\n placeholder={conditionChaining(\n [frozen, muted],\n [\n STRINGS.GROUP_CHANNEL.INPUT_PLACEHOLDER_DISABLED,\n STRINGS.GROUP_CHANNEL.INPUT_PLACEHOLDER_MUTED,\n STRINGS.GROUP_CHANNEL.INPUT_PLACEHOLDER_ACTIVE,\n ],\n )}\n />\n {Boolean(text.trim()) && (\n <TouchableOpacity onPress={onPressSend} disabled={disabled}>\n <Icon\n color={disabled ? colors.ui.input.default.disabled.highlight : colors.ui.input.default.active.highlight}\n icon={'send'}\n size={24}\n containerStyle={styles.iconSend}\n />\n </TouchableOpacity>\n )}\n </View>\n );\n};\n\nconst styles = createStyleSheet({\n sendInputContainer: {\n paddingVertical: 10,\n paddingHorizontal: 12,\n alignItems: 'center',\n flexDirection: 'row',\n },\n input: {\n flex: 1,\n marginRight: 4,\n minHeight: 36,\n maxHeight: 36 * Platform.select({ ios: 2.5, default: 2 }),\n borderRadius: 20,\n },\n iconAttach: {\n marginRight: 8,\n padding: 4,\n },\n iconSend: {\n marginLeft: 4,\n padding: 4,\n },\n});\n\nexport default SendInput;\n"],"mappings":";;;;;;;AAAA;;AACA;;AAEA;;AASA;;AAEA;;AACA;;AACA;;;;AAUA,MAAMA,SAAS,GAAG,QAQI;EAAA,IARH;IACjBC,iBADiB;IAEjBC,iBAFiB;IAGjBC,IAHiB;IAIjBC,OAJiB;IAKjBC,QALiB;IAMjBC,MANiB;IAOjBC;EAPiB,CAQG;EACpB,MAAM;IAAEC;EAAF,IAAc,IAAAC,2BAAA,GAApB;EACA,MAAM;IAAEC;EAAF,IAAkB,IAAAC,8BAAA,GAAxB;EACA,MAAM;IAAEC;EAAF,IAAa,IAAAC,yCAAA,GAAnB;EACA,MAAM;IAAEC;EAAF,IAAgB,IAAAC,0CAAA,GAAtB;EACA,MAAM;IAAEC;EAAF,IAAY,IAAAC,oCAAA,GAAlB;EACA,MAAMC,KAAK,GAAG,IAAAC,oCAAA,GAAd;;EAEA,MAAMC,WAAW,GAAG,MAAM;IACxBnB,iBAAiB,CAACE,IAAD,CAAjB,CAAwBkB,KAAxB,CAA8B,MAAMH,KAAK,CAACI,IAAN,CAAWd,OAAO,CAACe,KAAR,CAAcC,cAAzB,EAAyC,OAAzC,CAApC;IACApB,OAAO,CAAC,EAAD,CAAP;EACD,CAHD;;EAIA,MAAMqB,iBAAiB,GAAG,MAAM;IAC9BX,SAAS,CAAC;MACRY,UAAU,EAAE,CACV;QACEC,KAAK,EAAEnB,OAAO,CAACoB,aAAR,CAAsBC,wBAD/B;QAEEC,IAAI,EAAE,QAFR;QAGEC,OAAO,EAAE,YAAY;UACnB,MAAMC,KAAK,GAAG,MAAMtB,WAAW,CAACuB,UAAZ,CAAuB;YACzCC,S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;AAqCD,CA9HD;;AAgIA,MAAMd,MAAM,GAAG,IAAAe,4CAAA,EAAiB;EAC9Bd,kBAAkB,EAAE;IAClBe,eAAe,EAAE,EADC;IAElBC,iBAAiB,EAAE,EAFD;IAGlBC,UAAU,EAAE,QAHM;IAIlBC,aAAa,EAAE;EAJG,CADU;EAO9BhB,KAAK,EAAE;IACLiB,IAAI,EAAE,CADD;IAELC,WAAW,EAAE,CAFR;IAGLC,SAAS,EAAE,EAHN;IAILC,SAAS,EAAE,KAAKC,qBAAA,CAASC,MAAT,CAAgB;MAAEC,GAAG,EAAE,GAAP;MAAYtB,OAAO,EAAE;IAArB,CAAhB,CAJX;IAKLuB,YAAY,EAAE;EALT,CAPuB;EAc9BpB,UAAU,EAAE;IACVc,WAAW,EAAE,CADH;IAEVO,OAAO,EAAE;EAFC,CAdkB;EAkB9Bd,QAAQ,EAAE;IACRe,UAAU,EAAE,CADJ;IAERD,OAAO,EAAE;EAFD;AAlBoB,CAAjB,CAAf;eAwBetF,S"}
1
+ {"version":3,"names":["SendInput","forwardRef","ref","onSendUserMessage","onSendFileMessage","text","onChangeText","disabled","frozen","muted","onSelectionChange","mentionedUsers","mentionManager","imageCompressionConfig","features","useSendbirdChat","STRINGS","useLocalization","fileService","mediaService","usePlatformService","colors","useUIKitTheme","openSheet","useBottomSheet","alert","useAlert","toast","useToast","onPressSend","mention","userIds","map","it","user","userId","messageTemplate","textToMentionedMessageTemplate","type","MentionType","USERS","catch","show","TOAST","SEND_MSG_ERROR","onPressAttachment","sheetItems","title","GROUP_CHANNEL","DIALOG_ATTACHMENT_CAMERA","icon","onPress","mediaFile","openCamera","mediaType","onOpenFailure","error","code","SBUError","CODE","ERR_PERMISSIONS_DENIED","DIALOG","ALERT_PERMISSIONS_TITLE","message","ALERT_PERMISSIONS_MESSAGE","LABELS","PERMISSION_CAMERA","PERMISSION_APP_NAME","buttons","ALERT_PERMISSIONS_OK","SBUUtils","openSettings","OPEN_CAMERA_ERROR","isImage","uri","shouldCompressImage","imageCompressionEnabled","safeRun","compressed","compressImage","maxWidth","width","maxHeight","height","compressionRate","size","DIALOG_ATTACHMENT_PHOTO_LIBRARY","mediaFiles","openMediaLibrary","selectionLimit","PERMISSION_DEVICE_STORAGE","OPEN_PHOTO_LIBRARY_ERROR","DIALOG_ATTACHMENT_FILES","documentFile","openDocument","OPEN_FILES_ERROR","styles","sendInputContainer","ui","input","default","highlight","active","iconAttach","conditionChaining","INPUT_PLACEHOLDER_DISABLED","INPUT_PLACEHOLDER_MUTED","INPUT_PLACEHOLDER_ACTIVE","textToMentionedComponents","Boolean","trim","iconSend","createStyleSheet","paddingVertical","paddingHorizontal","alignItems","flexDirection","flex","marginRight","minHeight","Platform","select","ios","borderRadius","padding","marginLeft"],"sources":["SendInput.tsx"],"sourcesContent":["import React, { forwardRef } from 'react';\nimport {\n NativeSyntheticEvent,\n Platform,\n TextInput as RNTextInput,\n TextInputSelectionChangeEventData,\n TouchableOpacity,\n View,\n} from 'react-native';\n\nimport { MentionType } from '@sendbird/chat/message';\nimport {\n Icon,\n TextInput,\n createStyleSheet,\n useAlert,\n useBottomSheet,\n useToast,\n useUIKitTheme,\n} from '@sendbird/uikit-react-native-foundation';\nimport { conditionChaining, isImage, shouldCompressImage } from '@sendbird/uikit-utils';\n\nimport { useLocalization, usePlatformService, useSendbirdChat } from '../../../../hooks/useContext';\nimport SBUError from '../../../../libs/SBUError';\nimport SBUUtils from '../../../../libs/SBUUtils';\nimport type { MentionedUser } from '../../../../types';\nimport type { GroupChannelProps } from '../../types';\n\ntype SendInputProps = GroupChannelProps['Input'] & {\n text: string;\n onChangeText: (val: string) => void;\n frozen: boolean;\n muted: boolean;\n disabled: boolean;\n onSelectionChange: (e: NativeSyntheticEvent<TextInputSelectionChangeEventData>) => void;\n mentionedUsers: MentionedUser[];\n};\nconst SendInput = forwardRef<RNTextInput, SendInputProps>(function SendInput(\n {\n onSendUserMessage,\n onSendFileMessage,\n text,\n onChangeText,\n disabled,\n frozen,\n muted,\n onSelectionChange,\n mentionedUsers,\n },\n ref,\n) {\n const { mentionManager, imageCompressionConfig, features } = useSendbirdChat();\n const { STRINGS } = useLocalization();\n const { fileService, mediaService } = usePlatformService();\n const { colors } = useUIKitTheme();\n const { openSheet } = useBottomSheet();\n const { alert } = useAlert();\n const toast = useToast();\n\n const onPressSend = () => {\n const mention = {\n userIds: mentionedUsers.map((it) => it.user.userId),\n messageTemplate: mentionManager.textToMentionedMessageTemplate(text, mentionedUsers),\n type: MentionType.USERS,\n };\n\n onSendUserMessage(text, mention).catch(() => toast.show(STRINGS.TOAST.SEND_MSG_ERROR, 'error'));\n onChangeText('');\n };\n\n const onPressAttachment = () => {\n openSheet({\n sheetItems: [\n {\n title: STRINGS.GROUP_CHANNEL.DIALOG_ATTACHMENT_CAMERA,\n icon: 'camera',\n onPress: async () => {\n const mediaFile = await fileService.openCamera({\n mediaType: 'all',\n onOpenFailure: (error) => {\n if (error.code === SBUError.CODE.ERR_PERMISSIONS_DENIED) {\n alert({\n title: STRINGS.DIALOG.ALERT_PERMISSIONS_TITLE,\n message: STRINGS.DIALOG.ALERT_PERMISSIONS_MESSAGE(\n STRINGS.LABELS.PERMISSION_CAMERA,\n STRINGS.LABELS.PERMISSION_APP_NAME,\n ),\n buttons: [{ text: STRINGS.DIALOG.ALERT_PERMISSIONS_OK, onPress: () => SBUUtils.openSettings() }],\n });\n } else {\n toast.show(STRINGS.TOAST.OPEN_CAMERA_ERROR, 'error');\n }\n },\n });\n\n if (mediaFile) {\n // Image compression\n if (\n isImage(mediaFile.uri, mediaFile.type) &&\n shouldCompressImage(mediaFile.uri, features.imageCompressionEnabled)\n ) {\n await SBUUtils.safeRun(async () => {\n const compressed = await mediaService.compressImage({\n uri: mediaFile.uri,\n maxWidth: imageCompressionConfig.width,\n maxHeight: imageCompressionConfig.height,\n compressionRate: imageCompressionConfig.compressionRate,\n });\n\n if (compressed) {\n mediaFile.uri = compressed.uri;\n mediaFile.size = compressed.size;\n }\n });\n }\n\n onSendFileMessage(mediaFile).catch(() => toast.show(STRINGS.TOAST.SEND_MSG_ERROR, 'error'));\n }\n },\n },\n {\n title: STRINGS.GROUP_CHANNEL.DIALOG_ATTACHMENT_PHOTO_LIBRARY,\n icon: 'photo',\n onPress: async () => {\n const mediaFiles = await fileService.openMediaLibrary({\n selectionLimit: 1,\n mediaType: 'all',\n onOpenFailure: (error) => {\n if (error.code === SBUError.CODE.ERR_PERMISSIONS_DENIED) {\n alert({\n title: STRINGS.DIALOG.ALERT_PERMISSIONS_TITLE,\n message: STRINGS.DIALOG.ALERT_PERMISSIONS_MESSAGE(\n STRINGS.LABELS.PERMISSION_DEVICE_STORAGE,\n STRINGS.LABELS.PERMISSION_APP_NAME,\n ),\n buttons: [{ text: STRINGS.DIALOG.ALERT_PERMISSIONS_OK, onPress: () => SBUUtils.openSettings() }],\n });\n } else {\n toast.show(STRINGS.TOAST.OPEN_PHOTO_LIBRARY_ERROR, 'error');\n }\n },\n });\n\n if (mediaFiles && mediaFiles[0]) {\n const mediaFile = mediaFiles[0];\n\n // Image compression\n if (\n isImage(mediaFile.uri, mediaFile.type) &&\n shouldCompressImage(mediaFile.uri, features.imageCompressionEnabled)\n ) {\n await SBUUtils.safeRun(async () => {\n const compressed = await mediaService.compressImage({\n uri: mediaFile.uri,\n maxWidth: imageCompressionConfig.width,\n maxHeight: imageCompressionConfig.height,\n compressionRate: imageCompressionConfig.compressionRate,\n });\n\n if (compressed) {\n mediaFile.uri = compressed.uri;\n mediaFile.size = compressed.size;\n }\n });\n }\n\n onSendFileMessage(mediaFiles[0]).catch(() => toast.show(STRINGS.TOAST.SEND_MSG_ERROR, 'error'));\n }\n },\n },\n {\n title: STRINGS.GROUP_CHANNEL.DIALOG_ATTACHMENT_FILES,\n icon: 'document',\n onPress: async () => {\n const documentFile = await fileService.openDocument({\n onOpenFailure: () => toast.show(STRINGS.TOAST.OPEN_FILES_ERROR, 'error'),\n });\n\n if (documentFile) {\n // Image compression\n if (\n isImage(documentFile.uri, documentFile.type) &&\n shouldCompressImage(documentFile.uri, features.imageCompressionEnabled)\n ) {\n await SBUUtils.safeRun(async () => {\n const compressed = await mediaService.compressImage({\n uri: documentFile.uri,\n maxWidth: imageCompressionConfig.width,\n maxHeight: imageCompressionConfig.height,\n compressionRate: imageCompressionConfig.compressionRate,\n });\n\n if (compressed) {\n documentFile.uri = compressed.uri;\n documentFile.size = compressed.size;\n }\n });\n }\n\n onSendFileMessage(documentFile).catch(() => toast.show(STRINGS.TOAST.SEND_MSG_ERROR, 'error'));\n }\n },\n },\n ],\n });\n };\n\n return (\n <View style={styles.sendInputContainer}>\n <TouchableOpacity onPress={onPressAttachment} disabled={disabled}>\n <Icon\n color={disabled ? colors.ui.input.default.disabled.highlight : colors.ui.input.default.active.highlight}\n icon={'add'}\n size={24}\n containerStyle={styles.iconAttach}\n />\n </TouchableOpacity>\n <TextInput\n ref={ref}\n multiline\n disableFullscreenUI\n onSelectionChange={onSelectionChange}\n editable={!disabled}\n onChangeText={onChangeText}\n style={styles.input}\n placeholder={conditionChaining(\n [frozen, muted],\n [\n STRINGS.GROUP_CHANNEL.INPUT_PLACEHOLDER_DISABLED,\n STRINGS.GROUP_CHANNEL.INPUT_PLACEHOLDER_MUTED,\n STRINGS.GROUP_CHANNEL.INPUT_PLACEHOLDER_ACTIVE,\n ],\n )}\n >\n {mentionManager.textToMentionedComponents(text, mentionedUsers)}\n </TextInput>\n\n {Boolean(text.trim()) && (\n <TouchableOpacity onPress={onPressSend} disabled={disabled}>\n <Icon\n color={disabled ? colors.ui.input.default.disabled.highlight : colors.ui.input.default.active.highlight}\n icon={'send'}\n size={24}\n containerStyle={styles.iconSend}\n />\n </TouchableOpacity>\n )}\n </View>\n );\n});\n\nconst styles = createStyleSheet({\n sendInputContainer: {\n paddingVertical: 10,\n paddingHorizontal: 12,\n alignItems: 'center',\n flexDirection: 'row',\n },\n input: {\n flex: 1,\n marginRight: 4,\n minHeight: 36,\n maxHeight: 36 * Platform.select({ ios: 2.5, default: 2 }),\n borderRadius: 20,\n },\n iconAttach: {\n marginRight: 8,\n padding: 4,\n },\n iconSend: {\n marginLeft: 4,\n padding: 4,\n },\n});\n\nexport default SendInput;\n"],"mappings":";;;;;;;AAAA;;AACA;;AASA;;AACA;;AASA;;AAEA;;AACA;;AACA;;;;;;;;AAaA,MAAMA,SAAS,gBAAG,IAAAC,iBAAA,EAAwC,SAASD,SAAT,OAYxDE,GAZwD,EAaxD;EAAA,IAZA;IACEC,iBADF;IAEEC,iBAFF;IAGEC,IAHF;IAIEC,YAJF;IAKEC,QALF;IAMEC,MANF;IAOEC,KAPF;IAQEC,iBARF;IASEC;EATF,CAYA;EACA,MAAM;IAAEC,cAAF;IAAkBC,sBAAlB;IAA0CC;EAA1C,IAAuD,IAAAC,2BAAA,GAA7D;EACA,MAAM;IAAEC;EAAF,IAAc,IAAAC,2BAAA,GAApB;EACA,MAAM;IAAEC,WAAF;IAAeC;EAAf,IAAgC,IAAAC,8BAAA,GAAtC;EACA,MAAM;IAAEC;EAAF,IAAa,IAAAC,yCAAA,GAAnB;EACA,MAAM;IAAEC;EAAF,IAAgB,IAAAC,0CAAA,GAAtB;EACA,MAAM;IAAEC;EAAF,IAAY,IAAAC,oCAAA,GAAlB;EACA,MAAMC,KAAK,GAAG,IAAAC,oCAAA,GAAd;;EAEA,MAAMC,WAAW,GAAG,MAAM;IACxB,MAAMC,OAAO,GAAG;MACdC,OAAO,EAAEpB,cAAc,CAACqB,GAAf,CAAoBC,EAAD,IAAQA,EAAE,CAACC,IAAH,CAAQC,MAAnC,CADK;MAEdC,eAAe,EAAExB,cAAc,CAACyB,8BAAf,CAA8ChC,IAA9C,EAAoDM,cAApD,CAFH;MAGd2B,IAAI,EAAEC,oBAAA,CAAYC;IAHJ,CAAhB;IAMArC,iBAAiB,CAACE,IAAD,EAAOyB,OAAP,CAAjB,CAAiCW,KAAjC,CAAuC,MAAMd,KAAK,CAACe,IAAN,CAAW1B,OAAO,CAAC2B,KAAR,CAAcC,cAAzB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