@sendbird/uikit-react-native 2.1.0 → 2.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 (388) hide show
  1. package/lib/commonjs/components/ChatFlatList.js +2 -1
  2. package/lib/commonjs/components/ChatFlatList.js.map +1 -1
  3. package/lib/commonjs/components/MessageRenderer/FileMessage/BaseFileMessage.js +11 -6
  4. package/lib/commonjs/components/MessageRenderer/FileMessage/BaseFileMessage.js.map +1 -1
  5. package/lib/commonjs/components/MessageRenderer/FileMessage/ImageFileMessage.js +12 -2
  6. package/lib/commonjs/components/MessageRenderer/FileMessage/ImageFileMessage.js.map +1 -1
  7. package/lib/commonjs/components/MessageRenderer/FileMessage/VideoFileMessage.js +25 -10
  8. package/lib/commonjs/components/MessageRenderer/FileMessage/VideoFileMessage.js.map +1 -1
  9. package/lib/commonjs/components/MessageRenderer/UserMessage/BaseUserMessage.js +86 -10
  10. package/lib/commonjs/components/MessageRenderer/UserMessage/BaseUserMessage.js.map +1 -1
  11. package/lib/commonjs/components/MessageRenderer/UserMessage/OpenGraphUserMessage.js +99 -14
  12. package/lib/commonjs/components/MessageRenderer/UserMessage/OpenGraphUserMessage.js.map +1 -1
  13. package/lib/commonjs/components/MessageRenderer/UserMessage/index.js.map +1 -1
  14. package/lib/commonjs/components/MessageRenderer/index.js +22 -3
  15. package/lib/commonjs/components/MessageRenderer/index.js.map +1 -1
  16. package/lib/commonjs/components/ReactionAddons/BottomSheetReactionAddon.js +150 -0
  17. package/lib/commonjs/components/ReactionAddons/BottomSheetReactionAddon.js.map +1 -0
  18. package/lib/commonjs/components/ReactionAddons/MessageReactionAddon.js +135 -0
  19. package/lib/commonjs/components/ReactionAddons/MessageReactionAddon.js.map +1 -0
  20. package/lib/commonjs/components/ReactionAddons/ReactionRoundedButton.js +87 -0
  21. package/lib/commonjs/components/ReactionAddons/ReactionRoundedButton.js.map +1 -0
  22. package/lib/commonjs/components/ReactionAddons/index.js +19 -0
  23. package/lib/commonjs/components/ReactionAddons/index.js.map +1 -0
  24. package/lib/commonjs/components/ReactionBottomSheets/ReactionListBottomSheet.js +150 -0
  25. package/lib/commonjs/components/ReactionBottomSheets/ReactionListBottomSheet.js.map +1 -0
  26. package/lib/commonjs/components/ReactionBottomSheets/ReactionUserListBottomSheet.js +276 -0
  27. package/lib/commonjs/components/ReactionBottomSheets/ReactionUserListBottomSheet.js.map +1 -0
  28. package/lib/commonjs/components/ReactionBottomSheets/index.js +19 -0
  29. package/lib/commonjs/components/ReactionBottomSheets/index.js.map +1 -0
  30. package/lib/commonjs/constants.js +3 -1
  31. package/lib/commonjs/constants.js.map +1 -1
  32. package/lib/commonjs/containers/GroupChannelPreviewContainer.js +4 -1
  33. package/lib/commonjs/containers/GroupChannelPreviewContainer.js.map +1 -1
  34. package/lib/commonjs/containers/SendbirdUIKitContainer.js +118 -78
  35. package/lib/commonjs/containers/SendbirdUIKitContainer.js.map +1 -1
  36. package/lib/commonjs/contexts/ReactionCtx.js +107 -0
  37. package/lib/commonjs/contexts/ReactionCtx.js.map +1 -0
  38. package/lib/commonjs/contexts/SendbirdChatCtx.js +18 -6
  39. package/lib/commonjs/contexts/SendbirdChatCtx.js.map +1 -1
  40. package/lib/commonjs/contexts/UserProfileCtx.js +9 -0
  41. package/lib/commonjs/contexts/UserProfileCtx.js.map +1 -1
  42. package/lib/commonjs/domain/groupChannel/component/GroupChannelInput/EditInput.js +33 -37
  43. package/lib/commonjs/domain/groupChannel/component/GroupChannelInput/EditInput.js.map +1 -1
  44. package/lib/commonjs/domain/groupChannel/component/GroupChannelInput/SendInput.js +28 -11
  45. package/lib/commonjs/domain/groupChannel/component/GroupChannelInput/SendInput.js.map +1 -1
  46. package/lib/commonjs/domain/groupChannel/component/GroupChannelInput/index.js +120 -31
  47. package/lib/commonjs/domain/groupChannel/component/GroupChannelInput/index.js.map +1 -1
  48. package/lib/commonjs/domain/groupChannel/component/GroupChannelMessageList.js +31 -12
  49. package/lib/commonjs/domain/groupChannel/component/GroupChannelMessageList.js.map +1 -1
  50. package/lib/commonjs/domain/groupChannel/component/GroupChannelSuggestedMentionList.js +210 -0
  51. package/lib/commonjs/domain/groupChannel/component/GroupChannelSuggestedMentionList.js.map +1 -0
  52. package/lib/commonjs/domain/groupChannel/index.js +8 -0
  53. package/lib/commonjs/domain/groupChannel/index.js.map +1 -1
  54. package/lib/commonjs/domain/groupChannel/module/createGroupChannelModule.js +4 -0
  55. package/lib/commonjs/domain/groupChannel/module/createGroupChannelModule.js.map +1 -1
  56. package/lib/commonjs/domain/groupChannel/module/moduleContext.js +4 -4
  57. package/lib/commonjs/domain/groupChannel/module/moduleContext.js.map +1 -1
  58. package/lib/commonjs/domain/groupChannel/types.js.map +1 -1
  59. package/lib/commonjs/domain/groupChannelBannedUsers/component/GroupChannelBannedUsersList.js +3 -2
  60. package/lib/commonjs/domain/groupChannelBannedUsers/component/GroupChannelBannedUsersList.js.map +1 -1
  61. package/lib/commonjs/domain/groupChannelList/component/GroupChannelListList.js +2 -1
  62. package/lib/commonjs/domain/groupChannelList/component/GroupChannelListList.js.map +1 -1
  63. package/lib/commonjs/domain/groupChannelMutedMembers/component/GroupChannelMutedMembersList.js +2 -1
  64. package/lib/commonjs/domain/groupChannelMutedMembers/component/GroupChannelMutedMembersList.js.map +1 -1
  65. package/lib/commonjs/domain/groupChannelNotifications/component/GroupChannelNotificationsHeader.js +39 -0
  66. package/lib/commonjs/domain/groupChannelNotifications/component/GroupChannelNotificationsHeader.js.map +1 -0
  67. package/lib/commonjs/domain/groupChannelNotifications/component/GroupChannelNotificationsView.js +140 -0
  68. package/lib/commonjs/domain/groupChannelNotifications/component/GroupChannelNotificationsView.js.map +1 -0
  69. package/lib/commonjs/domain/groupChannelNotifications/index.js +46 -0
  70. package/lib/commonjs/domain/groupChannelNotifications/index.js.map +1 -0
  71. package/lib/commonjs/domain/groupChannelNotifications/module/createGroupChannelNotificationsModule.js +33 -0
  72. package/lib/commonjs/domain/groupChannelNotifications/module/createGroupChannelNotificationsModule.js.map +1 -0
  73. package/lib/commonjs/domain/groupChannelNotifications/module/moduleContext.js +45 -0
  74. package/lib/commonjs/domain/groupChannelNotifications/module/moduleContext.js.map +1 -0
  75. package/lib/commonjs/domain/groupChannelNotifications/types.js +6 -0
  76. package/lib/commonjs/domain/groupChannelNotifications/types.js.map +1 -0
  77. package/lib/commonjs/domain/groupChannelOperators/component/GroupChannelOperatorsList.js +2 -1
  78. package/lib/commonjs/domain/groupChannelOperators/component/GroupChannelOperatorsList.js.map +1 -1
  79. package/lib/commonjs/domain/groupChannelSettings/component/GroupChannelSettingsMenu.js +49 -6
  80. package/lib/commonjs/domain/groupChannelSettings/component/GroupChannelSettingsMenu.js.map +1 -1
  81. package/lib/commonjs/domain/groupChannelSettings/module/moduleContext.js +9 -14
  82. package/lib/commonjs/domain/groupChannelSettings/module/moduleContext.js.map +1 -1
  83. package/lib/commonjs/domain/groupChannelSettings/types.js.map +1 -1
  84. package/lib/commonjs/domain/groupChannelUserList/types.js.map +1 -1
  85. package/lib/commonjs/domain/userList/component/UserListList.js +4 -1
  86. package/lib/commonjs/domain/userList/component/UserListList.js.map +1 -1
  87. package/lib/commonjs/domain/userList/module/createUserListModule.js.map +1 -1
  88. package/lib/commonjs/fragments/createGroupChannelCreateFragment.js.map +1 -1
  89. package/lib/commonjs/fragments/createGroupChannelFragment.js +11 -4
  90. package/lib/commonjs/fragments/createGroupChannelFragment.js.map +1 -1
  91. package/lib/commonjs/fragments/createGroupChannelInviteFragment.js.map +1 -1
  92. package/lib/commonjs/fragments/createGroupChannelNotificationsFragment.js +34 -0
  93. package/lib/commonjs/fragments/createGroupChannelNotificationsFragment.js.map +1 -0
  94. package/lib/commonjs/fragments/createGroupChannelSettingsFragment.js +3 -1
  95. package/lib/commonjs/fragments/createGroupChannelSettingsFragment.js.map +1 -1
  96. package/lib/commonjs/hooks/useConnection.js +3 -0
  97. package/lib/commonjs/hooks/useConnection.js.map +1 -1
  98. package/lib/commonjs/hooks/useContext.js +11 -1
  99. package/lib/commonjs/hooks/useContext.js.map +1 -1
  100. package/lib/commonjs/hooks/useKeyboardStatus.js +93 -0
  101. package/lib/commonjs/hooks/useKeyboardStatus.js.map +1 -0
  102. package/lib/commonjs/hooks/useMentionSuggestion.js +110 -0
  103. package/lib/commonjs/hooks/useMentionSuggestion.js.map +1 -0
  104. package/lib/commonjs/hooks/useMentionTextInput.js +139 -0
  105. package/lib/commonjs/hooks/useMentionTextInput.js.map +1 -0
  106. package/lib/commonjs/index.js +95 -40
  107. package/lib/commonjs/index.js.map +1 -1
  108. package/lib/commonjs/libs/EmojiManager.js +100 -0
  109. package/lib/commonjs/libs/EmojiManager.js.map +1 -0
  110. package/lib/commonjs/libs/MentionConfig.js +47 -0
  111. package/lib/commonjs/libs/MentionConfig.js.map +1 -0
  112. package/lib/commonjs/libs/MentionManager.js +235 -0
  113. package/lib/commonjs/libs/MentionManager.js.map +1 -0
  114. package/lib/commonjs/localization/StringSet.type.js +17 -5
  115. package/lib/commonjs/localization/StringSet.type.js.map +1 -1
  116. package/lib/commonjs/types.js.map +1 -1
  117. package/lib/commonjs/utils/common.js +19 -0
  118. package/lib/commonjs/utils/common.js.map +1 -0
  119. package/lib/commonjs/version.js +1 -1
  120. package/lib/commonjs/version.js.map +1 -1
  121. package/lib/module/components/ChatFlatList.js +3 -2
  122. package/lib/module/components/ChatFlatList.js.map +1 -1
  123. package/lib/module/components/MessageRenderer/FileMessage/BaseFileMessage.js +11 -6
  124. package/lib/module/components/MessageRenderer/FileMessage/BaseFileMessage.js.map +1 -1
  125. package/lib/module/components/MessageRenderer/FileMessage/ImageFileMessage.js +12 -2
  126. package/lib/module/components/MessageRenderer/FileMessage/ImageFileMessage.js.map +1 -1
  127. package/lib/module/components/MessageRenderer/FileMessage/VideoFileMessage.js +25 -10
  128. package/lib/module/components/MessageRenderer/FileMessage/VideoFileMessage.js.map +1 -1
  129. package/lib/module/components/MessageRenderer/UserMessage/BaseUserMessage.js +86 -12
  130. package/lib/module/components/MessageRenderer/UserMessage/BaseUserMessage.js.map +1 -1
  131. package/lib/module/components/MessageRenderer/UserMessage/OpenGraphUserMessage.js +101 -17
  132. package/lib/module/components/MessageRenderer/UserMessage/OpenGraphUserMessage.js.map +1 -1
  133. package/lib/module/components/MessageRenderer/UserMessage/index.js.map +1 -1
  134. package/lib/module/components/MessageRenderer/index.js +21 -4
  135. package/lib/module/components/MessageRenderer/index.js.map +1 -1
  136. package/lib/module/components/ReactionAddons/BottomSheetReactionAddon.js +132 -0
  137. package/lib/module/components/ReactionAddons/BottomSheetReactionAddon.js.map +1 -0
  138. package/lib/module/components/ReactionAddons/MessageReactionAddon.js +118 -0
  139. package/lib/module/components/ReactionAddons/MessageReactionAddon.js.map +1 -0
  140. package/lib/module/components/ReactionAddons/ReactionRoundedButton.js +74 -0
  141. package/lib/module/components/ReactionAddons/ReactionRoundedButton.js.map +1 -0
  142. package/lib/module/components/ReactionAddons/index.js +7 -0
  143. package/lib/module/components/ReactionAddons/index.js.map +1 -0
  144. package/lib/module/components/ReactionBottomSheets/ReactionListBottomSheet.js +135 -0
  145. package/lib/module/components/ReactionBottomSheets/ReactionListBottomSheet.js.map +1 -0
  146. package/lib/module/components/ReactionBottomSheets/ReactionUserListBottomSheet.js +259 -0
  147. package/lib/module/components/ReactionBottomSheets/ReactionUserListBottomSheet.js.map +1 -0
  148. package/lib/module/components/ReactionBottomSheets/index.js +7 -0
  149. package/lib/module/components/ReactionBottomSheets/index.js.map +1 -0
  150. package/lib/module/constants.js +1 -0
  151. package/lib/module/constants.js.map +1 -1
  152. package/lib/module/containers/GroupChannelPreviewContainer.js +4 -1
  153. package/lib/module/containers/GroupChannelPreviewContainer.js.map +1 -1
  154. package/lib/module/containers/SendbirdUIKitContainer.js +116 -80
  155. package/lib/module/containers/SendbirdUIKitContainer.js.map +1 -1
  156. package/lib/module/contexts/ReactionCtx.js +85 -0
  157. package/lib/module/contexts/ReactionCtx.js.map +1 -0
  158. package/lib/module/contexts/SendbirdChatCtx.js +18 -6
  159. package/lib/module/contexts/SendbirdChatCtx.js.map +1 -1
  160. package/lib/module/contexts/UserProfileCtx.js +7 -0
  161. package/lib/module/contexts/UserProfileCtx.js.map +1 -1
  162. package/lib/module/domain/groupChannel/component/GroupChannelInput/EditInput.js +34 -39
  163. package/lib/module/domain/groupChannel/component/GroupChannelInput/EditInput.js.map +1 -1
  164. package/lib/module/domain/groupChannel/component/GroupChannelInput/SendInput.js +24 -13
  165. package/lib/module/domain/groupChannel/component/GroupChannelInput/SendInput.js.map +1 -1
  166. package/lib/module/domain/groupChannel/component/GroupChannelInput/index.js +117 -33
  167. package/lib/module/domain/groupChannel/component/GroupChannelInput/index.js.map +1 -1
  168. package/lib/module/domain/groupChannel/component/GroupChannelMessageList.js +32 -14
  169. package/lib/module/domain/groupChannel/component/GroupChannelMessageList.js.map +1 -1
  170. package/lib/module/domain/groupChannel/component/GroupChannelSuggestedMentionList.js +188 -0
  171. package/lib/module/domain/groupChannel/component/GroupChannelSuggestedMentionList.js.map +1 -0
  172. package/lib/module/domain/groupChannel/index.js +1 -0
  173. package/lib/module/domain/groupChannel/index.js.map +1 -1
  174. package/lib/module/domain/groupChannel/module/createGroupChannelModule.js +3 -0
  175. package/lib/module/domain/groupChannel/module/createGroupChannelModule.js.map +1 -1
  176. package/lib/module/domain/groupChannel/module/moduleContext.js +4 -4
  177. package/lib/module/domain/groupChannel/module/moduleContext.js.map +1 -1
  178. package/lib/module/domain/groupChannel/types.js.map +1 -1
  179. package/lib/module/domain/groupChannelBannedUsers/component/GroupChannelBannedUsersList.js +4 -3
  180. package/lib/module/domain/groupChannelBannedUsers/component/GroupChannelBannedUsersList.js.map +1 -1
  181. package/lib/module/domain/groupChannelList/component/GroupChannelListList.js +3 -2
  182. package/lib/module/domain/groupChannelList/component/GroupChannelListList.js.map +1 -1
  183. package/lib/module/domain/groupChannelMutedMembers/component/GroupChannelMutedMembersList.js +3 -2
  184. package/lib/module/domain/groupChannelMutedMembers/component/GroupChannelMutedMembersList.js.map +1 -1
  185. package/lib/module/domain/groupChannelNotifications/component/GroupChannelNotificationsHeader.js +25 -0
  186. package/lib/module/domain/groupChannelNotifications/component/GroupChannelNotificationsHeader.js.map +1 -0
  187. package/lib/module/domain/groupChannelNotifications/component/GroupChannelNotificationsView.js +122 -0
  188. package/lib/module/domain/groupChannelNotifications/component/GroupChannelNotificationsView.js.map +1 -0
  189. package/lib/module/domain/groupChannelNotifications/index.js +5 -0
  190. package/lib/module/domain/groupChannelNotifications/index.js.map +1 -0
  191. package/lib/module/domain/groupChannelNotifications/module/createGroupChannelNotificationsModule.js +21 -0
  192. package/lib/module/domain/groupChannelNotifications/module/createGroupChannelNotificationsModule.js.map +1 -0
  193. package/lib/module/domain/groupChannelNotifications/module/moduleContext.js +25 -0
  194. package/lib/module/domain/groupChannelNotifications/module/moduleContext.js.map +1 -0
  195. package/lib/module/domain/groupChannelNotifications/types.js +2 -0
  196. package/lib/module/domain/groupChannelNotifications/types.js.map +1 -0
  197. package/lib/module/domain/groupChannelOperators/component/GroupChannelOperatorsList.js +3 -2
  198. package/lib/module/domain/groupChannelOperators/component/GroupChannelOperatorsList.js.map +1 -1
  199. package/lib/module/domain/groupChannelSettings/component/GroupChannelSettingsMenu.js +46 -6
  200. package/lib/module/domain/groupChannelSettings/component/GroupChannelSettingsMenu.js.map +1 -1
  201. package/lib/module/domain/groupChannelSettings/module/moduleContext.js +10 -15
  202. package/lib/module/domain/groupChannelSettings/module/moduleContext.js.map +1 -1
  203. package/lib/module/domain/groupChannelSettings/types.js.map +1 -1
  204. package/lib/module/domain/groupChannelUserList/types.js.map +1 -1
  205. package/lib/module/domain/userList/component/UserListList.js +3 -1
  206. package/lib/module/domain/userList/component/UserListList.js.map +1 -1
  207. package/lib/module/domain/userList/module/createUserListModule.js.map +1 -1
  208. package/lib/module/fragments/createGroupChannelCreateFragment.js.map +1 -1
  209. package/lib/module/fragments/createGroupChannelFragment.js +11 -4
  210. package/lib/module/fragments/createGroupChannelFragment.js.map +1 -1
  211. package/lib/module/fragments/createGroupChannelInviteFragment.js.map +1 -1
  212. package/lib/module/fragments/createGroupChannelNotificationsFragment.js +22 -0
  213. package/lib/module/fragments/createGroupChannelNotificationsFragment.js.map +1 -0
  214. package/lib/module/fragments/createGroupChannelSettingsFragment.js +3 -1
  215. package/lib/module/fragments/createGroupChannelSettingsFragment.js.map +1 -1
  216. package/lib/module/hooks/useConnection.js +3 -0
  217. package/lib/module/hooks/useConnection.js.map +1 -1
  218. package/lib/module/hooks/useContext.js +6 -0
  219. package/lib/module/hooks/useContext.js.map +1 -1
  220. package/lib/module/hooks/useKeyboardStatus.js +75 -0
  221. package/lib/module/hooks/useKeyboardStatus.js.map +1 -0
  222. package/lib/module/hooks/useMentionSuggestion.js +100 -0
  223. package/lib/module/hooks/useMentionSuggestion.js.map +1 -0
  224. package/lib/module/hooks/useMentionTextInput.js +128 -0
  225. package/lib/module/hooks/useMentionTextInput.js.map +1 -0
  226. package/lib/module/index.js +8 -3
  227. package/lib/module/index.js.map +1 -1
  228. package/lib/module/libs/EmojiManager.js +90 -0
  229. package/lib/module/libs/EmojiManager.js.map +1 -0
  230. package/lib/module/libs/MentionConfig.js +39 -0
  231. package/lib/module/libs/MentionConfig.js.map +1 -0
  232. package/lib/module/libs/MentionManager.js +223 -0
  233. package/lib/module/libs/MentionManager.js.map +1 -0
  234. package/lib/module/localization/StringSet.type.js +18 -6
  235. package/lib/module/localization/StringSet.type.js.map +1 -1
  236. package/lib/module/types.js.map +1 -1
  237. package/lib/module/utils/common.js +7 -0
  238. package/lib/module/utils/common.js.map +1 -0
  239. package/lib/module/version.js +1 -1
  240. package/lib/module/version.js.map +1 -1
  241. package/lib/typescript/__template__/types.d.ts +3 -3
  242. package/lib/typescript/src/components/ChannelCover.d.ts +1 -1
  243. package/lib/typescript/src/components/ChatFlatList.d.ts +1 -1
  244. package/lib/typescript/src/components/FileViewer.d.ts +1 -1
  245. package/lib/typescript/src/components/MessageRenderer/AdminMessage/index.d.ts +1 -1
  246. package/lib/typescript/src/components/MessageRenderer/FileMessage/BaseFileMessage.d.ts +2 -2
  247. package/lib/typescript/src/components/MessageRenderer/FileMessage/ImageFileMessage.d.ts +1 -1
  248. package/lib/typescript/src/components/MessageRenderer/FileMessage/VideoFileMessage.d.ts +1 -1
  249. package/lib/typescript/src/components/MessageRenderer/FileMessage/index.d.ts +11 -2
  250. package/lib/typescript/src/components/MessageRenderer/MessageDateSeparator.d.ts +1 -1
  251. package/lib/typescript/src/components/MessageRenderer/MessageIncomingAvatar.d.ts +1 -1
  252. package/lib/typescript/src/components/MessageRenderer/MessageIncomingSenderName.d.ts +1 -1
  253. package/lib/typescript/src/components/MessageRenderer/MessageOutgoingStatus.d.ts +1 -1
  254. package/lib/typescript/src/components/MessageRenderer/MessageTime.d.ts +1 -1
  255. package/lib/typescript/src/components/MessageRenderer/UnknownMessage/index.d.ts +1 -1
  256. package/lib/typescript/src/components/MessageRenderer/UserMessage/BaseUserMessage.d.ts +1 -1
  257. package/lib/typescript/src/components/MessageRenderer/UserMessage/OpenGraphUserMessage.d.ts +2 -2
  258. package/lib/typescript/src/components/MessageRenderer/UserMessage/index.d.ts +4 -1
  259. package/lib/typescript/src/components/MessageRenderer/index.d.ts +4 -3
  260. package/lib/typescript/src/components/NewMessagesButton.d.ts +1 -1
  261. package/lib/typescript/src/components/ReactionAddons/BottomSheetReactionAddon.d.ts +8 -0
  262. package/lib/typescript/src/components/ReactionAddons/MessageReactionAddon.d.ts +6 -0
  263. package/lib/typescript/src/components/ReactionAddons/ReactionRoundedButton.d.ts +14 -0
  264. package/lib/typescript/src/components/ReactionAddons/index.d.ts +11 -0
  265. package/lib/typescript/src/components/ReactionBottomSheets/ReactionListBottomSheet.d.ts +3 -0
  266. package/lib/typescript/src/components/ReactionBottomSheets/ReactionUserListBottomSheet.d.ts +3 -0
  267. package/lib/typescript/src/components/ReactionBottomSheets/index.d.ts +20 -0
  268. package/lib/typescript/src/components/ScrollToBottomButton.d.ts +1 -1
  269. package/lib/typescript/src/components/StatusComposition.d.ts +1 -1
  270. package/lib/typescript/src/components/TypedPlaceholder.d.ts +1 -1
  271. package/lib/typescript/src/components/UserActionBar.d.ts +1 -1
  272. package/lib/typescript/src/components/UserSelectableBar.d.ts +1 -1
  273. package/lib/typescript/src/constants.d.ts +1 -0
  274. package/lib/typescript/src/containers/GroupChannelPreviewContainer.d.ts +1 -1
  275. package/lib/typescript/src/containers/SendbirdUIKitContainer.d.ts +12 -3
  276. package/lib/typescript/src/contexts/LocalizationCtx.d.ts +2 -2
  277. package/lib/typescript/src/contexts/PlatformServiceCtx.d.ts +1 -1
  278. package/lib/typescript/src/contexts/ReactionCtx.d.ts +18 -0
  279. package/lib/typescript/src/contexts/SendbirdChatCtx.d.ts +10 -2
  280. package/lib/typescript/src/contexts/UserProfileCtx.d.ts +4 -4
  281. package/lib/typescript/src/domain/groupChannel/component/GroupChannelInput/EditInput.d.ts +35 -7
  282. package/lib/typescript/src/domain/groupChannel/component/GroupChannelInput/SendInput.d.ts +32 -5
  283. package/lib/typescript/src/domain/groupChannel/component/GroupChannelInput/index.d.ts +19 -2
  284. package/lib/typescript/src/domain/groupChannel/component/GroupChannelSuggestedMentionList.d.ts +3 -0
  285. package/lib/typescript/src/domain/groupChannel/index.d.ts +1 -0
  286. package/lib/typescript/src/domain/groupChannel/module/createGroupChannelModule.d.ts +1 -1
  287. package/lib/typescript/src/domain/groupChannel/types.d.ts +24 -7
  288. package/lib/typescript/src/domain/groupChannelBannedUsers/types.d.ts +3 -3
  289. package/lib/typescript/src/domain/groupChannelList/types.d.ts +2 -2
  290. package/lib/typescript/src/domain/groupChannelModeration/types.d.ts +3 -3
  291. package/lib/typescript/src/domain/groupChannelMutedMembers/types.d.ts +3 -3
  292. package/lib/typescript/src/domain/groupChannelNotifications/component/GroupChannelNotificationsHeader.d.ts +3 -0
  293. package/lib/typescript/src/domain/groupChannelNotifications/component/GroupChannelNotificationsView.d.ts +2 -0
  294. package/lib/typescript/src/domain/groupChannelNotifications/index.d.ts +4 -0
  295. package/lib/typescript/src/domain/groupChannelNotifications/module/createGroupChannelNotificationsModule.d.ts +3 -0
  296. package/lib/typescript/src/domain/groupChannelNotifications/module/moduleContext.d.ts +3 -0
  297. package/lib/typescript/src/domain/groupChannelNotifications/types.d.ts +33 -0
  298. package/lib/typescript/src/domain/groupChannelOperators/types.d.ts +3 -3
  299. package/lib/typescript/src/domain/groupChannelSettings/component/GroupChannelSettingsMenu.d.ts +1 -1
  300. package/lib/typescript/src/domain/groupChannelSettings/types.d.ts +3 -1
  301. package/lib/typescript/src/domain/groupChannelUserList/types.d.ts +6 -6
  302. package/lib/typescript/src/domain/userList/component/UserListList.d.ts +2 -1
  303. package/lib/typescript/src/domain/userList/module/createUserListModule.d.ts +2 -1
  304. package/lib/typescript/src/fragments/createGroupChannelCreateFragment.d.ts +1 -1
  305. package/lib/typescript/src/fragments/createGroupChannelInviteFragment.d.ts +1 -1
  306. package/lib/typescript/src/fragments/createGroupChannelNotificationsFragment.d.ts +3 -0
  307. package/lib/typescript/src/hooks/useConnection.d.ts +1 -1
  308. package/lib/typescript/src/hooks/useContext.d.ts +4 -0
  309. package/lib/typescript/src/hooks/useKeyboardStatus.d.ts +6 -0
  310. package/lib/typescript/src/hooks/useMentionSuggestion.d.ts +17 -0
  311. package/lib/typescript/src/hooks/useMentionTextInput.d.ts +18 -0
  312. package/lib/typescript/src/index.d.ts +7 -2
  313. package/lib/typescript/src/libs/EmojiManager.d.ts +16 -0
  314. package/lib/typescript/src/libs/MentionConfig.d.ts +24 -0
  315. package/lib/typescript/src/libs/MentionManager.d.ts +61 -0
  316. package/lib/typescript/src/localization/StringSet.type.d.ts +16 -2
  317. package/lib/typescript/src/platform/createMediaService.expo.d.ts +1 -1
  318. package/lib/typescript/src/platform/createMediaService.native.d.ts +1 -1
  319. package/lib/typescript/src/platform/dynamicModule.d.ts +1 -1
  320. package/lib/typescript/src/platform/types.d.ts +5 -5
  321. package/lib/typescript/src/types.d.ts +13 -4
  322. package/lib/typescript/src/utils/common.d.ts +1 -0
  323. package/lib/typescript/src/version.d.ts +1 -1
  324. package/package.json +6 -6
  325. package/src/components/ChatFlatList.tsx +2 -1
  326. package/src/components/MessageRenderer/FileMessage/BaseFileMessage.tsx +17 -12
  327. package/src/components/MessageRenderer/FileMessage/ImageFileMessage.tsx +25 -18
  328. package/src/components/MessageRenderer/FileMessage/VideoFileMessage.tsx +20 -10
  329. package/src/components/MessageRenderer/UserMessage/BaseUserMessage.tsx +82 -14
  330. package/src/components/MessageRenderer/UserMessage/OpenGraphUserMessage.tsx +135 -61
  331. package/src/components/MessageRenderer/UserMessage/index.tsx +8 -1
  332. package/src/components/MessageRenderer/index.tsx +39 -7
  333. package/src/components/ReactionAddons/BottomSheetReactionAddon.tsx +106 -0
  334. package/src/components/ReactionAddons/MessageReactionAddon.tsx +123 -0
  335. package/src/components/ReactionAddons/ReactionRoundedButton.tsx +71 -0
  336. package/src/components/ReactionAddons/index.tsx +7 -0
  337. package/src/components/ReactionBottomSheets/ReactionListBottomSheet.tsx +113 -0
  338. package/src/components/ReactionBottomSheets/ReactionUserListBottomSheet.tsx +249 -0
  339. package/src/components/ReactionBottomSheets/index.tsx +24 -0
  340. package/src/constants.ts +2 -0
  341. package/src/containers/GroupChannelPreviewContainer.tsx +3 -1
  342. package/src/containers/SendbirdUIKitContainer.tsx +141 -83
  343. package/src/contexts/ReactionCtx.tsx +102 -0
  344. package/src/contexts/SendbirdChatCtx.tsx +24 -2
  345. package/src/contexts/UserProfileCtx.tsx +9 -0
  346. package/src/domain/groupChannel/component/GroupChannelInput/EditInput.tsx +56 -30
  347. package/src/domain/groupChannel/component/GroupChannelInput/SendInput.tsx +48 -19
  348. package/src/domain/groupChannel/component/GroupChannelInput/index.tsx +137 -43
  349. package/src/domain/groupChannel/component/GroupChannelMessageList.tsx +27 -10
  350. package/src/domain/groupChannel/component/GroupChannelSuggestedMentionList.tsx +173 -0
  351. package/src/domain/groupChannel/index.ts +1 -0
  352. package/src/domain/groupChannel/module/createGroupChannelModule.tsx +12 -1
  353. package/src/domain/groupChannel/module/moduleContext.tsx +4 -4
  354. package/src/domain/groupChannel/types.ts +28 -5
  355. package/src/domain/groupChannelBannedUsers/component/GroupChannelBannedUsersList.tsx +3 -2
  356. package/src/domain/groupChannelList/component/GroupChannelListList.tsx +2 -1
  357. package/src/domain/groupChannelMutedMembers/component/GroupChannelMutedMembersList.tsx +2 -1
  358. package/src/domain/groupChannelNotifications/component/GroupChannelNotificationsHeader.tsx +14 -0
  359. package/src/domain/groupChannelNotifications/component/GroupChannelNotificationsView.tsx +128 -0
  360. package/src/domain/groupChannelNotifications/index.ts +4 -0
  361. package/src/domain/groupChannelNotifications/module/createGroupChannelNotificationsModule.tsx +15 -0
  362. package/src/domain/groupChannelNotifications/module/moduleContext.tsx +31 -0
  363. package/src/domain/groupChannelNotifications/types.ts +38 -0
  364. package/src/domain/groupChannelOperators/component/GroupChannelOperatorsList.tsx +2 -1
  365. package/src/domain/groupChannelSettings/component/GroupChannelSettingsMenu.tsx +42 -3
  366. package/src/domain/groupChannelSettings/module/moduleContext.tsx +9 -12
  367. package/src/domain/groupChannelSettings/types.ts +2 -0
  368. package/src/domain/groupChannelUserList/types.ts +7 -2
  369. package/src/domain/userList/component/UserListList.tsx +5 -1
  370. package/src/domain/userList/module/createUserListModule.tsx +3 -1
  371. package/src/fragments/createGroupChannelCreateFragment.tsx +8 -2
  372. package/src/fragments/createGroupChannelFragment.tsx +19 -6
  373. package/src/fragments/createGroupChannelInviteFragment.tsx +2 -2
  374. package/src/fragments/createGroupChannelNotificationsFragment.tsx +27 -0
  375. package/src/fragments/createGroupChannelSettingsFragment.tsx +2 -0
  376. package/src/hooks/useConnection.ts +3 -1
  377. package/src/hooks/useContext.ts +7 -0
  378. package/src/hooks/useKeyboardStatus.ts +54 -0
  379. package/src/hooks/useMentionSuggestion.ts +106 -0
  380. package/src/hooks/useMentionTextInput.ts +139 -0
  381. package/src/index.ts +13 -2
  382. package/src/libs/EmojiManager.ts +80 -0
  383. package/src/libs/MentionConfig.ts +40 -0
  384. package/src/libs/MentionManager.tsx +240 -0
  385. package/src/localization/StringSet.type.ts +38 -8
  386. package/src/types.ts +12 -0
  387. package/src/utils/common.ts +8 -0
  388. package/src/version.ts +1 -1
