chat 1.0.8 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (327) hide show
  1. package/dist/chunk-ACQNDPTB.js +356 -0
  2. package/dist/chunk-ACQNDPTB.js.map +1 -0
  3. package/dist/index.d.ts +1312 -0
  4. package/dist/index.js +1433 -0
  5. package/dist/index.js.map +1 -0
  6. package/dist/jsx-runtime-D7zHSnXe.d.ts +349 -0
  7. package/dist/jsx-runtime.d.ts +1 -0
  8. package/dist/jsx-runtime.js +17 -0
  9. package/dist/jsx-runtime.js.map +1 -0
  10. package/package.json +61 -97
  11. package/lib/module/ChatContext/index.js +0 -2
  12. package/lib/module/ChatContext/index.js.map +0 -1
  13. package/lib/module/ChatContext/types.js +0 -2
  14. package/lib/module/ChatContext/types.js.map +0 -1
  15. package/lib/module/classes/Chat/index.js +0 -2
  16. package/lib/module/classes/Chat/index.js.map +0 -1
  17. package/lib/module/classes/Chat/types.js +0 -2
  18. package/lib/module/classes/Chat/types.js.map +0 -1
  19. package/lib/module/classes/Inbox/index.js +0 -2
  20. package/lib/module/classes/Inbox/index.js.map +0 -1
  21. package/lib/module/classes/Inbox/types.js +0 -2
  22. package/lib/module/classes/Inbox/types.js.map +0 -1
  23. package/lib/module/classes/Message/index.js +0 -2
  24. package/lib/module/classes/Message/index.js.map +0 -1
  25. package/lib/module/classes/Message/types.js +0 -2
  26. package/lib/module/classes/Message/types.js.map +0 -1
  27. package/lib/module/classes/Reaction/index.js +0 -2
  28. package/lib/module/classes/Reaction/index.js.map +0 -1
  29. package/lib/module/classes/Reaction/types.js +0 -2
  30. package/lib/module/classes/Reaction/types.js.map +0 -1
  31. package/lib/module/classes/Room/index.js +0 -2
  32. package/lib/module/classes/Room/index.js.map +0 -1
  33. package/lib/module/classes/Room/types.js +0 -2
  34. package/lib/module/classes/Room/types.js.map +0 -1
  35. package/lib/module/classes/index.js +0 -2
  36. package/lib/module/classes/index.js.map +0 -1
  37. package/lib/module/components/Avatar/index.js +0 -2
  38. package/lib/module/components/Avatar/index.js.map +0 -1
  39. package/lib/module/components/Chat/Bubble/index.js +0 -2
  40. package/lib/module/components/Chat/Bubble/index.js.map +0 -1
  41. package/lib/module/components/Chat/Composer/Input/index.js +0 -2
  42. package/lib/module/components/Chat/Composer/Input/index.js.map +0 -1
  43. package/lib/module/components/Chat/Composer/Send/index.js +0 -2
  44. package/lib/module/components/Chat/Composer/Send/index.js.map +0 -1
  45. package/lib/module/components/Chat/Composer/index.js +0 -2
  46. package/lib/module/components/Chat/Composer/index.js.map +0 -1
  47. package/lib/module/components/Chat/Media/Image/index.js +0 -2
  48. package/lib/module/components/Chat/Media/Image/index.js.map +0 -1
  49. package/lib/module/components/Chat/Media/index.js +0 -2
  50. package/lib/module/components/Chat/Media/index.js.map +0 -1
  51. package/lib/module/components/Chat/Message/Swiper/Action/index.js +0 -2
  52. package/lib/module/components/Chat/Message/Swiper/Action/index.js.map +0 -1
  53. package/lib/module/components/Chat/Message/Swiper/index.js +0 -2
  54. package/lib/module/components/Chat/Message/Swiper/index.js.map +0 -1
  55. package/lib/module/components/Chat/Message/Touchable/index.js +0 -2
  56. package/lib/module/components/Chat/Message/Touchable/index.js.map +0 -1
  57. package/lib/module/components/Chat/Message/index.js +0 -2
  58. package/lib/module/components/Chat/Message/index.js.map +0 -1
  59. package/lib/module/components/Chat/SystemMessage/index.js +0 -2
  60. package/lib/module/components/Chat/SystemMessage/index.js.map +0 -1
  61. package/lib/module/components/Chat/TypingFooter/index.js +0 -2
  62. package/lib/module/components/Chat/TypingFooter/index.js.map +0 -1
  63. package/lib/module/components/Chat/index.js +0 -2
  64. package/lib/module/components/Chat/index.js.map +0 -1
  65. package/lib/module/components/Chat/types.js +0 -2
  66. package/lib/module/components/Chat/types.js.map +0 -1
  67. package/lib/module/components/Chat-Old/Bubble/index.js +0 -2
  68. package/lib/module/components/Chat-Old/Bubble/index.js.map +0 -1
  69. package/lib/module/components/Chat-Old/Composer/Input/index.js +0 -2
  70. package/lib/module/components/Chat-Old/Composer/Input/index.js.map +0 -1
  71. package/lib/module/components/Chat-Old/Composer/Send/index.js +0 -2
  72. package/lib/module/components/Chat-Old/Composer/Send/index.js.map +0 -1
  73. package/lib/module/components/Chat-Old/Composer/index.js +0 -2
  74. package/lib/module/components/Chat-Old/Composer/index.js.map +0 -1
  75. package/lib/module/components/Chat-Old/Message/index.js +0 -2
  76. package/lib/module/components/Chat-Old/Message/index.js.map +0 -1
  77. package/lib/module/components/Chat-Old/Swiper/Action/index.js +0 -2
  78. package/lib/module/components/Chat-Old/Swiper/Action/index.js.map +0 -1
  79. package/lib/module/components/Chat-Old/Swiper/index.js +0 -2
  80. package/lib/module/components/Chat-Old/Swiper/index.js.map +0 -1
  81. package/lib/module/components/Chat-Old/SystemMessage/index.js +0 -2
  82. package/lib/module/components/Chat-Old/SystemMessage/index.js.map +0 -1
  83. package/lib/module/components/Chat-Old/index.js +0 -2
  84. package/lib/module/components/Chat-Old/index.js.map +0 -1
  85. package/lib/module/components/Chat-Old/types.js +0 -2
  86. package/lib/module/components/Chat-Old/types.js.map +0 -1
  87. package/lib/module/components/ChatProvider/index.js +0 -2
  88. package/lib/module/components/ChatProvider/index.js.map +0 -1
  89. package/lib/module/components/ChatProvider/types.js +0 -2
  90. package/lib/module/components/ChatProvider/types.js.map +0 -1
  91. package/lib/module/components/Inbox/Item/Circle/index.js +0 -2
  92. package/lib/module/components/Inbox/Item/Circle/index.js.map +0 -1
  93. package/lib/module/components/Inbox/Item/Circle/types.js +0 -2
  94. package/lib/module/components/Inbox/Item/Circle/types.js.map +0 -1
  95. package/lib/module/components/Inbox/Item/Initials/index.js +0 -2
  96. package/lib/module/components/Inbox/Item/Initials/index.js.map +0 -1
  97. package/lib/module/components/Inbox/Item/ItemDate/index.js +0 -2
  98. package/lib/module/components/Inbox/Item/ItemDate/index.js.map +0 -1
  99. package/lib/module/components/Inbox/Item/Separator/index.js +0 -2
  100. package/lib/module/components/Inbox/Item/Separator/index.js.map +0 -1
  101. package/lib/module/components/Inbox/Item/Subtitle/index.js +0 -2
  102. package/lib/module/components/Inbox/Item/Subtitle/index.js.map +0 -1
  103. package/lib/module/components/Inbox/Item/Swipeable/index.js +0 -2
  104. package/lib/module/components/Inbox/Item/Swipeable/index.js.map +0 -1
  105. package/lib/module/components/Inbox/Item/Title/index.js +0 -2
  106. package/lib/module/components/Inbox/Item/Title/index.js.map +0 -1
  107. package/lib/module/components/Inbox/Item/UnreadIndicator/index.js +0 -2
  108. package/lib/module/components/Inbox/Item/UnreadIndicator/index.js.map +0 -1
  109. package/lib/module/components/Inbox/Item/index.js +0 -2
  110. package/lib/module/components/Inbox/Item/index.js.map +0 -1
  111. package/lib/module/components/Inbox/index.js +0 -2
  112. package/lib/module/components/Inbox/index.js.map +0 -1
  113. package/lib/module/components/Inbox/question.md +0 -21
  114. package/lib/module/components/Inbox/readme.md +0 -21
  115. package/lib/module/components/Inbox/types.js +0 -2
  116. package/lib/module/components/Inbox/types.js.map +0 -1
  117. package/lib/module/components/RoomCreator/Content/Footer/Button/index.js +0 -2
  118. package/lib/module/components/RoomCreator/Content/Footer/Button/index.js.map +0 -1
  119. package/lib/module/components/RoomCreator/Content/Footer/Input/index.js +0 -2
  120. package/lib/module/components/RoomCreator/Content/Footer/Input/index.js.map +0 -1
  121. package/lib/module/components/RoomCreator/Content/Footer/index.js +0 -2
  122. package/lib/module/components/RoomCreator/Content/Footer/index.js.map +0 -1
  123. package/lib/module/components/RoomCreator/Content/Item/Icon/index.js +0 -2
  124. package/lib/module/components/RoomCreator/Content/Item/Icon/index.js.map +0 -1
  125. package/lib/module/components/RoomCreator/Content/Item/index.js +0 -2
  126. package/lib/module/components/RoomCreator/Content/Item/index.js.map +0 -1
  127. package/lib/module/components/RoomCreator/Content/index.js +0 -2
  128. package/lib/module/components/RoomCreator/Content/index.js.map +0 -1
  129. package/lib/module/components/RoomCreator/Header/index.js +0 -2
  130. package/lib/module/components/RoomCreator/Header/index.js.map +0 -1
  131. package/lib/module/components/RoomCreator/index.js +0 -2
  132. package/lib/module/components/RoomCreator/index.js.map +0 -1
  133. package/lib/module/components/RoomCreator/types.js +0 -2
  134. package/lib/module/components/RoomCreator/types.js.map +0 -1
  135. package/lib/module/components/TypingIndicator/index.js +0 -2
  136. package/lib/module/components/TypingIndicator/index.js.map +0 -1
  137. package/lib/module/components/index.js +0 -2
  138. package/lib/module/components/index.js.map +0 -1
  139. package/lib/module/helpers/getInitials.js +0 -2
  140. package/lib/module/helpers/getInitials.js.map +0 -1
  141. package/lib/module/helpers/sortByAvatar.js +0 -2
  142. package/lib/module/helpers/sortByAvatar.js.map +0 -1
  143. package/lib/module/hooks/index.js +0 -2
  144. package/lib/module/hooks/index.js.map +0 -1
  145. package/lib/module/hooks/useCreateRoom/index.js +0 -2
  146. package/lib/module/hooks/useCreateRoom/index.js.map +0 -1
  147. package/lib/module/hooks/useCreator/index.js +0 -2
  148. package/lib/module/hooks/useCreator/index.js.map +0 -1
  149. package/lib/module/hooks/useInbox/index.js +0 -2
  150. package/lib/module/hooks/useInbox/index.js.map +0 -1
  151. package/lib/module/hooks/useInbox/types.js +0 -2
  152. package/lib/module/hooks/useInbox/types.js.map +0 -1
  153. package/lib/module/hooks/useMessages/index.js +0 -2
  154. package/lib/module/hooks/useMessages/index.js.map +0 -1
  155. package/lib/module/hooks/useMessages/types.js +0 -2
  156. package/lib/module/hooks/useMessages/types.js.map +0 -1
  157. package/lib/module/hooks/useRoom/index.js +0 -2
  158. package/lib/module/hooks/useRoom/index.js.map +0 -1
  159. package/lib/module/hooks/useRoom/types.js +0 -2
  160. package/lib/module/hooks/useRoom/types.js.map +0 -1
  161. package/lib/module/hooks/useSend/useSendToGroup/index.js +0 -2
  162. package/lib/module/hooks/useSend/useSendToGroup/index.js.map +0 -1
  163. package/lib/module/hooks/useSend/useSendToPeople/index.js +0 -2
  164. package/lib/module/hooks/useSend/useSendToPeople/index.js.map +0 -1
  165. package/lib/module/hooks/useTyping/index.js +0 -2
  166. package/lib/module/hooks/useTyping/index.js.map +0 -1
  167. package/lib/module/hooks/useTypingOLD/index.js +0 -2
  168. package/lib/module/hooks/useTypingOLD/index.js.map +0 -1
  169. package/lib/module/hooks/useTypingOLD/types.js +0 -2
  170. package/lib/module/hooks/useTypingOLD/types.js.map +0 -1
  171. package/lib/module/hooks/useViewMessages/index.js +0 -2
  172. package/lib/module/hooks/useViewMessages/index.js.map +0 -1
  173. package/lib/module/hooks/useViewMessages/types.js +0 -2
  174. package/lib/module/hooks/useViewMessages/types.js.map +0 -1
  175. package/lib/module/hooks/useViewMessagesOld/index.js +0 -2
  176. package/lib/module/hooks/useViewMessagesOld/index.js.map +0 -1
  177. package/lib/module/index.js +0 -2
  178. package/lib/module/index.js.map +0 -1
  179. package/lib/typescript/ChatContext/index.d.ts +0 -2
  180. package/lib/typescript/ChatContext/types.d.ts +0 -4
  181. package/lib/typescript/classes/Chat/index.d.ts +0 -14
  182. package/lib/typescript/classes/Chat/types.d.ts +0 -21
  183. package/lib/typescript/classes/Inbox/types.d.ts +0 -2
  184. package/lib/typescript/classes/Message/index.d.ts +0 -47
  185. package/lib/typescript/classes/Message/types.d.ts +0 -66
  186. package/lib/typescript/classes/Reaction/index.d.ts +0 -17
  187. package/lib/typescript/classes/Reaction/types.d.ts +0 -33
  188. package/lib/typescript/classes/Room/index.d.ts +0 -42
  189. package/lib/typescript/classes/Room/types.d.ts +0 -112
  190. package/lib/typescript/classes/index.d.ts +0 -4
  191. package/lib/typescript/components/Avatar/index.d.ts +0 -4
  192. package/lib/typescript/components/Chat/Bubble/index.d.ts +0 -4
  193. package/lib/typescript/components/Chat/Composer/Input/index.d.ts +0 -7
  194. package/lib/typescript/components/Chat/Composer/Send/index.d.ts +0 -4
  195. package/lib/typescript/components/Chat/Composer/index.d.ts +0 -8
  196. package/lib/typescript/components/Chat/Media/Image/index.d.ts +0 -7
  197. package/lib/typescript/components/Chat/Media/index.d.ts +0 -4
  198. package/lib/typescript/components/Chat/Message/Touchable/index.d.ts +0 -4
  199. package/lib/typescript/components/Chat/Message/index.d.ts +0 -8
  200. package/lib/typescript/components/Chat/SystemMessage/index.d.ts +0 -4
  201. package/lib/typescript/components/Chat/TypingFooter/index.d.ts +0 -4
  202. package/lib/typescript/components/Chat/index.d.ts +0 -8
  203. package/lib/typescript/components/Chat/types.d.ts +0 -843
  204. package/lib/typescript/components/ChatProvider/index.d.ts +0 -10
  205. package/lib/typescript/components/ChatProvider/types.d.ts +0 -7
  206. package/lib/typescript/components/Inbox/Item/Initials/index.d.ts +0 -4
  207. package/lib/typescript/components/Inbox/Item/ItemDate/index.d.ts +0 -4
  208. package/lib/typescript/components/Inbox/Item/Separator/index.d.ts +0 -6
  209. package/lib/typescript/components/Inbox/Item/Subtitle/index.d.ts +0 -3
  210. package/lib/typescript/components/Inbox/Item/Swipeable/index.d.ts +0 -4
  211. package/lib/typescript/components/Inbox/Item/Title/index.d.ts +0 -3
  212. package/lib/typescript/components/Inbox/Item/UnreadIndicator/index.d.ts +0 -4
  213. package/lib/typescript/components/Inbox/Item/index.d.ts +0 -6
  214. package/lib/typescript/components/Inbox/index.d.ts +0 -4
  215. package/lib/typescript/components/Inbox/types.d.ts +0 -304
  216. package/lib/typescript/components/RoomCreator/Content/Footer/Button/index.d.ts +0 -4
  217. package/lib/typescript/components/RoomCreator/Content/Footer/Input/index.d.ts +0 -4
  218. package/lib/typescript/components/RoomCreator/Content/Footer/index.d.ts +0 -3
  219. package/lib/typescript/components/RoomCreator/Content/Item/Icon/index.d.ts +0 -4
  220. package/lib/typescript/components/RoomCreator/Content/Item/index.d.ts +0 -4
  221. package/lib/typescript/components/RoomCreator/Content/index.d.ts +0 -4
  222. package/lib/typescript/components/RoomCreator/Header/index.d.ts +0 -4
  223. package/lib/typescript/components/RoomCreator/index.d.ts +0 -4
  224. package/lib/typescript/components/RoomCreator/types.d.ts +0 -208
  225. package/lib/typescript/components/TypingIndicator/index.d.ts +0 -9
  226. package/lib/typescript/components/index.d.ts +0 -12
  227. package/lib/typescript/helpers/getInitials.d.ts +0 -1
  228. package/lib/typescript/hooks/index.d.ts +0 -8
  229. package/lib/typescript/hooks/useCreator/index.d.ts +0 -27
  230. package/lib/typescript/hooks/useInbox/index.d.ts +0 -29
  231. package/lib/typescript/hooks/useInbox/types.d.ts +0 -5
  232. package/lib/typescript/hooks/useMessages/index.d.ts +0 -24
  233. package/lib/typescript/hooks/useMessages/types.d.ts +0 -5
  234. package/lib/typescript/hooks/useRoom/index.d.ts +0 -26
  235. package/lib/typescript/hooks/useRoom/types.d.ts +0 -5
  236. package/lib/typescript/hooks/useSend/useSendToGroup/index.d.ts +0 -6
  237. package/lib/typescript/hooks/useSend/useSendToPeople/index.d.ts +0 -6
  238. package/lib/typescript/hooks/useTyping/index.d.ts +0 -36
  239. package/lib/typescript/hooks/useViewMessages/index.d.ts +0 -18
  240. package/lib/typescript/hooks/useViewMessages/types.d.ts +0 -20
  241. package/lib/typescript/index.d.ts +0 -11
  242. package/readme.md +0 -201
  243. package/src/ChatContext/index.tsx +0 -9
  244. package/src/ChatContext/types.ts +0 -4
  245. package/src/classes/Chat/index.ts +0 -46
  246. package/src/classes/Chat/types.ts +0 -23
  247. package/src/classes/Inbox/index.ts +0 -12
  248. package/src/classes/Inbox/types.ts +0 -3
  249. package/src/classes/Message/index.ts +0 -310
  250. package/src/classes/Message/types.ts +0 -118
  251. package/src/classes/Reaction/index.ts +0 -108
  252. package/src/classes/Reaction/types.ts +0 -37
  253. package/src/classes/Room/index.ts +0 -323
  254. package/src/classes/Room/types.ts +0 -161
  255. package/src/classes/index.ts +0 -4
  256. package/src/components/Avatar/index.tsx +0 -25
  257. package/src/components/Chat/Bubble/index.tsx +0 -139
  258. package/src/components/Chat/Composer/Input/index.tsx +0 -45
  259. package/src/components/Chat/Composer/Send/index.tsx +0 -51
  260. package/src/components/Chat/Composer/index.tsx +0 -187
  261. package/src/components/Chat/Media/Image/index.tsx +0 -26
  262. package/src/components/Chat/Media/index.tsx +0 -11
  263. package/src/components/Chat/Message/Swiper/Action/index.tsx +0 -7
  264. package/src/components/Chat/Message/Swiper/index.tsx +0 -32
  265. package/src/components/Chat/Message/Touchable/index.tsx +0 -60
  266. package/src/components/Chat/Message/index.tsx +0 -328
  267. package/src/components/Chat/SystemMessage/index.tsx +0 -44
  268. package/src/components/Chat/TypingFooter/index.tsx +0 -48
  269. package/src/components/Chat/index.tsx +0 -596
  270. package/src/components/Chat/types.ts +0 -913
  271. package/src/components/Chat-Old/Bubble/index.tsx +0 -58
  272. package/src/components/Chat-Old/Composer/Input/index.tsx +0 -34
  273. package/src/components/Chat-Old/Composer/Send/index.tsx +0 -37
  274. package/src/components/Chat-Old/Composer/index.tsx +0 -131
  275. package/src/components/Chat-Old/Message/index.tsx +0 -160
  276. package/src/components/Chat-Old/Swiper/Action/index.tsx +0 -7
  277. package/src/components/Chat-Old/Swiper/index.tsx +0 -30
  278. package/src/components/Chat-Old/SystemMessage/index.tsx +0 -44
  279. package/src/components/Chat-Old/index.tsx +0 -356
  280. package/src/components/Chat-Old/types.ts +0 -752
  281. package/src/components/ChatProvider/index.tsx +0 -31
  282. package/src/components/ChatProvider/types.ts +0 -8
  283. package/src/components/Inbox/Item/Circle/index.tsx +0 -47
  284. package/src/components/Inbox/Item/Circle/types.ts +0 -8
  285. package/src/components/Inbox/Item/Initials/index.tsx +0 -41
  286. package/src/components/Inbox/Item/ItemDate/index.tsx +0 -26
  287. package/src/components/Inbox/Item/Separator/index.tsx +0 -13
  288. package/src/components/Inbox/Item/Subtitle/index.tsx +0 -23
  289. package/src/components/Inbox/Item/Swipeable/index.tsx +0 -143
  290. package/src/components/Inbox/Item/Title/index.tsx +0 -23
  291. package/src/components/Inbox/Item/UnreadIndicator/index.tsx +0 -84
  292. package/src/components/Inbox/Item/index.tsx +0 -307
  293. package/src/components/Inbox/index.tsx +0 -315
  294. package/src/components/Inbox/question.md +0 -21
  295. package/src/components/Inbox/readme.md +0 -21
  296. package/src/components/Inbox/types.ts +0 -371
  297. package/src/components/RoomCreator/Content/Footer/Button/index.tsx +0 -55
  298. package/src/components/RoomCreator/Content/Footer/Input/index.tsx +0 -27
  299. package/src/components/RoomCreator/Content/Footer/index.tsx +0 -72
  300. package/src/components/RoomCreator/Content/Item/Icon/index.tsx +0 -16
  301. package/src/components/RoomCreator/Content/Item/index.tsx +0 -87
  302. package/src/components/RoomCreator/Content/index.tsx +0 -75
  303. package/src/components/RoomCreator/Header/index.tsx +0 -74
  304. package/src/components/RoomCreator/index.tsx +0 -177
  305. package/src/components/RoomCreator/types.ts +0 -233
  306. package/src/components/TypingIndicator/index.tsx +0 -169
  307. package/src/components/index.ts +0 -18
  308. package/src/helpers/getInitials.ts +0 -11
  309. package/src/helpers/sortByAvatar.ts +0 -1
  310. package/src/hooks/index.ts +0 -8
  311. package/src/hooks/useCreateRoom/index.ts +0 -34
  312. package/src/hooks/useCreator/index.ts +0 -33
  313. package/src/hooks/useInbox/index.ts +0 -76
  314. package/src/hooks/useInbox/types.ts +0 -6
  315. package/src/hooks/useMessages/index.ts +0 -109
  316. package/src/hooks/useMessages/types.ts +0 -6
  317. package/src/hooks/useRoom/index.ts +0 -82
  318. package/src/hooks/useRoom/types.ts +0 -6
  319. package/src/hooks/useSend/useSendToGroup/index.ts +0 -38
  320. package/src/hooks/useSend/useSendToPeople/index.ts +0 -38
  321. package/src/hooks/useTyping/index.ts +0 -154
  322. package/src/hooks/useTypingOLD/index.ts +0 -67
  323. package/src/hooks/useTypingOLD/types.ts +0 -7
  324. package/src/hooks/useViewMessages/index.ts +0 -61
  325. package/src/hooks/useViewMessages/types.ts +0 -22
  326. package/src/hooks/useViewMessagesOld/index.ts +0 -39
  327. package/src/index.ts +0 -13
