chat 1.0.6 → 3.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 (318) hide show
  1. package/package.json +2 -96
  2. package/readme.md +1 -201
  3. package/lib/module/ChatContext/index.js +0 -2
  4. package/lib/module/ChatContext/index.js.map +0 -1
  5. package/lib/module/ChatContext/types.js +0 -2
  6. package/lib/module/ChatContext/types.js.map +0 -1
  7. package/lib/module/classes/Chat/index.js +0 -2
  8. package/lib/module/classes/Chat/index.js.map +0 -1
  9. package/lib/module/classes/Chat/types.js +0 -2
  10. package/lib/module/classes/Chat/types.js.map +0 -1
  11. package/lib/module/classes/Inbox/index.js +0 -2
  12. package/lib/module/classes/Inbox/index.js.map +0 -1
  13. package/lib/module/classes/Inbox/types.js +0 -2
  14. package/lib/module/classes/Inbox/types.js.map +0 -1
  15. package/lib/module/classes/Message/index.js +0 -2
  16. package/lib/module/classes/Message/index.js.map +0 -1
  17. package/lib/module/classes/Message/types.js +0 -2
  18. package/lib/module/classes/Message/types.js.map +0 -1
  19. package/lib/module/classes/Reaction/index.js +0 -2
  20. package/lib/module/classes/Reaction/index.js.map +0 -1
  21. package/lib/module/classes/Reaction/types.js +0 -2
  22. package/lib/module/classes/Reaction/types.js.map +0 -1
  23. package/lib/module/classes/Room/index.js +0 -2
  24. package/lib/module/classes/Room/index.js.map +0 -1
  25. package/lib/module/classes/Room/types.js +0 -2
  26. package/lib/module/classes/Room/types.js.map +0 -1
  27. package/lib/module/classes/index.js +0 -2
  28. package/lib/module/classes/index.js.map +0 -1
  29. package/lib/module/components/Avatar/index.js +0 -2
  30. package/lib/module/components/Avatar/index.js.map +0 -1
  31. package/lib/module/components/Chat/Bubble/index.js +0 -2
  32. package/lib/module/components/Chat/Bubble/index.js.map +0 -1
  33. package/lib/module/components/Chat/Composer/Input/index.js +0 -2
  34. package/lib/module/components/Chat/Composer/Input/index.js.map +0 -1
  35. package/lib/module/components/Chat/Composer/Send/index.js +0 -2
  36. package/lib/module/components/Chat/Composer/Send/index.js.map +0 -1
  37. package/lib/module/components/Chat/Composer/index.js +0 -2
  38. package/lib/module/components/Chat/Composer/index.js.map +0 -1
  39. package/lib/module/components/Chat/Media/Image/index.js +0 -2
  40. package/lib/module/components/Chat/Media/Image/index.js.map +0 -1
  41. package/lib/module/components/Chat/Media/index.js +0 -2
  42. package/lib/module/components/Chat/Media/index.js.map +0 -1
  43. package/lib/module/components/Chat/Message/Swiper/Action/index.js +0 -2
  44. package/lib/module/components/Chat/Message/Swiper/Action/index.js.map +0 -1
  45. package/lib/module/components/Chat/Message/Swiper/index.js +0 -2
  46. package/lib/module/components/Chat/Message/Swiper/index.js.map +0 -1
  47. package/lib/module/components/Chat/Message/Touchable/index.js +0 -2
  48. package/lib/module/components/Chat/Message/Touchable/index.js.map +0 -1
  49. package/lib/module/components/Chat/Message/index.js +0 -2
  50. package/lib/module/components/Chat/Message/index.js.map +0 -1
  51. package/lib/module/components/Chat/SystemMessage/index.js +0 -2
  52. package/lib/module/components/Chat/SystemMessage/index.js.map +0 -1
  53. package/lib/module/components/Chat/TypingFooter/index.js +0 -2
  54. package/lib/module/components/Chat/TypingFooter/index.js.map +0 -1
  55. package/lib/module/components/Chat/index.js +0 -2
  56. package/lib/module/components/Chat/index.js.map +0 -1
  57. package/lib/module/components/Chat/types.js +0 -2
  58. package/lib/module/components/Chat/types.js.map +0 -1
  59. package/lib/module/components/Chat-Old/Bubble/index.js +0 -2
  60. package/lib/module/components/Chat-Old/Bubble/index.js.map +0 -1
  61. package/lib/module/components/Chat-Old/Composer/Input/index.js +0 -2
  62. package/lib/module/components/Chat-Old/Composer/Input/index.js.map +0 -1
  63. package/lib/module/components/Chat-Old/Composer/Send/index.js +0 -2
  64. package/lib/module/components/Chat-Old/Composer/Send/index.js.map +0 -1
  65. package/lib/module/components/Chat-Old/Composer/index.js +0 -2
  66. package/lib/module/components/Chat-Old/Composer/index.js.map +0 -1
  67. package/lib/module/components/Chat-Old/Message/index.js +0 -2
  68. package/lib/module/components/Chat-Old/Message/index.js.map +0 -1
  69. package/lib/module/components/Chat-Old/Swiper/Action/index.js +0 -2
  70. package/lib/module/components/Chat-Old/Swiper/Action/index.js.map +0 -1
  71. package/lib/module/components/Chat-Old/Swiper/index.js +0 -2
  72. package/lib/module/components/Chat-Old/Swiper/index.js.map +0 -1
  73. package/lib/module/components/Chat-Old/SystemMessage/index.js +0 -2
  74. package/lib/module/components/Chat-Old/SystemMessage/index.js.map +0 -1
  75. package/lib/module/components/Chat-Old/index.js +0 -2
  76. package/lib/module/components/Chat-Old/index.js.map +0 -1
  77. package/lib/module/components/Chat-Old/types.js +0 -2
  78. package/lib/module/components/Chat-Old/types.js.map +0 -1
  79. package/lib/module/components/ChatProvider/index.js +0 -2
  80. package/lib/module/components/ChatProvider/index.js.map +0 -1
  81. package/lib/module/components/ChatProvider/types.js +0 -2
  82. package/lib/module/components/ChatProvider/types.js.map +0 -1
  83. package/lib/module/components/Inbox/Item/Circle/index.js +0 -2
  84. package/lib/module/components/Inbox/Item/Circle/index.js.map +0 -1
  85. package/lib/module/components/Inbox/Item/Circle/types.js +0 -2
  86. package/lib/module/components/Inbox/Item/Circle/types.js.map +0 -1
  87. package/lib/module/components/Inbox/Item/Initials/index.js +0 -2
  88. package/lib/module/components/Inbox/Item/Initials/index.js.map +0 -1
  89. package/lib/module/components/Inbox/Item/ItemDate/index.js +0 -2
  90. package/lib/module/components/Inbox/Item/ItemDate/index.js.map +0 -1
  91. package/lib/module/components/Inbox/Item/Separator/index.js +0 -2
  92. package/lib/module/components/Inbox/Item/Separator/index.js.map +0 -1
  93. package/lib/module/components/Inbox/Item/Subtitle/index.js +0 -2
  94. package/lib/module/components/Inbox/Item/Subtitle/index.js.map +0 -1
  95. package/lib/module/components/Inbox/Item/Swipeable/index.js +0 -2
  96. package/lib/module/components/Inbox/Item/Swipeable/index.js.map +0 -1
  97. package/lib/module/components/Inbox/Item/Title/index.js +0 -2
  98. package/lib/module/components/Inbox/Item/Title/index.js.map +0 -1
  99. package/lib/module/components/Inbox/Item/UnreadIndicator/index.js +0 -2
  100. package/lib/module/components/Inbox/Item/UnreadIndicator/index.js.map +0 -1
  101. package/lib/module/components/Inbox/Item/index.js +0 -2
  102. package/lib/module/components/Inbox/Item/index.js.map +0 -1
  103. package/lib/module/components/Inbox/index.js +0 -2
  104. package/lib/module/components/Inbox/index.js.map +0 -1
  105. package/lib/module/components/Inbox/question.md +0 -21
  106. package/lib/module/components/Inbox/readme.md +0 -21
  107. package/lib/module/components/Inbox/types.js +0 -2
  108. package/lib/module/components/Inbox/types.js.map +0 -1
  109. package/lib/module/components/RoomCreator/Content/Footer/Button/index.js +0 -2
  110. package/lib/module/components/RoomCreator/Content/Footer/Button/index.js.map +0 -1
  111. package/lib/module/components/RoomCreator/Content/Footer/Input/index.js +0 -2
  112. package/lib/module/components/RoomCreator/Content/Footer/Input/index.js.map +0 -1
  113. package/lib/module/components/RoomCreator/Content/Footer/index.js +0 -2
  114. package/lib/module/components/RoomCreator/Content/Footer/index.js.map +0 -1
  115. package/lib/module/components/RoomCreator/Content/Item/Icon/index.js +0 -2
  116. package/lib/module/components/RoomCreator/Content/Item/Icon/index.js.map +0 -1
  117. package/lib/module/components/RoomCreator/Content/Item/index.js +0 -2
  118. package/lib/module/components/RoomCreator/Content/Item/index.js.map +0 -1
  119. package/lib/module/components/RoomCreator/Content/index.js +0 -2
  120. package/lib/module/components/RoomCreator/Content/index.js.map +0 -1
  121. package/lib/module/components/RoomCreator/Header/index.js +0 -2
  122. package/lib/module/components/RoomCreator/Header/index.js.map +0 -1
  123. package/lib/module/components/RoomCreator/index.js +0 -2
  124. package/lib/module/components/RoomCreator/index.js.map +0 -1
  125. package/lib/module/components/RoomCreator/types.js +0 -2
  126. package/lib/module/components/RoomCreator/types.js.map +0 -1
  127. package/lib/module/components/TypingIndicator/index.js +0 -2
  128. package/lib/module/components/TypingIndicator/index.js.map +0 -1
  129. package/lib/module/components/index.js +0 -2
  130. package/lib/module/components/index.js.map +0 -1
  131. package/lib/module/helpers/getInitials.js +0 -2
  132. package/lib/module/helpers/getInitials.js.map +0 -1
  133. package/lib/module/helpers/sortByAvatar.js +0 -2
  134. package/lib/module/helpers/sortByAvatar.js.map +0 -1
  135. package/lib/module/hooks/index.js +0 -2
  136. package/lib/module/hooks/index.js.map +0 -1
  137. package/lib/module/hooks/useCreateRoom/index.js +0 -2
  138. package/lib/module/hooks/useCreateRoom/index.js.map +0 -1
  139. package/lib/module/hooks/useCreator/index.js +0 -2
  140. package/lib/module/hooks/useCreator/index.js.map +0 -1
  141. package/lib/module/hooks/useInbox/index.js +0 -2
  142. package/lib/module/hooks/useInbox/index.js.map +0 -1
  143. package/lib/module/hooks/useInbox/types.js +0 -2
  144. package/lib/module/hooks/useInbox/types.js.map +0 -1
  145. package/lib/module/hooks/useMessages/index.js +0 -2
  146. package/lib/module/hooks/useMessages/index.js.map +0 -1
  147. package/lib/module/hooks/useMessages/types.js +0 -2
  148. package/lib/module/hooks/useMessages/types.js.map +0 -1
  149. package/lib/module/hooks/useRoom/index.js +0 -2
  150. package/lib/module/hooks/useRoom/index.js.map +0 -1
  151. package/lib/module/hooks/useRoom/types.js +0 -2
  152. package/lib/module/hooks/useRoom/types.js.map +0 -1
  153. package/lib/module/hooks/useSend/useSendToGroup/index.js +0 -2
  154. package/lib/module/hooks/useSend/useSendToGroup/index.js.map +0 -1
  155. package/lib/module/hooks/useSend/useSendToPeople/index.js +0 -2
  156. package/lib/module/hooks/useSend/useSendToPeople/index.js.map +0 -1
  157. package/lib/module/hooks/useTyping/index.js +0 -2
  158. package/lib/module/hooks/useTyping/index.js.map +0 -1
  159. package/lib/module/hooks/useTypingOLD/index.js +0 -2
  160. package/lib/module/hooks/useTypingOLD/index.js.map +0 -1
  161. package/lib/module/hooks/useTypingOLD/types.js +0 -2
  162. package/lib/module/hooks/useTypingOLD/types.js.map +0 -1
  163. package/lib/module/hooks/useViewMessages/index.js +0 -2
  164. package/lib/module/hooks/useViewMessages/index.js.map +0 -1
  165. package/lib/module/hooks/useViewMessages/types.js +0 -2
  166. package/lib/module/hooks/useViewMessages/types.js.map +0 -1
  167. package/lib/module/hooks/useViewMessagesOld/index.js +0 -2
  168. package/lib/module/hooks/useViewMessagesOld/index.js.map +0 -1
  169. package/lib/module/index.js +0 -2
  170. package/lib/module/index.js.map +0 -1
  171. package/lib/typescript/ChatContext/index.d.ts +0 -2
  172. package/lib/typescript/ChatContext/types.d.ts +0 -4
  173. package/lib/typescript/classes/Chat/index.d.ts +0 -14
  174. package/lib/typescript/classes/Chat/types.d.ts +0 -21
  175. package/lib/typescript/classes/Inbox/types.d.ts +0 -2
  176. package/lib/typescript/classes/Message/index.d.ts +0 -47
  177. package/lib/typescript/classes/Message/types.d.ts +0 -66
  178. package/lib/typescript/classes/Reaction/index.d.ts +0 -17
  179. package/lib/typescript/classes/Reaction/types.d.ts +0 -33
  180. package/lib/typescript/classes/Room/index.d.ts +0 -42
  181. package/lib/typescript/classes/Room/types.d.ts +0 -112
  182. package/lib/typescript/classes/index.d.ts +0 -4
  183. package/lib/typescript/components/Avatar/index.d.ts +0 -4
  184. package/lib/typescript/components/Chat/Bubble/index.d.ts +0 -4
  185. package/lib/typescript/components/Chat/Composer/Input/index.d.ts +0 -7
  186. package/lib/typescript/components/Chat/Composer/Send/index.d.ts +0 -4
  187. package/lib/typescript/components/Chat/Composer/index.d.ts +0 -8
  188. package/lib/typescript/components/Chat/Media/Image/index.d.ts +0 -7
  189. package/lib/typescript/components/Chat/Media/index.d.ts +0 -4
  190. package/lib/typescript/components/Chat/Message/Touchable/index.d.ts +0 -4
  191. package/lib/typescript/components/Chat/Message/index.d.ts +0 -8
  192. package/lib/typescript/components/Chat/SystemMessage/index.d.ts +0 -4
  193. package/lib/typescript/components/Chat/TypingFooter/index.d.ts +0 -4
  194. package/lib/typescript/components/Chat/index.d.ts +0 -8
  195. package/lib/typescript/components/Chat/types.d.ts +0 -844
  196. package/lib/typescript/components/ChatProvider/index.d.ts +0 -10
  197. package/lib/typescript/components/ChatProvider/types.d.ts +0 -7
  198. package/lib/typescript/components/Inbox/Item/Initials/index.d.ts +0 -4
  199. package/lib/typescript/components/Inbox/Item/ItemDate/index.d.ts +0 -4
  200. package/lib/typescript/components/Inbox/Item/Separator/index.d.ts +0 -6
  201. package/lib/typescript/components/Inbox/Item/Subtitle/index.d.ts +0 -3
  202. package/lib/typescript/components/Inbox/Item/Swipeable/index.d.ts +0 -4
  203. package/lib/typescript/components/Inbox/Item/Title/index.d.ts +0 -3
  204. package/lib/typescript/components/Inbox/Item/UnreadIndicator/index.d.ts +0 -4
  205. package/lib/typescript/components/Inbox/Item/index.d.ts +0 -6
  206. package/lib/typescript/components/Inbox/index.d.ts +0 -4
  207. package/lib/typescript/components/Inbox/types.d.ts +0 -304
  208. package/lib/typescript/components/RoomCreator/Content/Footer/Button/index.d.ts +0 -4
  209. package/lib/typescript/components/RoomCreator/Content/Footer/Input/index.d.ts +0 -4
  210. package/lib/typescript/components/RoomCreator/Content/Footer/index.d.ts +0 -3
  211. package/lib/typescript/components/RoomCreator/Content/Item/Icon/index.d.ts +0 -4
  212. package/lib/typescript/components/RoomCreator/Content/Item/index.d.ts +0 -4
  213. package/lib/typescript/components/RoomCreator/Content/index.d.ts +0 -4
  214. package/lib/typescript/components/RoomCreator/Header/index.d.ts +0 -4
  215. package/lib/typescript/components/RoomCreator/index.d.ts +0 -4
  216. package/lib/typescript/components/RoomCreator/types.d.ts +0 -208
  217. package/lib/typescript/components/TypingIndicator/index.d.ts +0 -9
  218. package/lib/typescript/components/index.d.ts +0 -12
  219. package/lib/typescript/helpers/getInitials.d.ts +0 -1
  220. package/lib/typescript/hooks/index.d.ts +0 -8
  221. package/lib/typescript/hooks/useCreator/index.d.ts +0 -27
  222. package/lib/typescript/hooks/useInbox/index.d.ts +0 -29
  223. package/lib/typescript/hooks/useInbox/types.d.ts +0 -5
  224. package/lib/typescript/hooks/useMessages/index.d.ts +0 -24
  225. package/lib/typescript/hooks/useMessages/types.d.ts +0 -5
  226. package/lib/typescript/hooks/useRoom/index.d.ts +0 -26
  227. package/lib/typescript/hooks/useRoom/types.d.ts +0 -5
  228. package/lib/typescript/hooks/useSend/useSendToGroup/index.d.ts +0 -6
  229. package/lib/typescript/hooks/useSend/useSendToPeople/index.d.ts +0 -6
  230. package/lib/typescript/hooks/useTyping/index.d.ts +0 -36
  231. package/lib/typescript/hooks/useViewMessages/index.d.ts +0 -18
  232. package/lib/typescript/hooks/useViewMessages/types.d.ts +0 -20
  233. package/lib/typescript/index.d.ts +0 -11
  234. package/src/ChatContext/index.tsx +0 -9
  235. package/src/ChatContext/types.ts +0 -4
  236. package/src/classes/Chat/index.ts +0 -46
  237. package/src/classes/Chat/types.ts +0 -23
  238. package/src/classes/Inbox/index.ts +0 -12
  239. package/src/classes/Inbox/types.ts +0 -3
  240. package/src/classes/Message/index.ts +0 -310
  241. package/src/classes/Message/types.ts +0 -118
  242. package/src/classes/Reaction/index.ts +0 -108
  243. package/src/classes/Reaction/types.ts +0 -37
  244. package/src/classes/Room/index.ts +0 -323
  245. package/src/classes/Room/types.ts +0 -161
  246. package/src/classes/index.ts +0 -4
  247. package/src/components/Avatar/index.tsx +0 -25
  248. package/src/components/Chat/Bubble/index.tsx +0 -139
  249. package/src/components/Chat/Composer/Input/index.tsx +0 -45
  250. package/src/components/Chat/Composer/Send/index.tsx +0 -51
  251. package/src/components/Chat/Composer/index.tsx +0 -184
  252. package/src/components/Chat/Media/Image/index.tsx +0 -26
  253. package/src/components/Chat/Media/index.tsx +0 -11
  254. package/src/components/Chat/Message/Swiper/Action/index.tsx +0 -7
  255. package/src/components/Chat/Message/Swiper/index.tsx +0 -32
  256. package/src/components/Chat/Message/Touchable/index.tsx +0 -60
  257. package/src/components/Chat/Message/index.tsx +0 -328
  258. package/src/components/Chat/SystemMessage/index.tsx +0 -44
  259. package/src/components/Chat/TypingFooter/index.tsx +0 -48
  260. package/src/components/Chat/index.tsx +0 -592
  261. package/src/components/Chat/types.ts +0 -911
  262. package/src/components/Chat-Old/Bubble/index.tsx +0 -58
  263. package/src/components/Chat-Old/Composer/Input/index.tsx +0 -34
  264. package/src/components/Chat-Old/Composer/Send/index.tsx +0 -37
  265. package/src/components/Chat-Old/Composer/index.tsx +0 -131
  266. package/src/components/Chat-Old/Message/index.tsx +0 -160
  267. package/src/components/Chat-Old/Swiper/Action/index.tsx +0 -7
  268. package/src/components/Chat-Old/Swiper/index.tsx +0 -30
  269. package/src/components/Chat-Old/SystemMessage/index.tsx +0 -44
  270. package/src/components/Chat-Old/index.tsx +0 -356
  271. package/src/components/Chat-Old/types.ts +0 -752
  272. package/src/components/ChatProvider/index.tsx +0 -31
  273. package/src/components/ChatProvider/types.ts +0 -8
  274. package/src/components/Inbox/Item/Circle/index.tsx +0 -47
  275. package/src/components/Inbox/Item/Circle/types.ts +0 -8
  276. package/src/components/Inbox/Item/Initials/index.tsx +0 -41
  277. package/src/components/Inbox/Item/ItemDate/index.tsx +0 -26
  278. package/src/components/Inbox/Item/Separator/index.tsx +0 -13
  279. package/src/components/Inbox/Item/Subtitle/index.tsx +0 -23
  280. package/src/components/Inbox/Item/Swipeable/index.tsx +0 -143
  281. package/src/components/Inbox/Item/Title/index.tsx +0 -23
  282. package/src/components/Inbox/Item/UnreadIndicator/index.tsx +0 -84
  283. package/src/components/Inbox/Item/index.tsx +0 -307
  284. package/src/components/Inbox/index.tsx +0 -315
  285. package/src/components/Inbox/question.md +0 -21
  286. package/src/components/Inbox/readme.md +0 -21
  287. package/src/components/Inbox/types.ts +0 -371
  288. package/src/components/RoomCreator/Content/Footer/Button/index.tsx +0 -55
  289. package/src/components/RoomCreator/Content/Footer/Input/index.tsx +0 -27
  290. package/src/components/RoomCreator/Content/Footer/index.tsx +0 -72
  291. package/src/components/RoomCreator/Content/Item/Icon/index.tsx +0 -16
  292. package/src/components/RoomCreator/Content/Item/index.tsx +0 -87
  293. package/src/components/RoomCreator/Content/index.tsx +0 -75
  294. package/src/components/RoomCreator/Header/index.tsx +0 -74
  295. package/src/components/RoomCreator/index.tsx +0 -177
  296. package/src/components/RoomCreator/types.ts +0 -233
  297. package/src/components/TypingIndicator/index.tsx +0 -169
  298. package/src/components/index.ts +0 -18
  299. package/src/helpers/getInitials.ts +0 -11
  300. package/src/helpers/sortByAvatar.ts +0 -1
  301. package/src/hooks/index.ts +0 -8
  302. package/src/hooks/useCreateRoom/index.ts +0 -34
  303. package/src/hooks/useCreator/index.ts +0 -33
  304. package/src/hooks/useInbox/index.ts +0 -76
  305. package/src/hooks/useInbox/types.ts +0 -6
  306. package/src/hooks/useMessages/index.ts +0 -109
  307. package/src/hooks/useMessages/types.ts +0 -6
  308. package/src/hooks/useRoom/index.ts +0 -82
  309. package/src/hooks/useRoom/types.ts +0 -6
  310. package/src/hooks/useSend/useSendToGroup/index.ts +0 -38
  311. package/src/hooks/useSend/useSendToPeople/index.ts +0 -38
  312. package/src/hooks/useTyping/index.ts +0 -154
  313. package/src/hooks/useTypingOLD/index.ts +0 -67
  314. package/src/hooks/useTypingOLD/types.ts +0 -7
  315. package/src/hooks/useViewMessages/index.ts +0 -61
  316. package/src/hooks/useViewMessages/types.ts +0 -22
  317. package/src/hooks/useViewMessagesOld/index.ts +0 -39
  318. package/src/index.ts +0 -13