@@ -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,eAAA,GAAxB;EACA,MAAM,CAACC,OAAD,EAAUC,UAAV,IAAwB,IAAAF,eAAA,EAAS,KAAT,CAA9B;EAEA,MAAMG,IAAoC,GAAG,IAAAC,kBAAA,EAAaN,IAAD,IAAU;IACjEC,O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,mBAAmB,CAACmC,OAApB,CAA4BC,YAA5B,CAAyCC,cAD5C,CADF;EAKD,CAlCyB,CAA1B;EAoCA,oBACE,6BAAC,kBAAD,CAAoB,QAApB;IAA6B,KAAK,EAAE;MAAEzB,IAAF;MAAQE;IAAR;EAApC,GACGrB,QADH,eAEE,6BAAC,iCAAD;IACE,IAAI,EAAE,OADR;IAEE,OAAO,EAAEqB,IAFX;IAGE,SAAS,EAAE,MAAMN,OAAO,CAACY,SAAD,CAH1B;IAIE,OAAO,EAAEV,OAAO,IAAI4B,OAAO,CAAC/B,IAAD,CAJ7B;IAKE,eAAe,EAAEgC,MAAM,CAACC;EAL1B,GAOGjC,IAAI,iBACH,6BAAC,uCAAD;IACE,cAAc,EAAE,CACdgC,MAAM,CAACE,oBADO,EAEd;MAAEC,WAAW,EAAEtC,IAAf;MAAqBuC,YAAY,EAAEtC,KAAnC;MAA0CuC,aAAa,EAAEzC;IAAzD,CAFc,CADlB;IAKE,GAAG,EAAEI,IAAI,CAACsC,UALZ;IAME,QAAQ,EAAEtC,IAAI,CAACuC,QAAL,IAAiB9C,mBAAmB,CAACmC,OAApB,CAA4BY,MAA5B,CAAmCC,YANhE;IAOE,SAAS,EAAEhD,mBAAmB,CAACmC,OAApB,CAA4BC,YAA5B,CAAyCa,UAPtD;IAQE,IAAI,EAAEjD,mBAAmB,CAACmC,OAApB,CAA4BC,YAA5B,CAAyCc,IAAzC,CAA8C3C,IAA9C,CARR;IASE,MAAM,EAAEQ;EATV,EARJ,CAFF,CADF;AA0BD,CAnFM;;;AAqFP,MAAMwB,MAAM,GAAG,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"}
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;IAAgBC;EAAhB,IAA0B,IAAAC,6CAAA,GAAhC;EAEA,MAAM,CAACC,IAAD,EAAOC,OAAP,IAAkB,IAAAC,eAAA,GAAxB;EACA,MAAM,CAACC,OAAD,EAAUC,UAAV,IAAwB,IAAAF,eA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,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.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;;AAEA;;AAGA;;;;;;A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iB9BE,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":";;;;;;;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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,16 +23,25 @@ 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
+ } = (0, _useContext.useSendbirdChat)();
34
45
  const {
35
46
  STRINGS
36
47
  } = (0, _useContext.useLocalization)();