@@ -1,51 +0,0 @@
1
- import React, { useCallback } from 'react'
2
- import { Button, StyleSheet, TouchableOpacity, View } from 'react-native'
3
- import { Ionicons } from '@expo/vector-icons'
4
- import { SendButtonProps } from '../../types'
5
-
6
- const Send = (props: SendButtonProps) => {
7
- if (props.mode === 'hidden') return null
8
- const { containerStyle } = props
9
- const Container = useCallback(
10
- ({ children }) => {
11
- const style = {
12
- ...styles.container,
13
- ...(containerStyle || {}),
14
- }
15
- return <View style={style}>{children}</View>
16
- },
17
- [containerStyle],
18
- )
19
- if (props.mode === 'icon')
20
- return (
21
- <Container>
22
- <TouchableOpacity onPress={props.onSend} style={[styles.button, { backgroundColor: props.tintColor || 'blue' }]}>
23
- <Ionicons name="ios-arrow-round-up" size={size * 1.5} color={'white'} />
24
- </TouchableOpacity>
25
- </Container>
26
- )
27
- return (
28
- <Container>
29
- <Button title="Send" onPress={props.onSend} color={props.tintColor || 'blue'} />
30
- </Container>
31
- )
32
- }
33
-
34
- export default React.memo(Send)
35
-
36
- const size = 20
37
-
38
- const styles = StyleSheet.create({
39
- container: {
40
- paddingRight: 5,
41
- paddingBottom: 5,
42
- },
43
- button: {
44
- borderRadius: size,
45
- height: size * 1.5,
46
- width: size * 1.5,
47
- justifyContent: 'center',
48
- alignItems: 'center',
49
- // padding: size / 2
50
- },
51
- })
@@ -1,187 +0,0 @@
1
- import React, { useState, useCallback, useMemo, useEffect } from 'react'
2
- import uuid from 'uuid'
3
- import { View, StyleSheet, Keyboard } from 'react-native'
4
- import { isIphoneX, getBottomSpace } from 'react-native-iphone-x-helper'
5
- import { ComposerProps, InputProps, SendButtonProps } from '../types'
6
- import Input from './Input'
7
- import Send from './Send'
8
- import { MessageMedia, NewMessageModel } from '../../../classes/Message/types'
9
-
10
- // const emptyMedia: ComposerProps['media'][] = []
11
-
12
- const Composer = (props: ComposerProps) => {
13
- // First, we set up a state manager for the composer's text.
14
- const [textState, setText] = useState(props.initialText || '')
15
- // if you pass a text prop, use that state instead
16
- const [text, onChangeText] = useMemo(
17
- () => [
18
- props.text !== undefined ? props.text : textState,
19
- props.text !== undefined ? props.onInputTextChanged : setText,
20
- ],
21
- [props.text, textState, props.onInputTextChanged]
22
- )
23
-
24
- const [mediaState, setMedia] = useState<ComposerProps['media'][]>([])
25
- const [media, onChangeMedia] = [
26
- props.media || mediaState,
27
- (props.media && props.onChangeMedia) || setMedia,
28
- ]
29
-
30
- // track whether or not the keyboard is open to style the bottom based on where or not you're on an iPhone X
31
- const [keyboardOpen, setKeyboardOpen] = useState(false)
32
- useEffect(() => {
33
- const show = () => {
34
- setKeyboardOpen(true)
35
- }
36
- const hide = () => {
37
- setKeyboardOpen(false)
38
- }
39
- Keyboard.addListener('keyboardWillShow', show)
40
- Keyboard.addListener('keyboardWillHide', hide)
41
- return () => {
42
- Keyboard.removeListener('keyboardWillShow', show)
43
- Keyboard.removeListener('keyboardWillHide', hide)
44
- }
45
- }, [])
46
-
47
- const { user } = props
48
- const messagesReadyToSend = useMemo(() => {
49
- const messages: NewMessageModel[] = []
50
- if (media && media.length) {
51
- ;(media as MessageMedia[]).forEach((item: MessageMedia) => {
52
- const message: NewMessageModel = {
53
- user,
54
- text: '',
55
- id: uuid.v4(),
56
- createdAt: new Date(),
57
- media: item,
58
- }
59
- messages.push(message)
60
- })
61
- }
62
- if (text) {
63
- const message: NewMessageModel = {
64
- user,
65
- text: text && text.trim(),
66
- id: uuid.v4(),
67
- createdAt: new Date(),
68
- }
69
- messages.push(message)
70
- }
71
- return messages
72
- }, [user, text, media])
73
-
74
- const { onSend } = props
75
- const send = useCallback(() => {
76
- if (messagesReadyToSend.length) {
77
- if (onChangeText) onChangeText('')
78
- if (onChangeMedia) onChangeMedia([])
79
- onSend(messagesReadyToSend)
80
- }
81
- }, [onChangeText, onChangeMedia, messagesReadyToSend, onSend])
82
-
83
- const { textInputProps, renderTextInput } = props
84
- const renderInput = useCallback(() => {
85
- if (renderTextInput === null) return null
86
-
87
- const onSubmitEditing: InputProps['onSubmitEditing'] = () => {
88
- if (props.sendOnKeyboardReturn) send()
89
- }
90
-
91
- const inputProps: InputProps = {
92
- inputProps: textInputProps,
93
- onChangeText,
94
- text,
95
- containerStyle: props.inputContainerStyle,
96
- placeholderColor: props.placeholderColor,
97
- placeholderText: props.placeholderText,
98
- style: props.inputStyle,
99
- tintColor: props.tintColor,
100
- inputRef: props.inputRef,
101
- sendOnKeyboardReturn: props.sendOnKeyboardReturn,
102
- onSubmitEditing,
103
- }
104
-
105
- if (renderTextInput) return renderTextInput(inputProps)
106
-
107
- return <Input {...inputProps} />
108
- }, [
109
- onChangeText,
110
- text,
111
- textInputProps,
112
- renderTextInput,
113
- props.inputContainerStyle,
114
- props.placeholderColor,
115
- props.placeholderText,
116
- props.inputStyle,
117
- props.tintColor,
118
- // TODO leave or take out?
119
- props.inputRef,
120
- props.sendOnKeyboardReturn,
121
- send,
122
- ])
123
-
124
- const { renderSendButton } = props
125
- const sendButtonMode =
126
- props.sendButtonMode?.({ hasText: !!(text && text.trim()) }) ?? 'icon'
127
- const renderSend = useCallback(() => {
128
- if (renderSendButton === null) return null
129
-
130
- // const mode: ChatProps['sendButtonMode'] = {
131
- // empty: 'hidden',
132
- // withText: 'icon',
133
- // ...(sendButtonMode || {}),
134
- // }
135
- const sendProps: SendButtonProps = {
136
- onSend: send,
137
- text,
138
- media: media as MessageMedia[],
139
- user,
140
- // mode: (text && text.trim ? mode.withText : mode.empty) || 'icon',
141
- mode: sendButtonMode,
142
- containerStyle: props.sendButtonContainerStyle,
143
- tintColor: props.tintColor,
144
- }
145
- if (renderSendButton) return renderSendButton(sendProps)
146
-
147
- return <Send {...sendProps} />
148
- }, [
149
- send,
150
- text,
151
- user,
152
- media,
153
- renderSendButton,
154
- sendButtonMode,
155
- props.sendButtonContainerStyle,
156
- props.tintColor,
157
- ])
158
-
159
- const containerStyle = useMemo(() => {
160
- const paddingBottom = keyboardOpen && isIphoneX() ? 10 : getBottomSpace()
161
- return [styles.container, { paddingBottom }, props.containerStyle]
162
- }, [props.containerStyle, keyboardOpen])
163
-
164
- return (
165
- <View style={[containerStyle]}>
166
- <View style={styles.wrapper}>
167
- {renderInput()}
168
- {renderSend()}
169
- </View>
170
- </View>
171
- )
172
- }
173
-
174
- Composer.displayName = 'Juice.Composer'
175
-
176
- export default React.memo(Composer)
177
-
178
- const styles = StyleSheet.create({
179
- container: {
180
- paddingBottom: 10,
181
- paddingTop: 5,
182
- },
183
- wrapper: {
184
- flexDirection: 'row',
185
- alignItems: 'flex-end',
186
- },
187
- })
@@ -1,26 +0,0 @@
1
- import React, { useMemo } from 'react'
2
- import { Image, Dimensions, ImageStyle } from 'react-native'
3
- import { MessageMedia } from '../../../../classes/Message/types'
4
-
5
- const Img = (props: Omit<MessageMedia, 'contentType'>) => {
6
- const dimensions = useMemo((): ImageStyle => {
7
- const aspectRatio = props.width / props.height
8
- const isVertical = props.height > props.width
9
- const { width: screenWidth } = Dimensions.get('window')
10
- const width = isVertical ? screenWidth * 0.6 : screenWidth * 0.7
11
- const height = width / aspectRatio
12
-
13
- return { height, width }
14
- }, [props.height, props.width])
15
- return (
16
- <Image
17
- source={{ uri: props.url || props.uri }}
18
- style={dimensions}
19
- resizeMode="cover"
20
- />
21
- )
22
- }
23
-
24
- Img.displayName = 'Juice.Image'
25
-
26
- export default React.memo(Img)
@@ -1,11 +0,0 @@
1
- import React from 'react'
2
- import { MessageMedia } from '../../../classes/Message/types'
3
- import Image from './Image'
4
-
5
- const Media = ({ contentType, ...props }: MessageMedia) => {
6
- if (contentType === 'image') return <Image {...props} />
7
- if (contentType === 'video') return null
8
- return null
9
- }
10
-
11
- export default React.memo(Media)
@@ -1,7 +0,0 @@
1
- import React from 'react'
2
- import { SwipeableProps, SwipeActionProps } from '../../../types'
3
- import { View } from 'react-native'
4
-
5
- export default (props: SwipeActionProps) => {
6
- return <View></View>
7
- }
@@ -1,32 +0,0 @@
1
- import React, { useCallback } from 'react'
2
- import Swipeable from 'react-native-gesture-handler/Swipeable'
3
- import { SwipeableProps, SwipeActionProps } from '../../types'
4
- import Action from './Action'
5
-
6
- const Swiper = (props: SwipeableProps) => {
7
- const { renderSwipeAction } = props
8
- const renderAction = useCallback(
9
- (actionProps: SwipeActionProps) => {
10
- if (renderSwipeAction) return renderSwipeAction(actionProps)
11
-
12
- return <Action {...actionProps} />
13
- },
14
- [renderSwipeAction]
15
- )
16
-
17
- const { swipeActions } = props
18
- const leftActions = swipeActions && swipeActions.left
19
- const rightActions = swipeActions && swipeActions.right
20
-
21
- const renderRightActions = useCallback(() => {
22
- if (rightActions) {
23
- rightActions.forEach(action => {})
24
- }
25
- }, [rightActions])
26
-
27
- const renderActionList = useCallback(() => {}, [])
28
-
29
- return <Swipeable></Swipeable>
30
- }
31
-
32
- export default Swiper
@@ -1,60 +0,0 @@
1
- import React, { useRef, useCallback, FunctionComponent } from 'react'
2
-
3
- import { TouchableProps } from '../../types'
4
- import {
5
- LongPressGestureHandler,
6
- State,
7
- TapGestureHandler
8
- } from 'react-native-gesture-handler'
9
-
10
- const Touchable: FunctionComponent<TouchableProps> = props => {
11
- const doubleTapRef = useRef<TapGestureHandler>(null)
12
- const { onLongPress, onPress, onDoubleTap: handleDoubleTap, id } = props
13
- const onHandlerStateChange = useCallback(
14
- event => {
15
- if (event.nativeEvent.state === State.ACTIVE) {
16
- if (onLongPress) onLongPress(id)
17
- // alert("I'm being pressed for so long")
18
- }
19
- },
20
- [onLongPress, id]
21
- )
22
- const onSingleTap = useCallback(
23
- event => {
24
- if (event.nativeEvent.state === State.ACTIVE) {
25
- if (onPress) onPress(id)
26
- }
27
- },
28
- [onPress, id]
29
- )
30
- const onDoubleTap = useCallback(
31
- event => {
32
- if (event.nativeEvent.state === State.ACTIVE) {
33
- if (handleDoubleTap) handleDoubleTap(id)
34
- }
35
- },
36
- [handleDoubleTap, id]
37
- )
38
- return (
39
- <LongPressGestureHandler
40
- onHandlerStateChange={onHandlerStateChange}
41
- minDurationMs={props.longPressDelay || 500}
42
- >
43
- <TapGestureHandler
44
- onHandlerStateChange={onSingleTap}
45
- waitFor={doubleTapRef}
46
- >
47
- <TapGestureHandler
48
- maxDelayMs={props.doubleTapDelay || 500}
49
- ref={doubleTapRef}
50
- onHandlerStateChange={onDoubleTap}
51
- numberOfTaps={2}
52
- >
53
- {props.children}
54
- </TapGestureHandler>
55
- </TapGestureHandler>
56
- </LongPressGestureHandler>
57
- )
58
- }
59
-
60
- export default Touchable
@@ -1,328 +0,0 @@
1
- import React, {
2
- useCallback,
3
- useRef,
4
- MutableRefObject,
5
- useMemo,
6
- FunctionComponent,
7
- useEffect,
8
- RefObject,
9
- } from 'react'
10
- import { View, StyleSheet, Text } from 'react-native'
11
- import { MessageProps } from '../types'
12
- import { NewMessageModel } from '../../../classes/Message/types'
13
- // import { NewMessageModel } from '../../../classes/Message/types'
14
- import Bubble from '../Bubble'
15
- import { Avatar, Initials } from '../../index'
16
- import { InitialsProps, AvatarProps } from '../../../components/Inbox/types'
17
- // TODO update imports for these
18
- import { getInitials } from '../../../helpers/getInitials'
19
- import {
20
- Transitioning,
21
- TransitioningView,
22
- Transition,
23
- } from 'react-native-reanimated'
24
- import Touchable from './Touchable'
25
- // import { AvatarProps, InitialsProps } from '../../Inbox/types'
26
- // import { getInitials } from '../../../helpers/getInitials'
27
-
28
- const Message = <Model extends NewMessageModel = NewMessageModel>(
29
- props: MessageProps<Model>
30
- ) => {
31
- const bubble = useRef<View>()
32
- const transitionRef = useRef<TransitioningView>()
33
- const mounted = useRef(false)
34
-
35
- const {
36
- renderAvatar,
37
- avatar,
38
- avatarImageProps,
39
- showAvatar,
40
- name,
41
- renderInitials,
42
- initialsBackgroundColor,
43
- initialsTextColor,
44
- } = props
45
-
46
- useEffect(() => {
47
- if (mounted.current) {
48
- // console.log('message updated', props.text)
49
- transitionRef.current && transitionRef.current.animateNextTransition()
50
- } else {
51
- mounted.current = true
52
- }
53
- }, [props.avatar, props.text, renderAvatar])
54
-
55
- const { renderFooter } = props
56
-
57
- const footer = useCallback(
58
- () => (renderFooter ? renderFooter({ id: props.id }) : null),
59
- [props.id, renderFooter]
60
- )
61
-
62
- const containerStyle = useMemo(() => {
63
- return [
64
- styles.container,
65
- props.isMe ? meStyles.container : otherStyles.container,
66
- props.messageContainerStyle,
67
- ]
68
- }, [props.isMe, props.messageContainerStyle])
69
-
70
- const wrapperStyle = useMemo(() => {
71
- return [
72
- styles.wrapper,
73
- props.isMe ? meStyles.wrapper : otherStyles.wrapper,
74
- props.messageWrapperStyle,
75
- ]
76
- }, [props.isMe, props.messageWrapperStyle])
77
-
78
- // no avatar size if it's rendered null. this var is used in different spots
79
- const avatarSize = renderAvatar === null ? 0 : props.avatarSize || 35
80
-
81
- const maybeRenderName = useCallback(() => {
82
- const style = {
83
- ...styles.name,
84
- ...(props.isMe ? meStyles.name : otherStyles.name),
85
- }
86
- return props.showName && props.name ? (
87
- <Text style={[style, props.nameStyle]}>{props.name}</Text>
88
- ) : null
89
- }, [props.showName, props.name, props.nameStyle, props.isMe])
90
-
91
- const renderAvatarOrInitials = useCallback(() => {
92
- if (renderAvatar === null) return null
93
- // we make opacity 0 instead of hiding it to maintain the same width from the side
94
- const opacity = showAvatar === false ? 0 : 1
95
- const size = avatarSize
96
-
97
- if (avatar) {
98
- const avatarProps: AvatarProps = {
99
- avatar: avatar,
100
- imageProps: avatarImageProps,
101
- size,
102
- ImageComponent: props.AvatarImageComponent,
103
- }
104
- if (renderAvatar) return renderAvatar(avatarProps)
105
- return (
106
- <AvatarContainer opacity={opacity} showAvatar={!!showAvatar}>
107
- <Avatar {...avatarProps} />
108
- </AvatarContainer>
109
- )
110
- }
111
- const initialsProps: InitialsProps = {
112
- initials: getInitials(name),
113
- size,
114
- textColor: initialsTextColor,
115
- backgroundColor: initialsBackgroundColor || props.tintColor,
116
- }
117
- if (renderInitials) return renderInitials(initialsProps)
118
- return (
119
- <AvatarContainer opacity={opacity} showAvatar={!!showAvatar}>
120
- <Initials {...initialsProps} />
121
- </AvatarContainer>
122
- )
123
- }, [
124
- avatar,
125
- avatarImageProps,
126
- avatarSize,
127
- renderAvatar,
128
- showAvatar,
129
- name,
130
- renderInitials,
131
- initialsBackgroundColor,
132
- initialsTextColor,
133
- props.tintColor,
134
- props.AvatarImageComponent,
135
- ])
136
-
137
- const {
138
- bubbleBackgroundColor,
139
- id,
140
- userId,
141
- userName,
142
- createdAt,
143
- text,
144
- system,
145
- } = props
146
- const backgroundColor = useMemo(() => {
147
- const fallback = props.isMe
148
- ? ['#7B16FF', '#7114EA']
149
- : ['#f1f7f8', '#f8f8f8']
150
- if (!bubbleBackgroundColor) return fallback
151
- let colors: string[] = []
152
- if (typeof bubbleBackgroundColor === 'string') {
153
- colors = [bubbleBackgroundColor, bubbleBackgroundColor]
154
- } else if (Array.isArray(bubbleBackgroundColor)) {
155
- colors = bubbleBackgroundColor
156
- } else if (typeof bubbleBackgroundColor === 'function') {
157
- const background = bubbleBackgroundColor({
158
- createdAt,
159
- id,
160
- user: {
161
- name: userName ?? '',
162
- id: userId ?? '',
163
- avatar: avatar ?? '',
164
- },
165
- text,
166
- system,
167
- })
168
- // const background = bubbleBackgroundColor({
169
- // user: {
170
- // avatar: props.avatar || '',
171
- // id: props.userId || '',
172
- // name: props.userName || '',
173
- // },
174
- // id: props.id,
175
- // })
176
- if (Array.isArray(background)) {
177
- colors = background
178
- } else if (typeof background === 'string') {
179
- colors = [background, background]
180
- }
181
- }
182
- if (!colors.length) {
183
- console.warn(
184
- `🍇 Juice.Chat issue: It looks like you tried to set the message bubble background color, but something was off, so we're using the default colors. You should be passing either a string, array, or function to the bubbleBackgroundColor, like this: bubbleBackgroundColor={{ ${
185
- props.isMe ? 'me' : 'others'
186
- }: 'blue' }}. Instead, you passed this: ${bubbleBackgroundColor}.`
187
- )
188
- return fallback
189
- }
190
- return colors
191
- }, [
192
- props.isMe,
193
- bubbleBackgroundColor,
194
- createdAt,
195
- id,
196
- userName,
197
- userId,
198
- avatar,
199
- text,
200
- system,
201
- ])
202
- const renderBubble = () => {
203
- return (
204
- <Bubble
205
- text={props.text}
206
- isMe={props.isMe}
207
- style={props.bubbleStyle}
208
- textStyle={props.bubbleTextStyle}
209
- bubbleRef={bubble as MutableRefObject<View>}
210
- backgroundColor={backgroundColor}
211
- textColor={props.bubbleTextColor}
212
- mediaContentType={props.mediaContentType}
213
- mediaHeight={props.mediaHeight}
214
- mediaWidth={props.mediaWidth}
215
- mediaUri={props.mediaUri}
216
- mediaUrl={props.mediaUrl}
217
- renderMedia={props.renderMedia}
218
- renderText={props.renderText}
219
- />
220
- )
221
- }
222
- const outerStyle = useMemo(
223
- () => (props.createsNewBunch ? { marginTop: 10 } : {}),
224
- [props.createsNewBunch]
225
- )
226
- return (
227
- <Touchable
228
- id={props.id}
229
- longPressDelay={props.longPressDelay}
230
- doubleTapDelay={props.doubleTapDelay}
231
- onDoubleTap={props.onDoubleTap}
232
- onPress={props.onPress}
233
- onLongPress={props.onLongPress}
234
- >
235
- <Transitioning.View
236
- style={outerStyle}
237
- transition={transition}
238
- ref={transitionRef as RefObject<TransitioningView>}
239
- >
240
- <View style={containerStyle}>
241
- <View style={wrapperStyle}>
242
- {renderAvatarOrInitials()}
243
- <View style={{ flex: 1, justifyContent: 'flex-start' }}>
244
- {maybeRenderName()}
245
- <View style={wrapperStyle}>{renderBubble()}</View>
246
- </View>
247
- </View>
248
- {footer()}
249
- </View>
250
- </Transitioning.View>
251
- </Touchable>
252
- )
253
- }
254
-
255
- const transition = (
256
- // <Transition.Sequence>
257
- // {/* <Transition.Out type="fade" /> */}
258
- <Transition.Together>
259
- <Transition.Change interpolation="easeOut" />
260
- <Transition.In type="fade" />
261
- </Transition.Together>
262
- // </Transition.Sequence>
263
- )
264
-
265
- const AvatarContainer: FunctionComponent<{
266
- showAvatar: boolean
267
- opacity: 0 | 1
268
- }> = React.memo(function AvatarContainer({ children, opacity }) {
269
- return (
270
- <View
271
- style={{
272
- opacity,
273
- // transform: [{ rotate: !showAvatar ? '180deg' : '0deg' }],
274
- }}
275
- >
276
- {children}
277
- </View>
278
- )
279
- })
280
-
281
- Message.displayName = 'Message'
282
-
283
- export default React.memo(Message)
284
-
285
- const styles = StyleSheet.create({
286
- outer: {},
287
- container: {
288
- marginTop: 1,
289
- alignItems: 'flex-end',
290
- paddingHorizontal: 10,
291
- },
292
- // wrapper is concerned with which side the avatar is on relative to the bubble
293
- wrapper: {
294
- flex: 1,
295
- alignItems: 'flex-end',
296
- justifyContent: 'flex-start',
297
- },
298
- name: {
299
- marginHorizontal: 10,
300
- fontSize: 14,
301
- color: 'gray',
302
- paddingVertical: 5,
303
- },
304
- })
305
-
306
- const meStyles = StyleSheet.create({
307
- container: {
308
- justifyContent: 'flex-end',
309
- },
310
- wrapper: {
311
- flexDirection: 'row-reverse',
312
- },
313
- name: {
314
- textAlign: 'right',
315
- },
316
- })
317
-
318
- const otherStyles = StyleSheet.create({
319
- container: {
320
- justifyContent: 'flex-end',
321
- },
322
- wrapper: {
323
- flexDirection: 'row',
324
- },
325
- name: {
326
- textAlign: 'left',
327
- },
328
- })