@@ -1,58 +0,0 @@
1
- import React, { useMemo, FunctionComponent } from 'react'
2
- import { BubbleProps } from '../types'
3
- import { View, Text, StyleSheet } from 'react-native'
4
-
5
- const Bubble: FunctionComponent<BubbleProps> = props => {
6
- const containerStyles = useMemo(
7
- () => [
8
- styles.container,
9
- props.isMe ? meStyles.container : otherStyles.container,
10
- props.style
11
- ],
12
- [props.style, props.isMe]
13
- )
14
- const textStyles = useMemo(
15
- () => [
16
- styles.text,
17
- props.isMe ? meStyles.text : otherStyles.text,
18
- props.style
19
- ],
20
- [props.style, props.isMe]
21
- )
22
- return (
23
- <View style={containerStyles} ref={props.bubbleRef}>
24
- <Text style={textStyles}>{props.text}</Text>
25
- </View>
26
- )
27
- }
28
-
29
- export default Bubble
30
-
31
- const styles = StyleSheet.create({
32
- container: {
33
- paddingHorizontal: 10,
34
- paddingVertical: 5,
35
- borderRadius: 10
36
- },
37
- text: {
38
- textAlign: 'left'
39
- }
40
- })
41
-
42
- const meStyles = StyleSheet.create({
43
- container: {
44
- backgroundColor: 'blue'
45
- },
46
- text: {
47
- color: 'white'
48
- }
49
- })
50
-
51
- const otherStyles = StyleSheet.create({
52
- container: {
53
- backgroundColor: 'lightgray'
54
- },
55
- text: {
56
- color: 'black'
57
- }
58
- })
@@ -1,34 +0,0 @@
1
- import React from 'react'
2
- import { TextInput, StyleSheet, View } from 'react-native'
3
- import { InputProps } from '../../types'
4
-
5
- const Input = (props: InputProps) => {
6
- return (
7
- <View style={[styles.container, props.containerStyle]}>
8
- <TextInput
9
- {...props.inputProps}
10
- placeholder={props.placeholderText || 'Type a new message...'}
11
- placeholderTextColor={props.placeholderColor || 'lightgray'}
12
- selectionColor={props.tintColor || 'blue'}
13
- onChangeText={props.onChangeText}
14
- value={props.text}
15
- style={[styles.input, props.style]}
16
- multiline
17
- ref={props.inputRef}
18
- />
19
- </View>
20
- )
21
- }
22
-
23
- export default Input
24
-
25
- const styles = StyleSheet.create({
26
- container: {
27
- flex: 1,
28
- flexDirection: 'row'
29
- },
30
- input: {
31
- flex: 1,
32
- padding: 10
33
- }
34
- })
@@ -1,37 +0,0 @@
1
- import React from 'react'
2
- import { Button, StyleSheet, TouchableOpacity } from 'react-native'
3
- import { Ionicons } from '@expo/vector-icons'
4
- import { SendButtonProps } from '../../types'
5
-
6
- export default (props: SendButtonProps) => {
7
- if (props.mode === 'hidden') return null
8
- if (props.mode === 'icon')
9
- return (
10
- <TouchableOpacity
11
- onPress={props.onSend}
12
- style={[styles.button, { backgroundColor: props.tintColor || 'blue' }]}
13
- >
14
- <Ionicons name="ios-arrow-round-up" size={size} color={'white'} />
15
- </TouchableOpacity>
16
- )
17
- return (
18
- <Button
19
- title="Send"
20
- onPress={props.onSend}
21
- color={props.tintColor || 'blue'}
22
- />
23
- )
24
- }
25
-
26
- const size = 20
27
-
28
- const styles = StyleSheet.create({
29
- button: {
30
- borderRadius: size,
31
- height: size * 1.5,
32
- width: size * 1.5,
33
- justifyContent: 'center',
34
- alignItems: 'center',
35
- padding: size / 2
36
- }
37
- })
@@ -1,131 +0,0 @@
1
- import React, { useState, useCallback, useMemo } from 'react'
2
- import uuid from 'uuid'
3
- import { View, StyleSheet } from 'react-native'
4
- import { ComposerProps, InputProps, SendButtonProps, ChatProps } from '../types'
5
- import Input from './Input'
6
- import { MessageMedia, NewMessageModel, MessageMediaWithUri } from '../../../classes/Message/types'
7
- import Send from './Send'
8
-
9
- const emptyMedia: Omit<MessageMedia, 'url'>[] = []
10
-
11
- export default React.memo((props: ComposerProps) => {
12
- // First, we set up a state manager for the composer's text.
13
- const [textState, setText] = useState(props.initialText || '')
14
- // if you pass a text prop, use that state instead
15
- const [text, onChangeText] = [
16
- props.text || textState,
17
- (props.text && props.onInputTextChanged) || setText
18
- ]
19
-
20
- const [mediaState, setMedia] = useState<MessageMediaWithUri[]>(emptyMedia)
21
- const [media, onChangeMedia] = [
22
- props.media || mediaState,
23
- (props.media && props.onChangeMedia) || setMedia
24
- ]
25
-
26
- const { textInputProps, renderTextInput } = props
27
- const renderInput = useCallback(() => {
28
- if (renderTextInput === null) return null
29
-
30
- const inputProps: InputProps = {
31
- inputProps: textInputProps,
32
- onChangeText,
33
- text,
34
- containerStyle: props.inputContainerStyle,
35
- placeholderColor: props.placeholderColor,
36
- placeholderText: props.placeholderText,
37
- style: props.inputStyle,
38
- tintColor: props.tintColor,
39
- inputRef: props.inputRef
40
- }
41
-
42
- if (renderTextInput) return renderTextInput(inputProps)
43
-
44
- return <Input {...inputProps} />
45
- }, [
46
- onChangeText,
47
- text,
48
- textInputProps,
49
- renderTextInput,
50
- props.inputContainerStyle,
51
- props.placeholderColor,
52
- props.placeholderText,
53
- props.inputStyle,
54
- props.tintColor,
55
- // TODO leave or take out?
56
- props.inputRef
57
- ])
58
-
59
- const { user } = props
60
- const messagesReadyToSend = useMemo(() => {
61
- const messages: NewMessageModel[] = []
62
- if (media.length) {
63
- ;(media as MessageMedia[]).forEach(item => {
64
- const message: NewMessageModel = {
65
- user,
66
- text: '',
67
- id: uuid.v4(),
68
- createdAt: new Date(),
69
- media: item
70
- }
71
- messages.push(message)
72
- })
73
- }
74
- if (text) {
75
- const message: NewMessageModel = {
76
- user,
77
- text: text && text.trim(),
78
- id: uuid.v4(),
79
- createdAt: new Date()
80
- }
81
- messages.push(message)
82
- }
83
- return messages
84
- }, [user, text, media])
85
-
86
- const { onSend } = props
87
- const send = useCallback(() => {
88
- if (messagesReadyToSend.length) {
89
- onChangeText('')
90
- onChangeMedia([])
91
- onSend(messagesReadyToSend)
92
- }
93
- }, [onChangeText, onChangeMedia, messagesReadyToSend, onSend])
94
-
95
- const { renderSendButton, sendButtonMode } = props
96
- const renderSend = useCallback(() => {
97
- if (renderSendButton === null) return null
98
-
99
- const mode: ChatProps['sendButtonMode'] = {
100
- empty: 'hidden',
101
- withText: 'icon',
102
- ...(sendButtonMode || {})
103
- }
104
- const sendProps: SendButtonProps = {
105
- onSend: send,
106
- text,
107
- media,
108
- user,
109
- mode: (text && text.trim ? mode.withText : mode.empty) || 'icon'
110
- }
111
- if (renderSendButton) return renderSendButton(sendProps)
112
-
113
- return <Send {...sendProps} />
114
- }, [send, text, user, media, renderSendButton, sendButtonMode])
115
-
116
- return (
117
- <View style={props.containerStyle}>
118
- <View style={styles.wrapper}>
119
- {renderInput()}
120
- {renderSend()}
121
- </View>
122
- </View>
123
- )
124
- })
125
-
126
- const styles = StyleSheet.create({
127
- container: {},
128
- wrapper: {
129
- flexDirection: 'row'
130
- }
131
- })
@@ -1,160 +0,0 @@
1
- import React, {
2
- useCallback,
3
- useRef,
4
- MutableRefObject,
5
- useMemo,
6
- FunctionComponent
7
- } from 'react'
8
- import { View, StyleSheet, Text } from 'react-native'
9
- import { MessageProps } from '../types'
10
- import { NewMessageModel } from '../../../classes/Message/types'
11
- import Bubble from '../Bubble'
12
- import { Avatar, Initials } from '../..'
13
- import { AvatarProps, InitialsProps } from '../../Inbox/types'
14
- import { getInitials } from '../../../helpers/getInitials'
15
-
16
- const Message = <Model extends NewMessageModel = NewMessageModel>(
17
- props: MessageProps<Model>
18
- ) => {
19
- const bubble = useRef<View>()
20
-
21
- const { renderFooter } = props
22
- const footer = useCallback(
23
- () => (renderFooter ? renderFooter({ id: props.id }) : null),
24
- [props.id, renderFooter]
25
- )
26
-
27
- const containerStyle = useMemo(() => {
28
- return [
29
- styles.container,
30
- props.isMe ? meStyles.container : otherStyles.container,
31
- props.messageContainerStyle
32
- ]
33
- }, [props.isMe, props.messageContainerStyle])
34
-
35
- const wrapperStyle = useMemo(() => {
36
- return [
37
- styles.wrapper,
38
- props.isMe ? meStyles.wrapper : otherStyles.wrapper,
39
- props.messageWrapperStyle
40
- ]
41
- }, [props.isMe, props.messageWrapperStyle])
42
-
43
- const maybeRenderName = useCallback(() => {
44
- return props.showName && props.name ? (
45
- <Text style={styles.name}>{props.name}</Text>
46
- ) : null
47
- }, [props.showName, props.name])
48
-
49
- const {
50
- renderAvatar,
51
- avatar,
52
- avatarImageProps,
53
- avatarSize,
54
- showAvatar,
55
- name,
56
- renderInitials,
57
- initialsBackgroundColor,
58
- initialsTextColor
59
- } = props
60
- const renderAvatarOrInitials = useCallback(() => {
61
- if (renderAvatar === null) return null
62
- // we make opacity 0 instead of hiding it to maintain the same width from the side
63
- const opacity = showAvatar === false ? 0 : 1
64
- const size = avatarSize || 40
65
-
66
- const Container: FunctionComponent<{}> = ({ children }) => (
67
- <View style={{ opacity }}>{children}</View>
68
- )
69
-
70
- if (avatar) {
71
- const avatarProps: AvatarProps = {
72
- avatar: avatar,
73
- imageProps: avatarImageProps,
74
- size
75
- }
76
- if (renderAvatar) return renderAvatar(avatarProps)
77
- return (
78
- <Container>
79
- <Avatar {...avatarProps} />
80
- </Container>
81
- )
82
- }
83
- const initialsProps: InitialsProps = {
84
- initials: getInitials(name),
85
- size,
86
- textColor: initialsTextColor,
87
- backgroundColor: initialsBackgroundColor || props.tintColor
88
- }
89
- if (renderInitials) return renderInitials(initialsProps)
90
- return (
91
- <Container>
92
- <Initials {...initialsProps} />
93
- </Container>
94
- )
95
- }, [
96
- avatar,
97
- avatarImageProps,
98
- avatarSize,
99
- renderAvatar,
100
- showAvatar,
101
- name,
102
- renderInitials,
103
- initialsBackgroundColor,
104
- initialsTextColor,
105
- props.tintColor
106
- ])
107
-
108
- return (
109
- <View style={containerStyle}>
110
- <View style={wrapperStyle}>
111
- {renderAvatarOrInitials()}
112
- <View>
113
- {maybeRenderName()}
114
- <Bubble
115
- text={props.text}
116
- isMe={props.isMe}
117
- style={props.bubbleStyle}
118
- textStyle={props.bubbleTextStyle}
119
- bubbleRef={bubble as MutableRefObject<View>}
120
- />
121
- </View>
122
- </View>
123
- {footer()}
124
- </View>
125
- )
126
- }
127
-
128
- export default React.memo(Message)
129
-
130
- const styles = StyleSheet.create({
131
- container: {
132
- marginTop: 1,
133
- flexDirection: 'row'
134
- },
135
- // wrapper is concerned with which side the avatar is on relative to the bubble
136
- wrapper: {
137
- flex: 1
138
- },
139
- name: {
140
- marginLeft: 5
141
- }
142
- })
143
-
144
- const meStyles = StyleSheet.create({
145
- container: {
146
- justifyContent: 'flex-end'
147
- },
148
- wrapper: {
149
- flexDirection: 'row-reverse'
150
- }
151
- })
152
-
153
- const otherStyles = StyleSheet.create({
154
- container: {
155
- justifyContent: 'flex-end'
156
- },
157
- wrapper: {
158
- flexDirection: 'row'
159
- }
160
- })
@@ -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,30 +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
- export default (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
- }
@@ -1,44 +0,0 @@
1
- import React from 'react'
2
- import { View, Text, StyleSheet } from 'react-native'
3
- import moment from 'moment'
4
- import { SystemMessageProps } from '../types'
5
-
6
- const SystemMessage = React.memo((props: SystemMessageProps) => {
7
- return (
8
- <View style={[styles.container, props.containerStyle]}>
9
- <Text style={styles.date}>
10
- {props.dateToStringFunc
11
- ? props.dateToStringFunc(props.createdAt)
12
- : moment(props.createdAt).calendar(undefined, {
13
- lastDay: '[Yesterday]',
14
- sameDay: 'LT',
15
- nextDay: '[Tomorrow at] LT',
16
- lastWeek: 'dddd',
17
- nextWeek: '[Next] dddd',
18
- sameElse: 'L'
19
- })}
20
- </Text>
21
- <Text style={styles.text}>{props.text}</Text>
22
- </View>
23
- )
24
- })
25
-
26
- export default SystemMessage
27
-
28
- const styles = StyleSheet.create({
29
- container: {
30
- paddingHorizontal: 10,
31
- paddingVertical: 5
32
- },
33
- date: {
34
- color: 'gray',
35
- textAlign: 'center',
36
- fontSize: 14
37
- },
38
- text: {
39
- color: 'gray',
40
- fontWeight: '500',
41
- textAlign: 'center',
42
- fontSize: 14
43
- }
44
- })