@@ -49,8 +60,13 @@ const SendInput = _ref => {
49
60
  const toast = (0, _uikitReactNativeFoundation.useToast)();
50
61
 
51
62
  const onPressSend = () => {
52
- onSendUserMessage(text).catch(() => toast.show(STRINGS.TOAST.SEND_MSG_ERROR, 'error'));
53
- setText('');
63
+ const mention = {
64
+ userIds: mentionedUsers.map(it => it.user.userId),
65
+ messageTemplate: mentionManager.textToMentionedMessageTemplate(text, mentionedUsers),
66
+ type: _message.MentionType.USERS
67
+ };
68
+ onSendUserMessage(text, mention).catch(() => toast.show(STRINGS.TOAST.SEND_MSG_ERROR, 'error'));
69
+ onChangeText('');
54
70
  };
55
71
 
56
72
  const onPressAttachment = () => {
@@ -135,13 +151,15 @@ const SendInput = _ref => {
135
151
  size: 24,
136
152
  containerStyle: styles.iconAttach
137
153
  })), /*#__PURE__*/_react.default.createElement(_uikitReactNativeFoundation.TextInput, {
154
+ ref: ref,
138
155
  multiline: true,
156
+ disableFullscreenUI: true,
157
+ onSelectionChange: onSelectionChange,
139
158
  editable: !disabled,
140
- value: text,
141
- onChangeText: setText,
159
+ onChangeText: onChangeText,
142
160
  style: styles.input,
143
161
  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, {
162
+ }, mentionManager.textToMentionedComponents(text, mentionedUsers)), Boolean(text.trim()) && /*#__PURE__*/_react.default.createElement(_reactNative.TouchableOpacity, {
145
163
  onPress: onPressSend,
146
164
  disabled: disabled
147
165
  }, /*#__PURE__*/_react.default.createElement(_uikitReactNativeFoundation.Icon, {
@@ -150,8 +168,7 @@ const SendInput = _ref => {
150
168
  size: 24,
151
169
  containerStyle: styles.iconSend
152
170
  })));
153
- };
154
-
171
+ });
155
172
  const styles = (0, _uikitReactNativeFoundation.createStyleSheet)({
156
173
  sendInputContainer: {
157
174
  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,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P,CAAUC,KAAV,CAAgBC,OAAhB,CAAwBE,MAAxB,CAA+BD,SADhG;IAEE,IAAI,EAAE,MAFR;IAGE,IAAI,EAAE,EAHR;IAIE,cAAc,EAAEL,MAAM,CAACc;EAJzB,EADF,CAzBJ,CADF;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","useSendbirdChat","STRINGS","useLocalization","fileService","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","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","textToMentionedComponents","Boolean","trim","iconSend","createStyleSheet","paddingVertical","paddingHorizontal","alignItems","flexDirection","flex","marginRight","minHeight","maxHeight","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 } 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 } = useSendbirdChat();\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 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 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 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;EAAF,IAAqB,IAAAC,2BAAA,GAA3B;EACA,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;IACxB,MAAMC,OAAO,GAAG;MACdC,OAAO,EAAEjB,cAAc,CAACkB,GAAf,CAAoBC,EAAD,IAAQA,EAAE,CAACC,IAAH,CAAQC,MAAnC,CADK;MAEdC,eAAe,EAAErB,cAAc,CAACsB,8BAAf,CAA8C7B,IAA9C,EAAoDM,cAApD,CAFH;MAGdwB,IAAI,EAAEC,oBAAA,CAAYC;IAHJ,CAAhB;IAMAlC,iBAAiB,CAACE,IAAD,EAAOsB,OAAP,CAAjB,CAAiCW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NativeFoundation = require("@sendbird/uikit-react-native-foundati
15
15
 
16
16
  var _uikitUtils = require("@sendbird/uikit-utils");
17
17
 
18
+ var _useContext = require("../../../../hooks/useContext");
19
+
20
+ var _useMentionTextInput = _interopRequireDefault(require("../../../../hooks/useMentionTextInput"));
21
+
18
22
  var _moduleContext = require("../../module/moduleContext");
19
23
 
20
24
  var _EditInput = _interopRequireDefault(require("./EditInput"));
@@ -29,13 +33,25 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
29
33
 
30
34
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
31
35
 
36
+ const AUTO_FOCUS = _reactNative.Platform.select({
37
+ ios: false,
38
+ android: true,
39
+ default: false
40
+ });
41
+
32
42
  const KEYBOARD_AVOID_VIEW_BEHAVIOR = _reactNative.Platform.select({
33
43
  ios: 'padding',
34
44
  default: undefined
35
- });
45
+ }); // FIXME(iOS): Dynamic style does not work properly when typing the CJK. (https://github.com/facebook/react-native/issues/26107)
46
+ // To workaround temporarily, change the key for re-mount the component.
47
+
48
+
49
+ const GET_INPUT_KEY = shouldReset => shouldReset ? 'uikit-input-clear' : 'uikit-input'; // TODO: Refactor 'Edit' mode to clearly
50
+
36
51
 
37
52
  const GroupChannelInput = props => {
38
53
  const {
54
+ top,
39
55
  left,
40
56
  right,
41
57
  bottom
@@ -43,31 +59,49 @@ const GroupChannelInput = props => {
43
59
  const {
44
60
  colors
45
61
  } = (0, _uikitReactNativeFoundation.useUIKitTheme)();
62
+ const {
63
+ features,
64
+ mentionManager
65
+ } = (0, _useContext.useSendbirdChat)();
46
66
  const {
47
67
  channel,
48
- editMessage,
49
- setEditMessage,
68
+ messageToEdit,
69
+ setMessageToEdit,
50
70
  keyboardAvoidOffset = 0
51
71
  } = (0, _react.useContext)(_moduleContext.GroupChannelContexts.Fragment);
52
- const [text, setText] = (0, _react.useState)('');
53
- const textTmpRef = (0, _react.useRef)('');
54
72
  const chatAvailableState = (0, _uikitUtils.getGroupChannelChatAvailableState)(channel);
55
- (0, _react.useEffect)(() => {
56
- if (text.length === 0) channel.endTyping();else channel.startTyping();
57
- }, [text]);
58
- (0, _react.useEffect)(() => {
59
- if (chatAvailableState.disabled) {
60
- textTmpRef.current = text;
61
- setText('');
62
- } else {
63
- setText(textTmpRef.current);
64
- }
65
- }, [chatAvailableState.disabled]);
73
+ const mentionAvailable = features.userMentionEnabled && channel.isGroupChannel() && !channel.isBroadcast;
66
74
  const inputMode = (0, _uikitUtils.useIIFE)(() => {
67
- if (!editMessage) return 'send';
68
- if (editMessage.isFileMessage()) return 'send';
75
+ if (!messageToEdit) return 'send';
76
+ if (messageToEdit.isFileMessage()) return 'send';
69
77
  return 'edit';
70
78
  });
79
+ const [inputHeight, setInputHeight] = (0, _react.useState)(styles.inputDefault.height);
80
+ const {
81
+ selection,
82
+ onSelectionChange,
83
+ textInputRef,
84
+ text,
85
+ onChangeText,
86
+ mentionedUsers
87
+ } = (0, _useMentionTextInput.default)({
88
+ messageToEdit: messageToEdit
89
+ });
90
+ useTypingTrigger(text, channel);
91
+ useTextPersistenceOnDisabled(text, onChangeText, chatAvailableState.disabled);
92
+ useAutoFocusOnEditMode(textInputRef, messageToEdit);
93
+
94
+ const onPressToMention = (user, searchStringRange) => {
95
+ const mentionedMessageText = mentionManager.asMentionedMessageText(user, true);
96
+ const range = {
97
+ start: searchStringRange.start,
98
+ end: searchStringRange.start + mentionedMessageText.length - 1
99
+ };
100
+ onChangeText((0, _uikitUtils.replace)(text, searchStringRange.start, searchStringRange.end, mentionedMessageText), {
101
+ user,
102
+ range
103
+ });
104
+ };
71
105
 
72
106
  if (!props.shouldRenderInput) {
73
107
  return /*#__PURE__*/_react.default.createElement(SafeAreaBottom, {
@@ -75,7 +109,7 @@ const GroupChannelInput = props => {
75
109
  });
76
110
  }
77
111
 
78
- return /*#__PURE__*/_react.default.createElement(_reactNative.KeyboardAvoidingView, {
112
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_reactNative.KeyboardAvoidingView, {
79
113
  keyboardVerticalOffset: -bottom + keyboardAvoidOffset,
80
114
  behavior: KEYBOARD_AVOID_VIEW_BEHAVIOR
81
115
  }, /*#__PURE__*/_react.default.createElement(_reactNative.View, {
@@ -85,22 +119,67 @@ const GroupChannelInput = props => {
85
119
  backgroundColor: colors.background
86
120
  }
87
121
  }, /*#__PURE__*/_react.default.createElement(_reactNative.View, {
88
- style: {
89
- justifyContent: 'center',
90
- width: '100%'
91
- }
92
- }, inputMode === 'send' && /*#__PURE__*/_react.default.createElement(_SendInput.default, _extends({}, props, {
122
+ onLayout: e => setInputHeight(e.nativeEvent.layout.height),
123
+ style: styles.inputContainer
124
+ }, inputMode === 'send' && /*#__PURE__*/_react.default.createElement(_SendInput.default, _extends({}, props, chatAvailableState, {
125
+ key: GET_INPUT_KEY(mentionedUsers.length === 0),
126
+ ref: textInputRef,
93
127
  text: text,
94
- setText: setText
95
- }, chatAvailableState)), inputMode === 'edit' && editMessage && /*#__PURE__*/_react.default.createElement(_EditInput.default, _extends({}, props, {
128
+ onChangeText: onChangeText,
129
+ onSelectionChange: onSelectionChange,
130
+ mentionedUsers: mentionedUsers
131
+ })), inputMode === 'edit' && messageToEdit && /*#__PURE__*/_react.default.createElement(_EditInput.default, _extends({}, props, {
132
+ key: GET_INPUT_KEY(mentionedUsers.length === 0),
133
+ ref: textInputRef,
134
+ autoFocus: AUTO_FOCUS,
96
135
  text: text,
97
- setText: setText,
98
- editMessage: editMessage,
99
- setEditMessage: setEditMessage,
100
- disabled: chatAvailableState.disabled
136
+ onChangeText: onChangeText,
137
+ messageToEdit: messageToEdit,
138
+ setMessageToEdit: setMessageToEdit,
139
+ disabled: chatAvailableState.disabled,
140
+ onSelectionChange: onSelectionChange,
141
+ mentionedUsers: mentionedUsers
101
142
  }))), /*#__PURE__*/_react.default.createElement(SafeAreaBottom, {
102
143
  height: bottom
103
- })));
144
+ }))), mentionAvailable && /*#__PURE__*/_react.default.createElement(props.SuggestedMentionList, {
145
+ text: text,
146
+ selection: selection,
147
+ inputHeight: inputHeight,
148
+ topInset: top,
149
+ bottomInset: bottom,
150
+ onPressToMention: onPressToMention,
151
+ mentionedUsers: mentionedUsers
152
+ }));
153
+ };
154
+
155
+ const useTypingTrigger = (text, channel) => {
156
+ (0, _react.useEffect)(() => {
157
+ if (text.length === 0) channel.endTyping();else channel.startTyping();
158
+ }, [text]);
159
+ };
160
+
161
+ const useTextPersistenceOnDisabled = (text, setText, chatDisabled) => {
162
+ const textTmpRef = (0, _react.useRef)('');
163
+ (0, _react.useEffect)(() => {
164
+ if (chatDisabled) {
165
+ textTmpRef.current = text;
166
+ setText('');
167
+ } else {
168
+ setText(textTmpRef.current);
169
+ }
170
+ }, [chatDisabled]);
171
+ };
172
+
173
+ const useAutoFocusOnEditMode = (textInputRef, messageToEdit) => {
174
+ (0, _react.useEffect)(() => {
175
+ if (messageToEdit !== null && messageToEdit !== void 0 && messageToEdit.isUserMessage()) {
176
+ if (!AUTO_FOCUS) setTimeout(() => {
177
+ var _textInputRef$current;
178
+
179
+ return (_textInputRef$current = textInputRef.current) === null || _textInputRef$current === void 0 ? void 0 : _textInputRef$current.focus();
180
+ }, 500);
181
+ }
182
+ }, [messageToEdit]);
104
183
  };
105
184
 
106
185
  const SafeAreaBottom = _ref => {
@@ -114,6 +193,16 @@ const SafeAreaBottom = _ref => {
114
193
  });
115
194
  };
116
195
 
196
+ const styles = (0, _uikitReactNativeFoundation.createStyleSheet)({
197
+ inputContainer: {
198
+ justifyContent: 'center',
199
+ width: '100%'
200
+ },
201
+ inputDefault: {
202
+ height: 56
203
+ }
204
+ });
205
+
117
206
  var _default = /*#__PURE__*/_react.default.memo(GroupChannelInput);
118
207
 
119
208
  exports.default = _default;
@@ -1 +1 @@
1
- {"version":3,"names":["KEYBOARD_AVOID_VIEW_BEHAVIOR","Platform","select","ios","default","undefined","GroupChannelInput","props","left","right","bottom","useSafeAreaInsets","colors","useUIKitTheme","channel","editMessage","setEditMessage","keyboardAvoidOffset","useContext","GroupChannelContexts","Fragment","text","setText","useState","textTmpRef","useRef","chatAvailableState","getGroupChannelChatAvailableState","useEffect","length","endTyping","startTyping","disabled","current","inputMode","useIIFE","isFileMessage","shouldRenderInput","paddingLeft","paddingRight","backgroundColor","background","justifyContent","width","SafeAreaBottom","height","React","memo"],"sources":["index.tsx"],"sourcesContent":["import React, { useContext, useEffect, useRef, useState } from 'react';\nimport { KeyboardAvoidingView, Platform, View } from 'react-native';\nimport { useSafeAreaInsets } from 'react-native-safe-area-context';\n\nimport { useUIKitTheme } from '@sendbird/uikit-react-native-foundation';\nimport { getGroupChannelChatAvailableState, useIIFE } from '@sendbird/uikit-utils';\n\nimport { GroupChannelContexts } from '../../module/moduleContext';\nimport type { GroupChannelProps } from '../../types';\nimport EditInput from './EditInput';\nimport SendInput from './SendInput';\n\nconst KEYBOARD_AVOID_VIEW_BEHAVIOR = Platform.select({ ios: 'padding' as const, default: undefined });\nconst GroupChannelInput = (props: GroupChannelProps['Input']) => {\n const { left, right, bottom } = useSafeAreaInsets();\n const { colors } = useUIKitTheme();\n const { channel, editMessage, setEditMessage, keyboardAvoidOffset = 0 } = useContext(GroupChannelContexts.Fragment);\n\n const [text, setText] = useState('');\n const textTmpRef = useRef('');\n const chatAvailableState = getGroupChannelChatAvailableState(channel);\n\n useEffect(() => {\n if (text.length === 0) channel.endTyping();\n else channel.startTyping();\n }, [text]);\n\n useEffect(() => {\n if (chatAvailableState.disabled) {\n textTmpRef.current = text;\n setText('');\n } else {\n setText(textTmpRef.current);\n }\n }, [chatAvailableState.disabled]);\n\n const inputMode = useIIFE(() => {\n if (!editMessage) return 'send';\n if (editMessage.isFileMessage()) return 'send';\n return 'edit';\n });\n\n if (!props.shouldRenderInput) {\n return <SafeAreaBottom height={bottom} />;\n }\n\n return (\n <KeyboardAvoidingView\n keyboardVerticalOffset={-bottom + keyboardAvoidOffset}\n behavior={KEYBOARD_AVOID_VIEW_BEHAVIOR}\n >\n <View style={{ paddingLeft: left, paddingRight: right, backgroundColor: colors.background }}>\n <View style={{ justifyContent: 'center', width: '100%' }}>\n {inputMode === 'send' && <SendInput {...props} text={text} setText={setText} {...chatAvailableState} />}\n {inputMode === 'edit' && editMessage && (\n <EditInput\n {...props}\n text={text}\n setText={setText}\n editMessage={editMessage}\n setEditMessage={setEditMessage}\n disabled={chatAvailableState.disabled}\n />\n )}\n </View>\n <SafeAreaBottom height={bottom} />\n </View>\n </KeyboardAvoidingView>\n );\n};\nconst SafeAreaBottom = ({ height }: { height: number }) => {\n return <View style={{ height }} />;\n};\n\nexport default React.memo(GroupChannelInput);\n"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AAEA;;AACA;;AAEA;;AAEA;;AACA;;;;;;;;;;AAEA,MAAMA,4BAA4B,GAAGC,qBAAA,CAASC,MAAT,CAAgB;EAAEC,GAAG,EAAE,SAAP;EAA2BC,OAAO,EAAEC;AAApC,CAAhB,CAArC;;AACA,MAAMC,iBAAiB,GAAIC,KAAD,IAAuC;EAC/D,MAAM;IAAEC,IAAF;IAAQC,KAAR;IAAeC;EAAf,IAA0B,IAAAC,6CAAA,GAAhC;EACA,MAAM;IAAEC;EAAF,IAAa,IAAAC,yCAAA,GAAnB;EACA,MAAM;IAAEC,OAAF;IAAWC,WAAX;IAAwBC,cAAxB;IAAwCC,mBAAmB,GAAG;EAA9D,IAAoE,IAAAC,iBAAA,EAAWC,mCAAA,CAAqBC,QAAhC,CAA1E;EAEA,MAAM,CAACC,IAAD,EAAOC,OAAP,IAAkB,IAAAC,eAAA,EAAS,EAAT,CAAxB;EACA,MAAMC,UAAU,GAAG,IAAAC,aAAA,EAAO,EAAP,CAAnB;EACA,MAAMC,kBAAkB,GAAG,IAAAC,6CAAA,EAAkCb,OAAlC,CAA3B;EAEA,I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EGQ,SAAS,KAAK,MAAd,IAAwBnB,WAAxB,iBACC,6BAAC,kBAAD,eACMR,KADN;IAEE,IAAI,EAAEc,IAFR;IAGE,OAAO,EAAEC,OAHX;IAIE,WAAW,EAAEP,WAJf;IAKE,cAAc,EAAEC,cALlB;IAME,QAAQ,EAAEU,kBAAkB,CAACM;EAN/B,GAHJ,CADF,eAcE,6BAAC,cAAD;IAAgB,MAAM,EAAEtB;EAAxB,EAdF,CAJF,CADF;AAuBD,CAxDD;;AAyDA,MAAMkC,cAAc,GAAG,QAAoC;EAAA,IAAnC;IAAEC;EAAF,CAAmC;EACzD,oBAAO,6BAAC,iBAAD;IAAM,KAAK,EAAE;MAAEA;IAAF;EAAb,EAAP;AACD,CAFD;;4BAIeC,cAAA,CAAMC,IAAN,CAAWzC,iBAAX,C"}
1
+ {"version":3,"names":["AUTO_FOCUS","Platform","select","ios","android","default","KEYBOARD_AVOID_VIEW_BEHAVIOR","undefined","GET_INPUT_KEY","shouldReset","GroupChannelInput","props","top","left","right","bottom","useSafeAreaInsets","colors","useUIKitTheme","features","mentionManager","useSendbirdChat","channel","messageToEdit","setMessageToEdit","keyboardAvoidOffset","useContext","GroupChannelContexts","Fragment","chatAvailableState","getGroupChannelChatAvailableState","mentionAvailable","userMentionEnabled","isGroupChannel","isBroadcast","inputMode","useIIFE","isFileMessage","inputHeight","setInputHeight","useState","styles","inputDefault","height","selection","onSelectionChange","textInputRef","text","onChangeText","mentionedUsers","useMentionTextInput","useTypingTrigger","useTextPersistenceOnDisabled","disabled","useAutoFocusOnEditMode","onPressToMention","user","searchStringRange","mentionedMessageText","asMentionedMessageText","range","start","end","length","replace","shouldRenderInput","paddingLeft","paddingRight","backgroundColor","background","e","nativeEvent","layout","inputContainer","useEffect","endTyping","startTyping","setText","chatDisabled","textTmpRef","useRef","current","isUserMessage","setTimeout","focus","SafeAreaBottom","createStyleSheet","justifyContent","width","React","memo"],"sources":["index.tsx"],"sourcesContent":["import React, { MutableRefObject, useContext, useEffect, useRef, useState } from 'react';\nimport { KeyboardAvoidingView, Platform, TextInput, View } from 'react-native';\nimport { useSafeAreaInsets } from 'react-native-safe-area-context';\n\nimport { createStyleSheet, useUIKitTheme } from '@sendbird/uikit-react-native-foundation';\nimport {\n SendbirdFileMessage,\n SendbirdGroupChannel,\n SendbirdUserMessage,\n getGroupChannelChatAvailableState,\n replace,\n useIIFE,\n} from '@sendbird/uikit-utils';\n\nimport { useSendbirdChat } from '../../../../hooks/useContext';\nimport useMentionTextInput from '../../../../hooks/useMentionTextInput';\nimport { GroupChannelContexts } from '../../module/moduleContext';\nimport type { GroupChannelProps } from '../../types';\nimport EditInput from './EditInput';\nimport SendInput from './SendInput';\n\nconst AUTO_FOCUS = Platform.select({ ios: false, android: true, default: false });\nconst KEYBOARD_AVOID_VIEW_BEHAVIOR = Platform.select({ ios: 'padding' as const, default: undefined });\n\n// FIXME(iOS): Dynamic style does not work properly when typing the CJK. (https://github.com/facebook/react-native/issues/26107)\n// To workaround temporarily, change the key for re-mount the component.\nconst GET_INPUT_KEY = (shouldReset: boolean) => (shouldReset ? 'uikit-input-clear' : 'uikit-input');\n\n// TODO: Refactor 'Edit' mode to clearly\nconst GroupChannelInput = (props: GroupChannelProps['Input']) => {\n const { top, left, right, bottom } = useSafeAreaInsets();\n const { colors } = useUIKitTheme();\n const { features, mentionManager } = useSendbirdChat();\n const {\n channel,\n messageToEdit,\n setMessageToEdit,\n keyboardAvoidOffset = 0,\n } = useContext(GroupChannelContexts.Fragment);\n\n const chatAvailableState = getGroupChannelChatAvailableState(channel);\n const mentionAvailable = features.userMentionEnabled && channel.isGroupChannel() && !channel.isBroadcast;\n const inputMode = useIIFE(() => {\n if (!messageToEdit) return 'send';\n if (messageToEdit.isFileMessage()) return 'send';\n return 'edit';\n });\n\n const [inputHeight, setInputHeight] = useState(styles.inputDefault.height);\n\n const { selection, onSelectionChange, textInputRef, text, onChangeText, mentionedUsers } = useMentionTextInput({\n messageToEdit: messageToEdit,\n });\n\n useTypingTrigger(text, channel);\n useTextPersistenceOnDisabled(text, onChangeText, chatAvailableState.disabled);\n useAutoFocusOnEditMode(textInputRef, messageToEdit);\n\n const onPressToMention: GroupChannelProps['SuggestedMentionList']['onPressToMention'] = (user, searchStringRange) => {\n const mentionedMessageText = mentionManager.asMentionedMessageText(user, true);\n const range = { start: searchStringRange.start, end: searchStringRange.start + mentionedMessageText.length - 1 };\n\n onChangeText(replace(text, searchStringRange.start, searchStringRange.end, mentionedMessageText), { user, range });\n };\n\n if (!props.shouldRenderInput) {\n return <SafeAreaBottom height={bottom} />;\n }\n\n return (\n <>\n <KeyboardAvoidingView\n keyboardVerticalOffset={-bottom + keyboardAvoidOffset}\n behavior={KEYBOARD_AVOID_VIEW_BEHAVIOR}\n >\n <View style={{ paddingLeft: left, paddingRight: right, backgroundColor: colors.background }}>\n <View onLayout={(e) => setInputHeight(e.nativeEvent.layout.height)} style={styles.inputContainer}>\n {inputMode === 'send' && (\n <SendInput\n {...props}\n {...chatAvailableState}\n key={GET_INPUT_KEY(mentionedUsers.length === 0)}\n ref={textInputRef as never}\n text={text}\n onChangeText={onChangeText}\n onSelectionChange={onSelectionChange}\n mentionedUsers={mentionedUsers}\n />\n )}\n {inputMode === 'edit' && messageToEdit && (\n <EditInput\n {...props}\n key={GET_INPUT_KEY(mentionedUsers.length === 0)}\n ref={textInputRef as never}\n autoFocus={AUTO_FOCUS}\n text={text}\n onChangeText={onChangeText}\n messageToEdit={messageToEdit}\n setMessageToEdit={setMessageToEdit}\n disabled={chatAvailableState.disabled}\n onSelectionChange={onSelectionChange}\n mentionedUsers={mentionedUsers}\n />\n )}\n </View>\n <SafeAreaBottom height={bottom} />\n </View>\n </KeyboardAvoidingView>\n {mentionAvailable && (\n <props.SuggestedMentionList\n text={text}\n selection={selection}\n inputHeight={inputHeight}\n topInset={top}\n bottomInset={bottom}\n onPressToMention={onPressToMention}\n mentionedUsers={mentionedUsers}\n />\n )}\n </>\n );\n};\n\nconst useTypingTrigger = (text: string, channel: SendbirdGroupChannel) => {\n useEffect(() => {\n if (text.length === 0) channel.endTyping();\n else channel.startTyping();\n }, [text]);\n};\n\nconst useTextPersistenceOnDisabled = (text: string, setText: (val: string) => void, chatDisabled: boolean) => {\n const textTmpRef = useRef('');\n\n useEffect(() => {\n if (chatDisabled) {\n textTmpRef.current = text;\n setText('');\n } else {\n setText(textTmpRef.current);\n }\n }, [chatDisabled]);\n};\n\nconst useAutoFocusOnEditMode = (\n textInputRef: MutableRefObject<TextInput | undefined>,\n messageToEdit?: SendbirdUserMessage | SendbirdFileMessage,\n) => {\n useEffect(() => {\n if (messageToEdit?.isUserMessage()) {\n if (!AUTO_FOCUS) setTimeout(() => textInputRef.current?.focus(), 500);\n }\n }, [messageToEdit]);\n};\n\nconst SafeAreaBottom = ({ height }: { height: number }) => {\n return <View style={{ height }} />;\n};\n\nconst styles = createStyleSheet({\n inputContainer: {\n justifyContent: 'center',\n width: '100%',\n },\n inputDefault: {\n height: 56,\n },\n});\n\nexport default React.memo(GroupChannelInput);\n"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AAEA;;AACA;;AASA;;AACA;;AACA;;AAEA;;AACA;;;;;;;;;;AAEA,MAAMA,UAAU,GAAGC,qBAAA,CAASC,MAAT,CAAgB;EAAEC,GAAG,EAAE,KAAP;EAAcC,OAAO,EAAE,IAAvB;EAA6BC,OAAO,EAAE;AAAtC,CAAhB,CAAnB;;AACA,MAAMC,4BAA4B,GAAGL,qBAAA,CAASC,MAAT,CAAgB;EAAEC,GAAG,EAAE,SAAP;EAA2BE,OAAO,EAAEE;AAApC,CAAhB,CAArC,C,CAEA;AACA;;;AACA,MAAMC,aAAa,GAAIC,WAAD,IAA2BA,WAAW,GAAG,mBAAH,GAAyB,aAArF,C,CAEA;;;AACA,MAAMC,iBAAiB,GAAIC,KAAD,IAAuC;EAC/D,MAAM;IAAEC,GAAF;IAAOC,IAAP;IAAaC,KAAb;IAAoBC;EAApB,IAA+B,IAAAC,6CAAA,GAArC;EACA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