chat 1.0.8 → 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 -843
  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 -187
  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 -596
  261. package/src/components/Chat/types.ts +0 -913
  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 +0,0 @@
1
- {"version":3,"sources":["index.tsx"],"names":["React","useMemo","useCallback","View","Text","StyleSheet","LinearGradient","Media","isValidColor","color","test","Bubble","props","containerStyles","styles","container","isMe","meStyles","otherStyles","style","textStyles","textColor","text","textStyle","backgroundColor","Array","isArray","invalidColors","from","Set","filter","length","console","warn","propsRenderMedia","renderMedia","mediaContentType","media","url","mediaUrl","uri","mediaUri","height","mediaHeight","width","mediaWidth","contentType","propsRenderText","renderText","bubbleRef","gradient","memo","create","maxWidth","borderRadius","overflow","textAlign","fontSize","paddingHorizontal","paddingVertical","flex","marginLeft","marginRight"],"mappings":"uOAAA,MAAOA,CAAAA,KAAP,EAAgBC,OAAhB,CAA4CC,WAA5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GAAMG,CAAAA,MAAM,CAAGT,UAAU,CAAC+C,MAAX,CAAkB,CAChCrC,SAAS,CAAE,CACVsC,QAAQ,CAAE,KADA,CAEVC,YAAY,CAAE,EAFJ,CAGVC,QAAQ,CAAE,QAHA,CADqB,CAMhCjC,IAAI,CAAE,CACLkC,SAAS,CAAE,MADN,CAELC,QAAQ,CAAE,EAFL,CAGLC,iBAAiB,CAAE,EAHd,CAILC,eAAe,CAAE,EAJZ,CAN0B,CAYhCT,QAAQ,CAAE,CACTU,IAAI,CAAE,CADG,CAZsB,CAAlB,CAAf,CAiBA,GAAM3C,CAAAA,QAAQ,CAAGZ,UAAU,CAAC+C,MAAX,CAAkB,CAClCrC,SAAS,CAAE,CAEV8C,UAAU,CAAE,CAFF,CADuB,CAKlCvC,IAAI,CAAE,CACLb,KAAK,CAAE,OADF,CAL4B,CAAlB,CAAjB,CAUA,GAAMS,CAAAA,WAAW,CAAGb,UAAU,CAAC+C,MAAX,CAAkB,CACrCrC,SAAS,CAAE,CAEV+C,WAAW,CAAE,CAFH,CAD0B,CAKrCxC,IAAI,CAAE,CACLb,KAAK,CAAE,OADF,CAL+B,CAAlB,CAApB","sourcesContent":["import React, { useMemo, FunctionComponent, useCallback } from 'react'\nimport { BubbleProps } from '../types'\nimport { View, Text, StyleSheet } from 'react-native'\nimport { LinearGradient } from 'expo-linear-gradient'\nimport { MessageMedia } from '../../../classes/Message/types'\nimport Media from '../Media'\n\nconst isValidColor = (color: string) =>\n\t/(#(?:[0-9a-f]{ 2 }){ 2,4 }|(#[0-9a-f]{3})|(rgb|hsl)a?\\((-?\\d+%?[,\\s]+){2,3}\\s*[d\\.]+%?\\)|\\b(transparent|black|silver|gray|whitesmoke|maroon|red|purple|fuchsia|green|lime|olivedrab|yellow|navy|blue|teal|aquamarine|orange|aliceblue|antiquewhite|aqua|azure|beige|bisque|blanchedalmond|blueviolet|brown|burlywood|cadetblue|chartreuse|chocolate|coral|cornflowerblue|cornsilk|crimson|darkblue|darkcyan|darkgoldenrod|darkgray|darkgreen|darkgrey|darkkhaki|darkmagenta|darkolivegreen|darkorange|darkorchid|darkred|darksalmon|darkseagreen|darkslateblue|darkslategray|darkslategrey|darkturquoise|darkviolet|deeppink|deepskyblue|dimgray|dimgrey|dodgerblue|firebrick|floralwhite|forestgreen|gainsboro|ghostwhite|goldenrod|gold|greenyellow|grey|honeydew|hotpink|indianred|indigo|ivory|khaki|lavenderblush|lavender|lawngreen|lemonchiffon|lightblue|lightcoral|lightcyan|lightgoldenrodyellow|lightgray|lightgreen|lightgrey|lightpink|lightsalmon|lightseagreen|lightskyblue|lightslategray|lightslategrey|lightsteelblue|lightyellow|limegreen|linen|mediumaquamarine|mediumblue|mediumorchid|mediumpurple|mediumseagreen|mediumslateblue|mediumspringgreen|mediumturquoise|mediumvioletred|midnightblue|mintcream|mistyrose|moccasin|navajowhite|oldlace|olive|orangered|orchid|palegoldenrod|palegreen|paleturquoise|palevioletred|papayawhip|peachpuff|peru|pink|plum|powderblue|rosybrown|royalblue|saddlebrown|salmon|sandybrown|seagreen|seashell|sienna|skyblue|slateblue|slategray|slategrey|snow|springgreen|steelblue|tan|thistle|tomato|turquoise|violet|wheat|white|yellowgreen|rebeccapurple)\\b)/i.test(\n\t\tcolor\n\t)\n\nconst Bubble: FunctionComponent<BubbleProps> = props => {\n\tconst containerStyles = useMemo(() => {\n\t\treturn [\n\t\t\tstyles.container,\n\t\t\tprops.isMe ? meStyles.container : otherStyles.container,\n\t\t\tprops.style\n\t\t]\n\t}, [props.style, props.isMe])\n\n\tconst textStyles = useMemo(() => {\n\t\tconst color = (props.textColor && { color: props.textColor }) || {}\n\t\treturn [\n\t\t\tstyles.text,\n\t\t\tprops.isMe ? meStyles.text : otherStyles.text,\n\t\t\tcolor,\n\t\t\tprops.textStyle\n\t\t]\n\t}, [props.textStyle, props.isMe, props.textColor])\n\n\tconst backgroundColor = useMemo(() => {\n\t\tlet color: string[] = []\n\t\tif (Array.isArray(props.backgroundColor)) {\n\t\t\tcolor = props.backgroundColor\n\t\t}\n\t\tif (typeof props.backgroundColor === 'string') {\n\t\t\tcolor = [props.backgroundColor, props.backgroundColor]\n\t\t}\n\t\tconst invalidColors = [\n\t\t\t...Array.from(new Set(color.filter(color => !isValidColor(color))))\n\t\t]\n\t\tif (invalidColors.length) {\n\t\t\tconsole.warn(\n\t\t\t\t`🍏 Juice warning: The background color value you gave to the Bubble component doesn't seem to be valid. Each color should be a HEX color or CSS color string, matching this format: #abc123, but instead, it got these: ${invalidColors}, which don't match the format. If you gave a valid CSS color and it works, you can ignore this.`\n\t\t\t)\n\t\t}\n\t\treturn (\n\t\t\tcolor || (props.isMe ? ['#7B16FF', '#7114EA'] : ['#f1f7f8', '#f8f8f8'])\n\t\t)\n\t}, [props.backgroundColor, props.isMe])\n\n\tconst { renderMedia: propsRenderMedia } = props\n\tconst renderMedia = useCallback(() => {\n\t\tif (propsRenderMedia === null) return null\n\n\t\tif (!props.mediaContentType) return null\n\n\t\tconst media: MessageMedia = {\n\t\t\turl: props.mediaUrl || '',\n\t\t\turi: props.mediaUri,\n\t\t\theight: props.mediaHeight || 0,\n\t\t\twidth: props.mediaWidth || 0,\n\t\t\tcontentType: props.mediaContentType\n\t\t}\n\t\tif (propsRenderMedia) return propsRenderMedia({ media })\n\n\t\treturn <Media {...media} />\n\t}, [\n\t\tprops.mediaUrl,\n\t\tprops.mediaUri,\n\t\tprops.mediaHeight,\n\t\tprops.mediaWidth,\n\t\tprops.mediaContentType,\n\t\tpropsRenderMedia\n\t])\n\n\tconst { text, renderText: propsRenderText } = props\n\tconst renderText = useCallback(() => {\n\t\tif (text) {\n\t\t\tif (propsRenderText) return propsRenderText({ style: textStyles, text })\n\t\t\treturn <Text style={textStyles}>{text}</Text>\n\t\t}\n\t\treturn null\n\t}, [textStyles, text, propsRenderText])\n\n\treturn (\n\t\t<View style={containerStyles} ref={props.bubbleRef}>\n\t\t\t<LinearGradient\n\t\t\t\tcolors={backgroundColor}\n\t\t\t\tstart={[0.1, 0.1]}\n\t\t\t\tend={[0.9, 0.9]}\n\t\t\t\tstyle={styles.gradient}\n\t\t\t>\n\t\t\t\t{renderMedia()}\n\t\t\t\t{renderText()}\n\t\t\t</LinearGradient>\n\t\t</View>\n\t)\n}\n\nexport default React.memo(Bubble)\n\nconst styles = StyleSheet.create({\n\tcontainer: {\n\t\tmaxWidth: '80%',\n\t\tborderRadius: 20,\n\t\toverflow: 'hidden'\n\t},\n\ttext: {\n\t\ttextAlign: 'left',\n\t\tfontSize: 16,\n\t\tpaddingHorizontal: 12,\n\t\tpaddingVertical: 10\n\t},\n\tgradient: {\n\t\tflex: 1\n\t}\n})\n\nconst meStyles = StyleSheet.create({\n\tcontainer: {\n\t\t// backgroundColor: 'rgb(123, 22, 255)',\n\t\tmarginLeft: 5\n\t},\n\ttext: {\n\t\tcolor: 'white'\n\t}\n})\n\nconst otherStyles = StyleSheet.create({\n\tcontainer: {\n\t\t// backgroundColor: 'lightgray',\n\t\tmarginRight: 5\n\t},\n\ttext: {\n\t\tcolor: 'black'\n\t}\n})\n"]}
@@ -1,2 +0,0 @@
1
- import _extends from"@babel/runtime/helpers/extends";var _jsxFileName="/Users/Fernando/Developer/Learning Babel/usechat/src/components/Chat/Composer/Input/index.tsx";import React from'react';import{TextInput,StyleSheet,View}from'react-native';var Input=function Input(props){return React.createElement(View,{style:[styles.container,props.containerStyle],__source:{fileName:_jsxFileName,lineNumber:7}},React.createElement(TextInput,_extends({},props.inputProps,{placeholder:props.placeholderText||'Type a new message...',placeholderTextColor:props.placeholderColor||'lightgray',selectionColor:props.tintColor||'blue',onChangeText:props.onChangeText,value:props.text,style:[styles.input,props.style],multiline:true,ref:props.inputRef,returnKeyLabel:props.sendOnKeyboardReturn?'Send':undefined,returnKeyType:props.sendOnKeyboardReturn?'send':undefined,onSubmitEditing:props.onSubmitEditing,__source:{fileName:_jsxFileName,lineNumber:8}})));};Input.displayName='Juice.Input';export default React.memo(Input);var styles=StyleSheet.create({container:{flex:1,flexDirection:'row',marginHorizontal:10,borderRadius:20,borderWidth:1,borderColor:'lightgray'},input:{flex:1,padding:10,paddingTop:10,fontSize:16}});
2
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["index.tsx"],"names":["React","TextInput","StyleSheet","View","Input","props","styles","container","containerStyle","inputProps","placeholderText","placeholderColor","tintColor","onChangeText","text","input","style","inputRef","sendOnKeyboardReturn","undefined","onSubmitEditing","displayName","memo","create","flex","flexDirection","marginHorizontal","borderRadius","borderWidth","borderColor","padding","paddingTop","fontSize"],"mappings":"sKAAA,MAAOA,CAAAA,KAAP,KAAkB,OAAlB,CACA,OAASC,SAAT,CAAoBC,UAApB,CAAgCC,IAAhC,KAA4C,cAA5C,CAGA,GAAMC,CAAAA,KAAK,CAAG,QAARA,CAAAA,KAAQ,CAACC,KAAD,CAAuB,CACpC,MACC,qBAAC,IAAD,EAAM,KAAK,CAAE,CAACC,MAAM,CAACC,SAAR,CAAmBF,KAAK,CAACG,cAAzB,CAAb,gDACC,oBAAC,SAAD,aACKH,KAAK,CAACI,UADX,EAEC,WAAW,CAAEJ,KAAK,CAACK,eAAN,EAAyB,uBAFvC,CAGC,oBAAoB,CAAEL,KAAK,CAACM,gBAAN,EAA0B,WAHjD,CAIC,cAAc,CAAEN,KAAK,CAACO,SAAN,EAAmB,MAJpC,CAKC,YAAY,CAAEP,KAAK,CAACQ,YALrB,CAMC,KAAK,CAAER,KAAK,CAACS,IANd,CAOC,KAAK,CAAE,CAACR,MAAM,CAACS,KAAR,CAAeV,KAAK,CAACW,KAArB,CAPR,CAQC,SAAS,KARV,CASC,GAAG,CAAEX,KAAK,CAACY,QATZ,CAUC,cAAc,CAAEZ,KAAK,CAACa,oBAAN,CAA6B,MAA7B,CAAsCC,SAVvD,CAWC,aAAa,CAAEd,KAAK,CAACa,oBAAN,CAA6B,MAA7B,CAAsCC,SAXtD,CAYC,eAAe,CAAEd,KAAK,CAACe,eAZxB,iDADD,CADD,CAkBA,CAnBD,CAqBAhB,KAAK,CAACiB,WAAN,CAAoB,aAApB,CAEA,cAAerB,CAAAA,KAAK,CAACsB,IAAN,CAAWlB,KAAX,CAAf,CAEA,GAAME,CAAAA,MAAM,CAAGJ,UAAU,CAACqB,MAAX,CAAkB,CAChChB,SAAS,CAAE,CACViB,IAAI,CAAE,CADI,CAEVC,aAAa,CAAE,KAFL,CAGVC,gBAAgB,CAAE,EAHR,CAIVC,YAAY,CAAE,EAJJ,CAKVC,WAAW,CAAE,CALH,CAMVC,WAAW,CAAE,WANH,CADqB,CAShCd,KAAK,CAAE,CACNS,IAAI,CAAE,CADA,CAENM,OAAO,CAAE,EAFH,CAGNC,UAAU,CAAE,EAHN,CAINC,QAAQ,CAAE,EAJJ,CATyB,CAAlB,CAAf","sourcesContent":["import React from 'react'\nimport { TextInput, StyleSheet, View } from 'react-native'\nimport { InputProps } from '../../types'\n\nconst Input = (props: InputProps) => {\n\treturn (\n\t\t<View style={[styles.container, props.containerStyle]}>\n\t\t\t<TextInput\n\t\t\t\t{...props.inputProps}\n\t\t\t\tplaceholder={props.placeholderText || 'Type a new message...'}\n\t\t\t\tplaceholderTextColor={props.placeholderColor || 'lightgray'}\n\t\t\t\tselectionColor={props.tintColor || 'blue'}\n\t\t\t\tonChangeText={props.onChangeText}\n\t\t\t\tvalue={props.text}\n\t\t\t\tstyle={[styles.input, props.style]}\n\t\t\t\tmultiline\n\t\t\t\tref={props.inputRef}\n\t\t\t\treturnKeyLabel={props.sendOnKeyboardReturn ? 'Send' : undefined}\n\t\t\t\treturnKeyType={props.sendOnKeyboardReturn ? 'send' : undefined}\n\t\t\t\tonSubmitEditing={props.onSubmitEditing}\n\t\t\t/>\n\t\t</View>\n\t)\n}\n\nInput.displayName = 'Juice.Input'\n\nexport default React.memo(Input)\n\nconst styles = StyleSheet.create({\n\tcontainer: {\n\t\tflex: 1,\n\t\tflexDirection: 'row',\n\t\tmarginHorizontal: 10,\n\t\tborderRadius: 20,\n\t\tborderWidth: 1,\n\t\tborderColor: 'lightgray'\n\t},\n\tinput: {\n\t\tflex: 1,\n\t\tpadding: 10,\n\t\tpaddingTop: 10,\n\t\tfontSize: 16\n\t}\n})\n"]}
@@ -1,2 +0,0 @@
1
- import _defineProperty from"@babel/runtime/helpers/defineProperty";var _jsxFileName="/Users/Fernando/Developer/Learning Babel/usechat/src/components/Chat/Composer/Send/index.tsx";function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);if(enumerableOnly)symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable;});keys.push.apply(keys,symbols);}return keys;}function _objectSpread(target){for(var i=1;i<arguments.length;i++){var source=arguments[i]!=null?arguments[i]:{};if(i%2){ownKeys(Object(source),true).forEach(function(key){_defineProperty(target,key,source[key]);});}else if(Object.getOwnPropertyDescriptors){Object.defineProperties(target,Object.getOwnPropertyDescriptors(source));}else{ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key));});}}return target;}import React,{useCallback}from'react';import{Button,StyleSheet,TouchableOpacity,View}from'react-native';import{Ionicons}from'@expo/vector-icons';var Send=function Send(props){if(props.mode==='hidden')return null;var containerStyle=props.containerStyle;var Container=useCallback(function(_ref){var children=_ref.children;var style=_objectSpread({},styles.container,{},containerStyle||{});return React.createElement(View,{style:style,__source:{fileName:_jsxFileName,lineNumber:15}},children);},[containerStyle]);if(props.mode==='icon')return React.createElement(Container,{__source:{fileName:_jsxFileName,lineNumber:21}},React.createElement(TouchableOpacity,{onPress:props.onSend,style:[styles.button,{backgroundColor:props.tintColor||'blue'}],__source:{fileName:_jsxFileName,lineNumber:22}},React.createElement(Ionicons,{name:"ios-arrow-round-up",size:size*1.5,color:'white',__source:{fileName:_jsxFileName,lineNumber:23}})));return React.createElement(Container,{__source:{fileName:_jsxFileName,lineNumber:28}},React.createElement(Button,{title:"Send",onPress:props.onSend,color:props.tintColor||'blue',__source:{fileName:_jsxFileName,lineNumber:29}}));};export default React.memo(Send);var size=20;var styles=StyleSheet.create({container:{paddingRight:5,paddingBottom:5},button:{borderRadius:size,height:size*1.5,width:size*1.5,justifyContent:'center',alignItems:'center'}});
2
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["index.tsx"],"names":["React","useCallback","Button","StyleSheet","TouchableOpacity","View","Ionicons","Send","props","mode","containerStyle","Container","children","style","styles","container","onSend","button","backgroundColor","tintColor","size","memo","create","paddingRight","paddingBottom","borderRadius","height","width","justifyContent","alignItems"],"mappings":"+8BAAA,MAAOA,CAAAA,KAAP,EAAgBC,WAAhB,KAAmC,OAAnC,CACA,OAASC,MAAT,CAAiBC,UAAjB,CAA6BC,gBAA7B,CAA+CC,IAA/C,KAA2D,cAA3D,CACA,OAASC,QAAT,KAAyB,oBAAzB,CAGA,GAAMC,CAAAA,IAAI,CAAG,QAAPA,CAAAA,IAAO,CAACC,KAAD,CAA4B,CACxC,GAAIA,KAAK,CAACC,IAAN,GAAe,QAAnB,CAA6B,MAAO,KAAP,CADW,GAEhCC,CAAAA,cAFgC,CAEbF,KAFa,CAEhCE,cAFgC,CAGxC,GAAMC,CAAAA,SAAS,CAAGV,WAAW,CAC5B,cAAkB,IAAfW,CAAAA,QAAe,MAAfA,QAAe,CACjB,GAAMC,CAAAA,KAAK,kBACPC,MAAM,CAACC,SADA,IAENL,cAAc,EAAI,EAFZ,CAAX,CAIA,MAAO,qBAAC,IAAD,EAAM,KAAK,CAAEG,KAAb,iDAAqBD,QAArB,CAAP,CACA,CAP2B,CAQ5B,CAACF,cAAD,CAR4B,CAA7B,CAUA,GAAIF,KAAK,CAACC,IAAN,GAAe,MAAnB,CACC,MACC,qBAAC,SAAD,kDACC,oBAAC,gBAAD,EAAkB,OAAO,CAAED,KAAK,CAACQ,MAAjC,CAAyC,KAAK,CAAE,CAACF,MAAM,CAACG,MAAR,CAAgB,CAAEC,eAAe,CAAEV,KAAK,CAACW,SAAN,EAAmB,MAAtC,CAAhB,CAAhD,iDACC,oBAAC,QAAD,EAAU,IAAI,CAAC,oBAAf,CAAoC,IAAI,CAAEC,IAAI,CAAG,GAAjD,CAAsD,KAAK,CAAE,OAA7D,iDADD,CADD,CADD,CAOD,MACC,qBAAC,SAAD,kDACC,oBAAC,MAAD,EAAQ,KAAK,CAAC,MAAd,CAAqB,OAAO,CAAEZ,KAAK,CAACQ,MAApC,CAA4C,KAAK,CAAER,KAAK,CAACW,SAAN,EAAmB,MAAtE,iDADD,CADD,CAKA,CA1BD,CA4BA,cAAenB,CAAAA,KAAK,CAACqB,IAAN,CAAWd,IAAX,CAAf,CAEA,GAAMa,CAAAA,IAAI,CAAG,EAAb,CAEA,GAAMN,CAAAA,MAAM,CAAGX,UAAU,CAACmB,MAAX,CAAkB,CAChCP,SAAS,CAAE,CACVQ,YAAY,CAAE,CADJ,CAEVC,aAAa,CAAE,CAFL,CADqB,CAKhCP,MAAM,CAAE,CACPQ,YAAY,CAAEL,IADP,CAEPM,MAAM,CAAEN,IAAI,CAAG,GAFR,CAGPO,KAAK,CAAEP,IAAI,CAAG,GAHP,CAIPQ,cAAc,CAAE,QAJT,CAKPC,UAAU,CAAE,QALL,CALwB,CAAlB,CAAf","sourcesContent":["import React, { useCallback } from 'react'\nimport { Button, StyleSheet, TouchableOpacity, View } from 'react-native'\nimport { Ionicons } from '@expo/vector-icons'\nimport { SendButtonProps } from '../../types'\n\nconst Send = (props: SendButtonProps) => {\n\tif (props.mode === 'hidden') return null\n\tconst { containerStyle } = props\n\tconst Container = useCallback(\n\t\t({ children }) => {\n\t\t\tconst style = {\n\t\t\t\t...styles.container,\n\t\t\t\t...(containerStyle || {}),\n\t\t\t}\n\t\t\treturn <View style={style}>{children}</View>\n\t\t},\n\t\t[containerStyle],\n\t)\n\tif (props.mode === 'icon')\n\t\treturn (\n\t\t\t<Container>\n\t\t\t\t<TouchableOpacity onPress={props.onSend} style={[styles.button, { backgroundColor: props.tintColor || 'blue' }]}>\n\t\t\t\t\t<Ionicons name=\"ios-arrow-round-up\" size={size * 1.5} color={'white'} />\n\t\t\t\t</TouchableOpacity>\n\t\t\t</Container>\n\t\t)\n\treturn (\n\t\t<Container>\n\t\t\t<Button title=\"Send\" onPress={props.onSend} color={props.tintColor || 'blue'} />\n\t\t</Container>\n\t)\n}\n\nexport default React.memo(Send)\n\nconst size = 20\n\nconst styles = StyleSheet.create({\n\tcontainer: {\n\t\tpaddingRight: 5,\n\t\tpaddingBottom: 5,\n\t},\n\tbutton: {\n\t\tborderRadius: size,\n\t\theight: size * 1.5,\n\t\twidth: size * 1.5,\n\t\tjustifyContent: 'center',\n\t\talignItems: 'center',\n\t\t// padding: size / 2\n\t},\n})\n"]}
@@ -1,2 +0,0 @@
1
- import _extends from"@babel/runtime/helpers/extends";import _slicedToArray from"@babel/runtime/helpers/slicedToArray";var _jsxFileName="/Users/Fernando/Developer/Learning Babel/usechat/src/components/Chat/Composer/index.tsx";import React,{useState,useCallback,useMemo,useEffect}from'react';import uuid from'uuid';import{View,StyleSheet,Keyboard}from'react-native';import{isIphoneX,getBottomSpace}from'react-native-iphone-x-helper';import Input from'./Input';import Send from'./Send';var Composer=function Composer(props){var _ref2;var _useState=useState(props.initialText||''),_useState2=_slicedToArray(_useState,2),textState=_useState2[0],setText=_useState2[1];var _useMemo=useMemo(function(){return[props.text!==undefined?props.text:textState,props.text!==undefined?props.onInputTextChanged:setText];},[props.text,textState,props.onInputTextChanged]),_useMemo2=_slicedToArray(_useMemo,2),text=_useMemo2[0],onChangeText=_useMemo2[1];var _useState3=useState([]),_useState4=_slicedToArray(_useState3,2),mediaState=_useState4[0],setMedia=_useState4[1];var _ref=[props.media||mediaState,props.media&&props.onChangeMedia||setMedia],media=_ref[0],onChangeMedia=_ref[1];var _useState5=useState(false),_useState6=_slicedToArray(_useState5,2),keyboardOpen=_useState6[0],setKeyboardOpen=_useState6[1];useEffect(function(){var show=function show(){setKeyboardOpen(true);};var hide=function hide(){setKeyboardOpen(false);};Keyboard.addListener('keyboardWillShow',show);Keyboard.addListener('keyboardWillHide',hide);return function(){Keyboard.removeListener('keyboardWillShow',show);Keyboard.removeListener('keyboardWillHide',hide);};},[]);var user=props.user;var messagesReadyToSend=useMemo(function(){var messages=[];if(media&&media.length){;media.forEach(function(item){var message={user:user,text:'',id:uuid.v4(),createdAt:new Date(),media:item};messages.push(message);});}if(text){var message={user:user,text:text&&text.trim(),id:uuid.v4(),createdAt:new Date()};messages.push(message);}return messages;},[user,text,media]);var onSend=props.onSend;var send=useCallback(function(){if(messagesReadyToSend.length){if(onChangeText)onChangeText('');if(onChangeMedia)onChangeMedia([]);onSend(messagesReadyToSend);}},[onChangeText,onChangeMedia,messagesReadyToSend,onSend]);var textInputProps=props.textInputProps,renderTextInput=props.renderTextInput;var renderInput=useCallback(function(){if(renderTextInput===null)return null;var onSubmitEditing=function onSubmitEditing(){if(props.sendOnKeyboardReturn)send();};var inputProps={inputProps:textInputProps,onChangeText:onChangeText,text:text,containerStyle:props.inputContainerStyle,placeholderColor:props.placeholderColor,placeholderText:props.placeholderText,style:props.inputStyle,tintColor:props.tintColor,inputRef:props.inputRef,sendOnKeyboardReturn:props.sendOnKeyboardReturn,onSubmitEditing:onSubmitEditing};if(renderTextInput)return renderTextInput(inputProps);return React.createElement(Input,_extends({},inputProps,{__source:{fileName:_jsxFileName,lineNumber:107}}));},[onChangeText,text,textInputProps,renderTextInput,props.inputContainerStyle,props.placeholderColor,props.placeholderText,props.inputStyle,props.tintColor,props.inputRef,props.sendOnKeyboardReturn,send]);var renderSendButton=props.renderSendButton;var sendButtonMode=(_ref2=props.sendButtonMode==null?void 0:props.sendButtonMode({hasText:!!(text&&text.trim())}))!=null?_ref2:'icon';var renderSend=useCallback(function(){if(renderSendButton===null)return null;var sendProps={onSend:send,text:text,media:media,user:user,mode:sendButtonMode,containerStyle:props.sendButtonContainerStyle,tintColor:props.tintColor};if(renderSendButton)return renderSendButton(sendProps);return React.createElement(Send,_extends({},sendProps,{__source:{fileName:_jsxFileName,lineNumber:147}}));},[send,text,user,media,renderSendButton,sendButtonMode,props.sendButtonContainerStyle,props.tintColor]);var containerStyle=useMemo(function(){var paddingBottom=keyboardOpen&&isIphoneX()?10:getBottomSpace();return[styles.container,{paddingBottom:paddingBottom},props.containerStyle];},[props.containerStyle,keyboardOpen]);return React.createElement(View,{style:[containerStyle],__source:{fileName:_jsxFileName,lineNumber:165}},React.createElement(View,{style:styles.wrapper,__source:{fileName:_jsxFileName,lineNumber:166}},renderInput(),renderSend()));};Composer.displayName='Juice.Composer';export default React.memo(Composer);var styles=StyleSheet.create({container:{paddingBottom:10,paddingTop:5},wrapper:{flexDirection:'row',alignItems:'flex-end'}});
2
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["index.tsx"],"names":["React","useState","useCallback","useMemo","useEffect","uuid","View","StyleSheet","Keyboard","isIphoneX","getBottomSpace","Input","Send","Composer","props","initialText","textState","setText","text","undefined","onInputTextChanged","onChangeText","mediaState","setMedia","media","onChangeMedia","keyboardOpen","setKeyboardOpen","show","hide","addListener","removeListener","user","messagesReadyToSend","messages","length","forEach","item","message","id","v4","createdAt","Date","push","trim","onSend","send","textInputProps","renderTextInput","renderInput","onSubmitEditing","sendOnKeyboardReturn","inputProps","containerStyle","inputContainerStyle","placeholderColor","placeholderText","style","inputStyle","tintColor","inputRef","renderSendButton","sendButtonMode","hasText","renderSend","sendProps","mode","sendButtonContainerStyle","paddingBottom","styles","container","wrapper","displayName","memo","create","paddingTop","flexDirection","alignItems"],"mappings":"iOAAA,MAAOA,CAAAA,KAAP,EAAgBC,QAAhB,CAA0BC,WAA1B,CAAuCC,OAAvC,CAAgDC,SAAhD,KAAiE,OAAjE,CACA,MAAOC,CAAAA,IAAP,KAAiB,MAAjB,CACA,OAASC,IAAT,CAAeC,UAAf,CAA2BC,QAA3B,KAA2C,cAA3C,CACA,OAASC,SAAT,CAAoBC,cAApB,KAA0C,8BAA1C,CAEA,MAAOC,CAAAA,KA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AAA,cAAc,CAAGlD,OAAO,CAAC,UAAM,CACpC,GAAMiE,CAAAA,aAAa,CAAG1C,YAAY,EAAIjB,SAAS,EAAzB,CAA8B,EAA9B,CAAmCC,cAAc,EAAvE,CACA,MAAO,CAAC2D,MAAM,CAACC,SAAR,CAAmB,CAAEF,aAAa,CAAbA,aAAF,CAAnB,CAAsCtD,KAAK,CAACuC,cAA5C,CAAP,CACA,CAH6B,CAG3B,CAACvC,KAAK,CAACuC,cAAP,CAAuB3B,YAAvB,CAH2B,CAA9B,CAKA,MACC,qBAAC,IAAD,EAAM,KAAK,CAAE,CAAC2B,cAAD,CAAb,kDACC,oBAAC,IAAD,EAAM,KAAK,CAAEgB,MAAM,CAACE,OAApB,kDACEtB,WAAW,EADb,CAEEe,UAAU,EAFZ,CADD,CADD,CAQA,CAhKD,CAkKAnD,QAAQ,CAAC2D,WAAT,CAAuB,gBAAvB,CAEA,cAAexE,CAAAA,KAAK,CAACyE,IAAN,CAAW5D,QAAX,CAAf,CAEA,GAAMwD,CAAAA,MAAM,CAAG9D,UAAU,CAACmE,MAAX,CAAkB,CAChCJ,SAAS,CAAE,CACVF,aAAa,CAAE,EADL,CAEVO,UAAU,CAAE,CAFF,CADqB,CAKhCJ,OAAO,CAAE,CACRK,aAAa,CAAE,KADP,CAERC,UAAU,CAAE,UAFJ,CALuB,CAAlB,CAAf","sourcesContent":["import React, { useState, useCallback, useMemo, useEffect } from 'react'\nimport uuid from 'uuid'\nimport { View, StyleSheet, Keyboard } from 'react-native'\nimport { isIphoneX, getBottomSpace } from 'react-native-iphone-x-helper'\nimport { ComposerProps, InputProps, SendButtonProps } from '../types'\nimport Input from './Input'\nimport Send from './Send'\nimport { MessageMedia, NewMessageModel } from '../../../classes/Message/types'\n\n// const emptyMedia: ComposerProps['media'][] = []\n\nconst Composer = (props: ComposerProps) => {\n\t// First, we set up a state manager for the composer's text.\n\tconst [textState, setText] = useState(props.initialText || '')\n\t// if you pass a text prop, use that state instead\n\tconst [text, onChangeText] = useMemo(\n\t\t() => [\n\t\t\tprops.text !== undefined ? props.text : textState,\n\t\t\tprops.text !== undefined ? props.onInputTextChanged : setText,\n\t\t],\n\t\t[props.text, textState, props.onInputTextChanged]\n\t)\n\n\tconst [mediaState, setMedia] = useState<ComposerProps['media'][]>([])\n\tconst [media, onChangeMedia] = [\n\t\tprops.media || mediaState,\n\t\t(props.media && props.onChangeMedia) || setMedia,\n\t]\n\n\t// track whether or not the keyboard is open to style the bottom based on where or not you're on an iPhone X\n\tconst [keyboardOpen, setKeyboardOpen] = useState(false)\n\tuseEffect(() => {\n\t\tconst show = () => {\n\t\t\tsetKeyboardOpen(true)\n\t\t}\n\t\tconst hide = () => {\n\t\t\tsetKeyboardOpen(false)\n\t\t}\n\t\tKeyboard.addListener('keyboardWillShow', show)\n\t\tKeyboard.addListener('keyboardWillHide', hide)\n\t\treturn () => {\n\t\t\tKeyboard.removeListener('keyboardWillShow', show)\n\t\t\tKeyboard.removeListener('keyboardWillHide', hide)\n\t\t}\n\t}, [])\n\n\tconst { user } = props\n\tconst messagesReadyToSend = useMemo(() => {\n\t\tconst messages: NewMessageModel[] = []\n\t\tif (media && media.length) {\n\t\t\t;(media as MessageMedia[]).forEach((item: MessageMedia) => {\n\t\t\t\tconst message: NewMessageModel = {\n\t\t\t\t\tuser,\n\t\t\t\t\ttext: '',\n\t\t\t\t\tid: uuid.v4(),\n\t\t\t\t\tcreatedAt: new Date(),\n\t\t\t\t\tmedia: item,\n\t\t\t\t}\n\t\t\t\tmessages.push(message)\n\t\t\t})\n\t\t}\n\t\tif (text) {\n\t\t\tconst message: NewMessageModel = {\n\t\t\t\tuser,\n\t\t\t\ttext: text && text.trim(),\n\t\t\t\tid: uuid.v4(),\n\t\t\t\tcreatedAt: new Date(),\n\t\t\t}\n\t\t\tmessages.push(message)\n\t\t}\n\t\treturn messages\n\t}, [user, text, media])\n\n\tconst { onSend } = props\n\tconst send = useCallback(() => {\n\t\tif (messagesReadyToSend.length) {\n\t\t\tif (onChangeText) onChangeText('')\n\t\t\tif (onChangeMedia) onChangeMedia([])\n\t\t\tonSend(messagesReadyToSend)\n\t\t}\n\t}, [onChangeText, onChangeMedia, messagesReadyToSend, onSend])\n\n\tconst { textInputProps, renderTextInput } = props\n\tconst renderInput = useCallback(() => {\n\t\tif (renderTextInput === null) return null\n\n\t\tconst onSubmitEditing: InputProps['onSubmitEditing'] = () => {\n\t\t\tif (props.sendOnKeyboardReturn) send()\n\t\t}\n\n\t\tconst inputProps: InputProps = {\n\t\t\tinputProps: textInputProps,\n\t\t\tonChangeText,\n\t\t\ttext,\n\t\t\tcontainerStyle: props.inputContainerStyle,\n\t\t\tplaceholderColor: props.placeholderColor,\n\t\t\tplaceholderText: props.placeholderText,\n\t\t\tstyle: props.inputStyle,\n\t\t\ttintColor: props.tintColor,\n\t\t\tinputRef: props.inputRef,\n\t\t\tsendOnKeyboardReturn: props.sendOnKeyboardReturn,\n\t\t\tonSubmitEditing,\n\t\t}\n\n\t\tif (renderTextInput) return renderTextInput(inputProps)\n\n\t\treturn <Input {...inputProps} />\n\t}, [\n\t\tonChangeText,\n\t\ttext,\n\t\ttextInputProps,\n\t\trenderTextInput,\n\t\tprops.inputContainerStyle,\n\t\tprops.placeholderColor,\n\t\tprops.placeholderText,\n\t\tprops.inputStyle,\n\t\tprops.tintColor,\n\t\t// TODO leave or take out?\n\t\tprops.inputRef,\n\t\tprops.sendOnKeyboardReturn,\n\t\tsend,\n\t])\n\n\tconst { renderSendButton } = props\n\tconst sendButtonMode =\n\t\tprops.sendButtonMode?.({ hasText: !!(text && text.trim()) }) ?? 'icon'\n\tconst renderSend = useCallback(() => {\n\t\tif (renderSendButton === null) return null\n\n\t\t// const mode: ChatProps['sendButtonMode'] = {\n\t\t// \tempty: 'hidden',\n\t\t// \twithText: 'icon',\n\t\t// \t...(sendButtonMode || {}),\n\t\t// }\n\t\tconst sendProps: SendButtonProps = {\n\t\t\tonSend: send,\n\t\t\ttext,\n\t\t\tmedia: media as MessageMedia[],\n\t\t\tuser,\n\t\t\t// mode: (text && text.trim ? mode.withText : mode.empty) || 'icon',\n\t\t\tmode: sendButtonMode,\n\t\t\tcontainerStyle: props.sendButtonContainerStyle,\n\t\t\ttintColor: props.tintColor,\n\t\t}\n\t\tif (renderSendButton) return renderSendButton(sendProps)\n\n\t\treturn <Send {...sendProps} />\n\t}, [\n\t\tsend,\n\t\ttext,\n\t\tuser,\n\t\tmedia,\n\t\trenderSendButton,\n\t\tsendButtonMode,\n\t\tprops.sendButtonContainerStyle,\n\t\tprops.tintColor,\n\t])\n\n\tconst containerStyle = useMemo(() => {\n\t\tconst paddingBottom = keyboardOpen && isIphoneX() ? 10 : getBottomSpace()\n\t\treturn [styles.container, { paddingBottom }, props.containerStyle]\n\t}, [props.containerStyle, keyboardOpen])\n\n\treturn (\n\t\t<View style={[containerStyle]}>\n\t\t\t<View style={styles.wrapper}>\n\t\t\t\t{renderInput()}\n\t\t\t\t{renderSend()}\n\t\t\t</View>\n\t\t</View>\n\t)\n}\n\nComposer.displayName = 'Juice.Composer'\n\nexport default React.memo(Composer)\n\nconst styles = StyleSheet.create({\n\tcontainer: {\n\t\tpaddingBottom: 10,\n\t\tpaddingTop: 5,\n\t},\n\twrapper: {\n\t\tflexDirection: 'row',\n\t\talignItems: 'flex-end',\n\t},\n})\n"]}
@@ -1,2 +0,0 @@
1
- var _jsxFileName="/Users/Fernando/Developer/Learning Babel/usechat/src/components/Chat/Media/Image/index.tsx";import React,{useMemo}from'react';import{Image,Dimensions}from'react-native';var Img=function Img(props){var dimensions=useMemo(function(){var aspectRatio=props.width/props.height;var isVertical=props.height>props.width;var _Dimensions$get=Dimensions.get('window'),screenWidth=_Dimensions$get.width;var width=isVertical?screenWidth*0.6:screenWidth*0.7;var height=width/aspectRatio;return{height:height,width:width};},[props.height,props.width]);return React.createElement(Image,{source:{uri:props.url||props.uri},style:dimensions,resizeMode:"cover",__source:{fileName:_jsxFileName,lineNumber:16}});};Img.displayName='Juice.Image';export default React.memo(Img);
2
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["index.tsx"],"names":["React","useMemo","Image","Dimensions","Img","props","dimensions","aspectRatio","width","height","isVertical","get","screenWidth","uri","url","displayName","memo"],"mappings":"8GAAA,MAAOA,CAAAA,KAAP,EAAgBC,OAAhB,KAA+B,OAA/B,CACA,OAASC,KAAT,CAAgBC,UAAhB,KAA8C,cAA9C,CAGA,GAAMC,CAAAA,GAAG,CAAG,QAANA,CAAAA,GAAM,CAACC,KAAD,CAA8C,CACzD,GAAMC,CAAAA,UAAU,CAAGL,OAAO,CAAC,UAAkB,CAC5C,GAAMM,CAAAA,WAAW,CAAGF,KAAK,CAACG,KAAN,CAAcH,KAAK,CAACI,MAAxC,CACA,GAAMC,CAAAA,UAAU,CAAGL,KAAK,CAACI,MAAN,CAAeJ,KAAK,CAACG,KAAxC,CAF4C,oBAGbL,UAAU,CAACQ,GAAX,CAAe,QAAf,CAHa,CAG7BC,WAH6B,iBAGpCJ,KAHoC,CAI5C,GAAMA,CAAAA,KAAK,CAAGE,UAAU,CAAGE,WAAW,CAAG,GAAjB,CAAuBA,WAAW,CAAG,GAA7D,CACA,GAAMH,CAAAA,MAAM,CAAGD,KAAK,CAAGD,WAAvB,CAEA,MAAO,CAAEE,MAAM,CAANA,MAAF,CAAUD,KAAK,CAALA,KAAV,CAAP,CACA,CARyB,CAQvB,CAACH,KAAK,CAACI,MAAP,CAAeJ,KAAK,CAACG,KAArB,CARuB,CAA1B,CASA,MACC,qBAAC,KAAD,EACC,MAAM,CAAE,CAAEK,GAAG,CAAER,KAAK,CAACS,GAAN,EAAaT,KAAK,CAACQ,GAA1B,CADT,CAEC,KAAK,CAAEP,UAFR,CAGC,UAAU,CAAC,OAHZ,iDADD,CAOA,CAjBD,CAmBAF,GAAG,CAACW,WAAJ,CAAkB,aAAlB,CAEA,cAAef,CAAAA,KAAK,CAACgB,IAAN,CAAWZ,GAAX,CAAf","sourcesContent":["import React, { useMemo } from 'react'\nimport { Image, Dimensions, ImageStyle } from 'react-native'\nimport { MessageMedia } from '../../../../classes/Message/types'\n\nconst Img = (props: Omit<MessageMedia, 'contentType'>) => {\n\tconst dimensions = useMemo((): ImageStyle => {\n\t\tconst aspectRatio = props.width / props.height\n\t\tconst isVertical = props.height > props.width\n\t\tconst { width: screenWidth } = Dimensions.get('window')\n\t\tconst width = isVertical ? screenWidth * 0.6 : screenWidth * 0.7\n\t\tconst height = width / aspectRatio\n\n\t\treturn { height, width }\n\t}, [props.height, props.width])\n\treturn (\n\t\t<Image\n\t\t\tsource={{ uri: props.url || props.uri }}\n\t\t\tstyle={dimensions}\n\t\t\tresizeMode=\"cover\"\n\t\t/>\n\t)\n}\n\nImg.displayName = 'Juice.Image'\n\nexport default React.memo(Img)\n"]}
@@ -1,2 +0,0 @@
1
- import _extends from"@babel/runtime/helpers/extends";import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _jsxFileName="/Users/Fernando/Developer/Learning Babel/usechat/src/components/Chat/Media/index.tsx";import React from'react';import Image from'./Image';var Media=function Media(_ref){var contentType=_ref.contentType,props=_objectWithoutProperties(_ref,["contentType"]);if(contentType==='image')return React.createElement(Image,_extends({},props,{__source:{fileName:_jsxFileName,lineNumber:6}}));if(contentType==='video')return null;return null;};export default React.memo(Media);
2
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["index.tsx"],"names":["React","Image","Media","contentType","props","memo"],"mappings":"kPAAA,MAAOA,CAAAA,KAAP,KAAkB,OAAlB,CAEA,MAAOC,CAAAA,KAAP,KAAkB,SAAlB,CAEA,GAAMC,CAAAA,KAAK,CAAG,QAARA,CAAAA,KAAQ,MAA6C,IAA1CC,CAAAA,WAA0C,MAA1CA,WAA0C,CAA1BC,KAA0B,gDAC1D,GAAID,WAAW,GAAK,OAApB,CAA6B,MAAO,qBAAC,KAAD,aAAWC,KAAX,kDAAP,CAC7B,GAAID,WAAW,GAAK,OAApB,CAA6B,MAAO,KAAP,CAC7B,MAAO,KAAP,CACA,CAJD,CAMA,cAAeH,CAAAA,KAAK,CAACK,IAAN,CAAWH,KAAX,CAAf","sourcesContent":["import React from 'react'\nimport { MessageMedia } from '../../../classes/Message/types'\nimport Image from './Image'\n\nconst Media = ({ contentType, ...props }: MessageMedia) => {\n\tif (contentType === 'image') return <Image {...props} />\n\tif (contentType === 'video') return null\n\treturn null\n}\n\nexport default React.memo(Media)\n"]}
@@ -1,2 +0,0 @@
1
- var _jsxFileName="/Users/Fernando/Developer/Learning Babel/usechat/src/components/Chat/Message/Swiper/Action/index.tsx";import React from'react';import{View}from'react-native';export default(function(props){return React.createElement(View,{__source:{fileName:_jsxFileName,lineNumber:6}});});
2
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["index.tsx"],"names":["React","View","props"],"mappings":"wHAAA,MAAOA,CAAAA,KAAP,KAAkB,OAAlB,CAEA,OAASC,IAAT,KAAqB,cAArB,CAEA,eAAe,SAACC,KAAD,CAA6B,CAC3C,MAAO,qBAAC,IAAD,iDAAP,CACA,CAFD","sourcesContent":["import React from 'react'\nimport { SwipeableProps, SwipeActionProps } from '../../../types'\nimport { View } from 'react-native'\n\nexport default (props: SwipeActionProps) => {\n\treturn <View></View>\n}\n"]}
@@ -1,2 +0,0 @@
1
- import _extends from"@babel/runtime/helpers/extends";var _jsxFileName="/Users/Fernando/Developer/Learning Babel/usechat/src/components/Chat/Message/Swiper/index.tsx";import React,{useCallback}from'react';import Swipeable from'react-native-gesture-handler/Swipeable';import Action from'./Action';var Swiper=function Swiper(props){var renderSwipeAction=props.renderSwipeAction;var renderAction=useCallback(function(actionProps){if(renderSwipeAction)return renderSwipeAction(actionProps);return React.createElement(Action,_extends({},actionProps,{__source:{fileName:_jsxFileName,lineNumber:12}}));},[renderSwipeAction]);var swipeActions=props.swipeActions;var leftActions=swipeActions&&swipeActions.left;var rightActions=swipeActions&&swipeActions.right;var renderRightActions=useCallback(function(){if(rightActions){rightActions.forEach(function(action){});}},[rightActions]);var renderActionList=useCallback(function(){},[]);return React.createElement(Swipeable,{__source:{fileName:_jsxFileName,lineNumber:29}});};export default Swiper;
2
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["index.tsx"],"names":["React","useCallback","Swipeable","Action","Swiper","props","renderSwipeAction","renderAction","actionProps","swipeActions","leftActions","left","rightActions","right","renderRightActions","forEach","action","renderActionList"],"mappings":"sKAAA,MAAOA,CAAAA,KAAP,EAAgBC,WAAhB,KAAmC,OAAnC,CACA,MAAOC,CAAAA,SAAP,KAAsB,wCAAtB,CAEA,MAAOC,CAAAA,MAAP,KAAmB,UAAnB,CAEA,GAAMC,CAAAA,MAAM,CAAG,QAATA,CAAAA,MAAS,CAACC,KAAD,CAA2B,IACjCC,CAAAA,iBADiC,CACXD,KADW,CACjCC,iBADiC,CAEzC,GAAMC,CAAAA,YAAY,CAAGN,WAAW,CAC/B,SAACO,WAAD,CAAmC,CAClC,GAAIF,iBAAJ,CAAuB,MAAOA,CAAAA,iBAAiB,CAACE,WAAD,CAAxB,CAEvB,MAAO,qBAAC,MAAD,aAAYA,WAAZ,mDAAP,CACA,CAL8B,CAM/B,CAACF,iBAAD,CAN+B,CAAhC,CAFyC,GAWjCG,CAAAA,YAXiC,CAWhBJ,KAXgB,CAWjCI,YAXiC,CAYzC,GAAMC,CAAAA,WAAW,CAAGD,YAAY,EAAIA,YAAY,CAACE,IAAjD,CACA,GAAMC,CAAAA,YAAY,CAAGH,YAAY,EAAIA,YAAY,CAACI,KAAlD,CAEA,GAAMC,CAAAA,kBAAkB,CAAGb,WAAW,CAAC,UAAM,CAC5C,GAAIW,YAAJ,CAAkB,CACjBA,YAAY,CAACG,OAAb,CAAqB,SAAAC,MAAM,CAAI,CAAE,CAAjC,EACA,CACD,CAJqC,CAInC,CAACJ,YAAD,CAJmC,CAAtC,CAMA,GAAMK,CAAAA,gBAAgB,CAAGhB,WAAW,CAAC,UAAM,CAAE,CAAT,CAAW,EAAX,CAApC,CAEA,MAAO,qBAAC,SAAD,kDAAP,CACA,CAxBD,CA0BA,cAAeG,CAAAA,MAAf","sourcesContent":["import React, { useCallback } from 'react'\nimport Swipeable from 'react-native-gesture-handler/Swipeable'\nimport { SwipeableProps, SwipeActionProps } from '../../types'\nimport Action from './Action'\n\nconst Swiper = (props: SwipeableProps) => {\n\tconst { renderSwipeAction } = props\n\tconst renderAction = useCallback(\n\t\t(actionProps: SwipeActionProps) => {\n\t\t\tif (renderSwipeAction) return renderSwipeAction(actionProps)\n\n\t\t\treturn <Action {...actionProps} />\n\t\t},\n\t\t[renderSwipeAction]\n\t)\n\n\tconst { swipeActions } = props\n\tconst leftActions = swipeActions && swipeActions.left\n\tconst rightActions = swipeActions && swipeActions.right\n\n\tconst renderRightActions = useCallback(() => {\n\t\tif (rightActions) {\n\t\t\trightActions.forEach(action => {})\n\t\t}\n\t}, [rightActions])\n\n\tconst renderActionList = useCallback(() => {}, [])\n\n\treturn <Swipeable></Swipeable>\n}\n\nexport default Swiper\n"]}
@@ -1,2 +0,0 @@
1
- var _jsxFileName="/Users/Fernando/Developer/Learning Babel/usechat/src/components/Chat/Message/Touchable/index.tsx";import React,{useRef,useCallback}from'react';import{LongPressGestureHandler,State,TapGestureHandler}from'react-native-gesture-handler';var Touchable=function Touchable(props){var doubleTapRef=useRef(null);var onLongPress=props.onLongPress,onPress=props.onPress,handleDoubleTap=props.onDoubleTap,id=props.id;var onHandlerStateChange=useCallback(function(event){if(event.nativeEvent.state===State.ACTIVE){if(onLongPress)onLongPress(id);}},[onLongPress,id]);var onSingleTap=useCallback(function(event){if(event.nativeEvent.state===State.ACTIVE){if(onPress)onPress(id);}},[onPress,id]);var onDoubleTap=useCallback(function(event){if(event.nativeEvent.state===State.ACTIVE){if(handleDoubleTap)handleDoubleTap(id);}},[handleDoubleTap,id]);return React.createElement(LongPressGestureHandler,{onHandlerStateChange:onHandlerStateChange,minDurationMs:props.longPressDelay||500,__source:{fileName:_jsxFileName,lineNumber:39}},React.createElement(TapGestureHandler,{onHandlerStateChange:onSingleTap,waitFor:doubleTapRef,__source:{fileName:_jsxFileName,lineNumber:43}},React.createElement(TapGestureHandler,{maxDelayMs:props.doubleTapDelay||500,ref:doubleTapRef,onHandlerStateChange:onDoubleTap,numberOfTaps:2,__source:{fileName:_jsxFileName,lineNumber:47}},props.children)));};export default Touchable;
2
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["index.tsx"],"names":["React","useRef","useCallback","LongPressGestureHandler","State","TapGestureHandler","Touchable","props","doubleTapRef","onLongPress","onPress","handleDoubleTap","onDoubleTap","id","onHandlerStateChange","event","nativeEvent","state","ACTIVE","onSingleTap","longPressDelay","doubleTapDelay","children"],"mappings":"oHAAA,MAAOA,CAAAA,KAAP,EAAgBC,MAAhB,CAAwBC,WAAxB,KAA8D,OAA9D,CAGA,OACCC,uBADD,CAECC,KAFD,CAGCC,iBAHD,KAIO,8BAJP,CAMA,GAAMC,CAAAA,SAA4C,CAAG,QAA/CA,CAAAA,SAA+C,CAAAC,KAAK,CAAI,CAC7D,GAAMC,CAAAA,YAAY,CAAGP,MAAM,CAAoB,IAApB,CAA3B,CAD6D,GAErDQ,CAAAA,WAFqD,CAEMF,KAFN,CAErDE,WAFqD,CAExCC,OAFwC,CAEMH,KAFN,CAExCG,OAFwC,CAElBC,eAFkB,CAEMJ,KAFN,CAE/BK,WAF+B,CAEDC,EAFC,CAEMN,KAFN,CAEDM,EAFC,CAG7D,GAAMC,CAAAA,oBAAoB,CAAGZ,WAAW,CACvC,SAAAa,KAAK,CAAI,CACR,GAAIA,KAAK,CAACC,WAAN,CAAkBC,KAAlB,GAA4Bb,KAAK,CAACc,MAAtC,CAA8C,CAC7C,GAAIT,WAAJ,CAAiBA,WAAW,CAACI,EAAD,CAAX,CAEjB,CACD,CANsC,CAOvC,CAACJ,WAAD,CAAcI,EAAd,CAPuC,CAAxC,CASA,GAAMM,CAAAA,WAAW,CAAGjB,WAAW,CAC9B,SAAAa,KAAK,CAAI,CACR,GAAIA,KAAK,CAACC,WAAN,CAAkBC,KAAlB,GAA4Bb,KAAK,CAACc,MAAtC,CAA8C,CAC7C,GAAIR,OAAJ,CAAaA,OAAO,CAACG,EAAD,CAAP,CACb,CACD,CAL6B,CAM9B,CAACH,OAAD,CAAUG,EAAV,CAN8B,CAA/B,CAQA,GAAMD,CAAAA,WAAW,CAAGV,WAAW,CAC9B,SAAAa,KAAK,CAAI,CACR,GAAIA,KAAK,CAACC,WAAN,CAAkBC,KAAlB,GAA4Bb,KAAK,CAACc,MAAtC,CAA8C,CAC7C,GAAIP,eAAJ,CAAqBA,eAAe,CAACE,EAAD,CAAf,CACrB,CACD,CAL6B,CAM9B,CAACF,eAAD,CAAkBE,EAAlB,CAN8B,CAA/B,CAQA,MACC,qBAAC,uBAAD,EACC,oBAAoB,CAAEC,oBADvB,CAEC,aAAa,CAAEP,KAAK,CAACa,cAAN,EAAwB,GAFxC,iDAIC,oBAAC,iBAAD,EACC,oBAAoB,CAAED,WADvB,CAEC,OAAO,CAAEX,YAFV,iDAIC,oBAAC,iBAAD,EACC,UAAU,CAAED,KAAK,CAACc,cAAN,EAAwB,GADrC,CAEC,GAAG,CAAEb,YAFN,CAGC,oBAAoB,CAAEI,WAHvB,CAIC,YAAY,CAAE,CAJf,iDAMEL,KAAK,CAACe,QANR,CAJD,CAJD,CADD,CAoBA,CAhDD,CAkDA,cAAehB,CAAAA,SAAf","sourcesContent":["import React, { useRef, useCallback, FunctionComponent } from 'react'\n\nimport { TouchableProps } from '../../types'\nimport {\n\tLongPressGestureHandler,\n\tState,\n\tTapGestureHandler\n} from 'react-native-gesture-handler'\n\nconst Touchable: FunctionComponent<TouchableProps> = props => {\n\tconst doubleTapRef = useRef<TapGestureHandler>(null)\n\tconst { onLongPress, onPress, onDoubleTap: handleDoubleTap, id } = props\n\tconst onHandlerStateChange = useCallback(\n\t\tevent => {\n\t\t\tif (event.nativeEvent.state === State.ACTIVE) {\n\t\t\t\tif (onLongPress) onLongPress(id)\n\t\t\t\t// alert(\"I'm being pressed for so long\")\n\t\t\t}\n\t\t},\n\t\t[onLongPress, id]\n\t)\n\tconst onSingleTap = useCallback(\n\t\tevent => {\n\t\t\tif (event.nativeEvent.state === State.ACTIVE) {\n\t\t\t\tif (onPress) onPress(id)\n\t\t\t}\n\t\t},\n\t\t[onPress, id]\n\t)\n\tconst onDoubleTap = useCallback(\n\t\tevent => {\n\t\t\tif (event.nativeEvent.state === State.ACTIVE) {\n\t\t\t\tif (handleDoubleTap) handleDoubleTap(id)\n\t\t\t}\n\t\t},\n\t\t[handleDoubleTap, id]\n\t)\n\treturn (\n\t\t<LongPressGestureHandler\n\t\t\tonHandlerStateChange={onHandlerStateChange}\n\t\t\tminDurationMs={props.longPressDelay || 500}\n\t\t>\n\t\t\t<TapGestureHandler\n\t\t\t\tonHandlerStateChange={onSingleTap}\n\t\t\t\twaitFor={doubleTapRef}\n\t\t\t>\n\t\t\t\t<TapGestureHandler\n\t\t\t\t\tmaxDelayMs={props.doubleTapDelay || 500}\n\t\t\t\t\tref={doubleTapRef}\n\t\t\t\t\tonHandlerStateChange={onDoubleTap}\n\t\t\t\t\tnumberOfTaps={2}\n\t\t\t\t>\n\t\t\t\t\t{props.children}\n\t\t\t\t</TapGestureHandler>\n\t\t\t</TapGestureHandler>\n\t\t</LongPressGestureHandler>\n\t)\n}\n\nexport default Touchable\n"]}
@@ -1,2 +0,0 @@
1
- import _extends from"@babel/runtime/helpers/extends";import _defineProperty from"@babel/runtime/helpers/defineProperty";var _jsxFileName="/Users/Fernando/Developer/Learning Babel/usechat/src/components/Chat/Message/index.tsx";function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);if(enumerableOnly)symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable;});keys.push.apply(keys,symbols);}return keys;}function _objectSpread(target){for(var i=1;i<arguments.length;i++){var source=arguments[i]!=null?arguments[i]:{};if(i%2){ownKeys(Object(source),true).forEach(function(key){_defineProperty(target,key,source[key]);});}else if(Object.getOwnPropertyDescriptors){Object.defineProperties(target,Object.getOwnPropertyDescriptors(source));}else{ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key));});}}return target;}import React,{useCallback,useRef,useMemo,useEffect}from'react';import{View,StyleSheet,Text}from'react-native';import Bubble from'../Bubble';import{Avatar,Initials}from'../../index';import{getInitials}from'../../../helpers/getInitials';import{Transitioning,Transition}from'react-native-reanimated';import Touchable from'./Touchable';var Message=function Message(props){var bubble=useRef();var transitionRef=useRef();var mounted=useRef(false);var renderAvatar=props.renderAvatar,avatar=props.avatar,avatarImageProps=props.avatarImageProps,showAvatar=props.showAvatar,name=props.name,renderInitials=props.renderInitials,initialsBackgroundColor=props.initialsBackgroundColor,initialsTextColor=props.initialsTextColor;useEffect(function(){if(mounted.current){transitionRef.current&&transitionRef.current.animateNextTransition();}else{mounted.current=true;}},[props.avatar,props.text,renderAvatar]);var renderFooter=props.renderFooter;var footer=useCallback(function(){return renderFooter?renderFooter({id:props.id}):null;},[props.id,renderFooter]);var containerStyle=useMemo(function(){return[styles.container,props.isMe?meStyles.container:otherStyles.container,props.messageContainerStyle];},[props.isMe,props.messageContainerStyle]);var wrapperStyle=useMemo(function(){return[styles.wrapper,props.isMe?meStyles.wrapper:otherStyles.wrapper,props.messageWrapperStyle];},[props.isMe,props.messageWrapperStyle]);var avatarSize=renderAvatar===null?0:props.avatarSize||35;var maybeRenderName=useCallback(function(){var style=_objectSpread({},styles.name,{},props.isMe?meStyles.name:otherStyles.name);return props.showName&&props.name?React.createElement(Text,{style:[style,props.nameStyle],__source:{fileName:_jsxFileName,lineNumber:87}},props.name):null;},[props.showName,props.name,props.nameStyle,props.isMe]);var renderAvatarOrInitials=useCallback(function(){if(renderAvatar===null)return null;var opacity=showAvatar===false?0:1;var size=avatarSize;if(avatar){var avatarProps={avatar:avatar,imageProps:avatarImageProps,size:size,ImageComponent:props.AvatarImageComponent};if(renderAvatar)return renderAvatar(avatarProps);return React.createElement(AvatarContainer,{opacity:opacity,showAvatar:!!showAvatar,__source:{fileName:_jsxFileName,lineNumber:106}},React.createElement(Avatar,_extends({},avatarProps,{__source:{fileName:_jsxFileName,lineNumber:107}})));}var initialsProps={initials:getInitials(name),size:size,textColor:initialsTextColor,backgroundColor:initialsBackgroundColor||props.tintColor};if(renderInitials)return renderInitials(initialsProps);return React.createElement(AvatarContainer,{opacity:opacity,showAvatar:!!showAvatar,__source:{fileName:_jsxFileName,lineNumber:119}},React.createElement(Initials,_extends({},initialsProps,{__source:{fileName:_jsxFileName,lineNumber:120}})));},[avatar,avatarImageProps,avatarSize,renderAvatar,showAvatar,name,renderInitials,initialsBackgroundColor,initialsTextColor,props.tintColor,props.AvatarImageComponent]);var bubbleBackgroundColor=props.bubbleBackgroundColor,id=props.id,userId=props.userId,userName=props.userName,createdAt=props.createdAt,text=props.text,system=props.system;var backgroundColor=useMemo(function(){var fallback=props.isMe?['#7B16FF','#7114EA']:['#f1f7f8','#f8f8f8'];if(!bubbleBackgroundColor)return fallback;var colors=[];if(typeof bubbleBackgroundColor==='string'){colors=[bubbleBackgroundColor,bubbleBackgroundColor];}else if(Array.isArray(bubbleBackgroundColor)){colors=bubbleBackgroundColor;}else if(typeof bubbleBackgroundColor==='function'){var background=bubbleBackgroundColor({createdAt:createdAt,id:id,user:{name:userName!=null?userName:'',id:userId!=null?userId:'',avatar:avatar!=null?avatar:''},text:text,system:system});if(Array.isArray(background)){colors=background;}else if(typeof background==='string'){colors=[background,background];}}if(!colors.length){console.warn("\uD83C\uDF47 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={{ "+(props.isMe?'me':'others')+": 'blue' }}. Instead, you passed this: "+bubbleBackgroundColor+".");return fallback;}return colors;},[props.isMe,bubbleBackgroundColor,createdAt,id,userName,userId,avatar,text,system]);var renderBubble=function renderBubble(){return React.createElement(Bubble,{text:props.text,isMe:props.isMe,style:props.bubbleStyle,textStyle:props.bubbleTextStyle,bubbleRef:bubble,backgroundColor:backgroundColor,textColor:props.bubbleTextColor,mediaContentType:props.mediaContentType,mediaHeight:props.mediaHeight,mediaWidth:props.mediaWidth,mediaUri:props.mediaUri,mediaUrl:props.mediaUrl,renderMedia:props.renderMedia,renderText:props.renderText,__source:{fileName:_jsxFileName,lineNumber:204}});};var outerStyle=useMemo(function(){return props.createsNewBunch?{marginTop:10}:{};},[props.createsNewBunch]);return React.createElement(Touchable,{id:props.id,longPressDelay:props.longPressDelay,doubleTapDelay:props.doubleTapDelay,onDoubleTap:props.onDoubleTap,onPress:props.onPress,onLongPress:props.onLongPress,__source:{fileName:_jsxFileName,lineNumber:227}},React.createElement(Transitioning.View,{style:outerStyle,transition:transition,ref:transitionRef,__source:{fileName:_jsxFileName,lineNumber:235}},React.createElement(View,{style:containerStyle,__source:{fileName:_jsxFileName,lineNumber:240}},React.createElement(View,{style:wrapperStyle,__source:{fileName:_jsxFileName,lineNumber:241}},renderAvatarOrInitials(),React.createElement(View,{style:{flex:1,justifyContent:'flex-start'},__source:{fileName:_jsxFileName,lineNumber:243}},maybeRenderName(),React.createElement(View,{style:wrapperStyle,__source:{fileName:_jsxFileName,lineNumber:245}},renderBubble()))),footer())));};var transition=React.createElement(Transition.Together,{__source:{fileName:_jsxFileName,lineNumber:258}},React.createElement(Transition.Change,{interpolation:"easeOut",__source:{fileName:_jsxFileName,lineNumber:259}}),React.createElement(Transition.In,{type:"fade",__source:{fileName:_jsxFileName,lineNumber:260}}));var AvatarContainer=React.memo(function AvatarContainer(_ref){var children=_ref.children,opacity=_ref.opacity;return React.createElement(View,{style:{opacity:opacity},__source:{fileName:_jsxFileName,lineNumber:270}},children);});Message.displayName='Message';export default React.memo(Message);var styles=StyleSheet.create({outer:{},container:{marginTop:1,alignItems:'flex-end',paddingHorizontal:10},wrapper:{flex:1,alignItems:'flex-end',justifyContent:'flex-start'},name:{marginHorizontal:10,fontSize:14,color:'gray',paddingVertical:5}});var meStyles=StyleSheet.create({container:{justifyContent:'flex-end'},wrapper:{flexDirection:'row-reverse'},name:{textAlign:'right'}});var otherStyles=StyleSheet.create({container:{justifyContent:'flex-end'},wrapper:{flexDirection:'row'},name:{textAlign:'left'}});
2
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["index.tsx"],"names":["React","useCallback","useRef","useMemo","useEffect","View","StyleSheet","Text","Bubble","Avatar","Initials","getInitials","Transitioning","Transition","Touchable","Message","props","bubble","transitionRef","mounted","renderAvatar","avatar","avatarImageProps","showAvatar","name","renderInitials","initialsBackgroundColor","initialsTextColor","current","animateNextTransition","text","renderFooter","footer","id","containerStyle","styles","container","isMe","meStyles","otherStyles","messageContainerStyle","wrapperStyle","wrapper","messageWrapperStyle","avatarSize","maybeRenderName","style","showName","nameStyle","renderAvatarOrInitials","opacity","size","avatarProps","imageProps","ImageComponent","AvatarImageComponent","initialsProps","initials","textColor","backgroundColor","tintColor","bubbleBackgroundColor","userId","userName","createdAt","system","fallback","colors","Array","isArray","background","user","length","console","warn","renderBubble","bubbleStyle","bubbleTextStyle","bubbleTextColor","mediaContentType","mediaHeight","mediaWidth","mediaUri","mediaUrl","renderMedia","renderText","outerStyle","createsNewBunch","marginTop","longPressDelay","doubleTapDelay","onDoubleTap","onPress","onLongPress","transition","flex","justifyContent","AvatarContainer","memo","children","displayName","create","outer","alignItems","paddingHorizontal","marginHorizontal","fontSize","color","paddingVertical","flexDirection","textAlign"],"mappings":"8/BAAA,MAAOA,CAAAA,KAAP,EACCC,WADD,CAECC,MAFD,CAICC,OAJD,CAMCC,SAND,KAQO,OARP,CASA,OAASC,IAAT,CAAeC,UAAf,CAA2BC,IAA3B,KAAuC,cAAvC,CAIA,MAAOC,CAAAA,MAAP,KAAmB,WAAnB,CACA,OAASC,MAAT,CA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ACRmE,aAAa,CAAE,KADP,CAJ4B,CAOrCrF,IAAI,CAAE,CACLsF,SAAS,CAAE,MADN,CAP+B,CAAlB,CAApB","sourcesContent":["import React, {\n\tuseCallback,\n\tuseRef,\n\tMutableRefObject,\n\tuseMemo,\n\tFunctionComponent,\n\tuseEffect,\n\tRefObject,\n} from 'react'\nimport { View, StyleSheet, Text } from 'react-native'\nimport { MessageProps } from '../types'\nimport { NewMessageModel } from '../../../classes/Message/types'\n// import { NewMessageModel } from '../../../classes/Message/types'\nimport Bubble from '../Bubble'\nimport { Avatar, Initials } from '../../index'\nimport { InitialsProps, AvatarProps } from '../../../components/Inbox/types'\n// TODO update imports for these\nimport { getInitials } from '../../../helpers/getInitials'\nimport {\n\tTransitioning,\n\tTransitioningView,\n\tTransition,\n} from 'react-native-reanimated'\nimport Touchable from './Touchable'\n// import { AvatarProps, InitialsProps } from '../../Inbox/types'\n// import { getInitials } from '../../../helpers/getInitials'\n\nconst Message = <Model extends NewMessageModel = NewMessageModel>(\n\tprops: MessageProps<Model>\n) => {\n\tconst bubble = useRef<View>()\n\tconst transitionRef = useRef<TransitioningView>()\n\tconst mounted = useRef(false)\n\n\tconst {\n\t\trenderAvatar,\n\t\tavatar,\n\t\tavatarImageProps,\n\t\tshowAvatar,\n\t\tname,\n\t\trenderInitials,\n\t\tinitialsBackgroundColor,\n\t\tinitialsTextColor,\n\t} = props\n\n\tuseEffect(() => {\n\t\tif (mounted.current) {\n\t\t\t// console.log('message updated', props.text)\n\t\t\ttransitionRef.current && transitionRef.current.animateNextTransition()\n\t\t} else {\n\t\t\tmounted.current = true\n\t\t}\n\t}, [props.avatar, props.text, renderAvatar])\n\n\tconst { renderFooter } = props\n\n\tconst footer = useCallback(\n\t\t() => (renderFooter ? renderFooter({ id: props.id }) : null),\n\t\t[props.id, renderFooter]\n\t)\n\n\tconst containerStyle = useMemo(() => {\n\t\treturn [\n\t\t\tstyles.container,\n\t\t\tprops.isMe ? meStyles.container : otherStyles.container,\n\t\t\tprops.messageContainerStyle,\n\t\t]\n\t}, [props.isMe, props.messageContainerStyle])\n\n\tconst wrapperStyle = useMemo(() => {\n\t\treturn [\n\t\t\tstyles.wrapper,\n\t\t\tprops.isMe ? meStyles.wrapper : otherStyles.wrapper,\n\t\t\tprops.messageWrapperStyle,\n\t\t]\n\t}, [props.isMe, props.messageWrapperStyle])\n\n\t// no avatar size if it's rendered null. this var is used in different spots\n\tconst avatarSize = renderAvatar === null ? 0 : props.avatarSize || 35\n\n\tconst maybeRenderName = useCallback(() => {\n\t\tconst style = {\n\t\t\t...styles.name,\n\t\t\t...(props.isMe ? meStyles.name : otherStyles.name),\n\t\t}\n\t\treturn props.showName && props.name ? (\n\t\t\t<Text style={[style, props.nameStyle]}>{props.name}</Text>\n\t\t) : null\n\t}, [props.showName, props.name, props.nameStyle, props.isMe])\n\n\tconst renderAvatarOrInitials = useCallback(() => {\n\t\tif (renderAvatar === null) return null\n\t\t// we make opacity 0 instead of hiding it to maintain the same width from the side\n\t\tconst opacity = showAvatar === false ? 0 : 1\n\t\tconst size = avatarSize\n\n\t\tif (avatar) {\n\t\t\tconst avatarProps: AvatarProps = {\n\t\t\t\tavatar: avatar,\n\t\t\t\timageProps: avatarImageProps,\n\t\t\t\tsize,\n\t\t\t\tImageComponent: props.AvatarImageComponent,\n\t\t\t}\n\t\t\tif (renderAvatar) return renderAvatar(avatarProps)\n\t\t\treturn (\n\t\t\t\t<AvatarContainer opacity={opacity} showAvatar={!!showAvatar}>\n\t\t\t\t\t<Avatar {...avatarProps} />\n\t\t\t\t</AvatarContainer>\n\t\t\t)\n\t\t}\n\t\tconst initialsProps: InitialsProps = {\n\t\t\tinitials: getInitials(name),\n\t\t\tsize,\n\t\t\ttextColor: initialsTextColor,\n\t\t\tbackgroundColor: initialsBackgroundColor || props.tintColor,\n\t\t}\n\t\tif (renderInitials) return renderInitials(initialsProps)\n\t\treturn (\n\t\t\t<AvatarContainer opacity={opacity} showAvatar={!!showAvatar}>\n\t\t\t\t<Initials {...initialsProps} />\n\t\t\t</AvatarContainer>\n\t\t)\n\t}, [\n\t\tavatar,\n\t\tavatarImageProps,\n\t\tavatarSize,\n\t\trenderAvatar,\n\t\tshowAvatar,\n\t\tname,\n\t\trenderInitials,\n\t\tinitialsBackgroundColor,\n\t\tinitialsTextColor,\n\t\tprops.tintColor,\n\t\tprops.AvatarImageComponent,\n\t])\n\n\tconst {\n\t\tbubbleBackgroundColor,\n\t\tid,\n\t\tuserId,\n\t\tuserName,\n\t\tcreatedAt,\n\t\ttext,\n\t\tsystem,\n\t} = props\n\tconst backgroundColor = useMemo(() => {\n\t\tconst fallback = props.isMe\n\t\t\t? ['#7B16FF', '#7114EA']\n\t\t\t: ['#f1f7f8', '#f8f8f8']\n\t\tif (!bubbleBackgroundColor) return fallback\n\t\tlet colors: string[] = []\n\t\tif (typeof bubbleBackgroundColor === 'string') {\n\t\t\tcolors = [bubbleBackgroundColor, bubbleBackgroundColor]\n\t\t} else if (Array.isArray(bubbleBackgroundColor)) {\n\t\t\tcolors = bubbleBackgroundColor\n\t\t} else if (typeof bubbleBackgroundColor === 'function') {\n\t\t\tconst background = bubbleBackgroundColor({\n\t\t\t\tcreatedAt,\n\t\t\t\tid,\n\t\t\t\tuser: {\n\t\t\t\t\tname: userName ?? '',\n\t\t\t\t\tid: userId ?? '',\n\t\t\t\t\tavatar: avatar ?? '',\n\t\t\t\t},\n\t\t\t\ttext,\n\t\t\t\tsystem,\n\t\t\t})\n\t\t\t// const background = bubbleBackgroundColor({\n\t\t\t// \tuser: {\n\t\t\t// \t\tavatar: props.avatar || '',\n\t\t\t// \t\tid: props.userId || '',\n\t\t\t// \t\tname: props.userName || '',\n\t\t\t// \t},\n\t\t\t// \tid: props.id,\n\t\t\t// })\n\t\t\tif (Array.isArray(background)) {\n\t\t\t\tcolors = background\n\t\t\t} else if (typeof background === 'string') {\n\t\t\t\tcolors = [background, background]\n\t\t\t}\n\t\t}\n\t\tif (!colors.length) {\n\t\t\tconsole.warn(\n\t\t\t\t`🍇 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={{ ${\n\t\t\t\t\tprops.isMe ? 'me' : 'others'\n\t\t\t\t}: 'blue' }}. Instead, you passed this: ${bubbleBackgroundColor}.`\n\t\t\t)\n\t\t\treturn fallback\n\t\t}\n\t\treturn colors\n\t}, [\n\t\tprops.isMe,\n\t\tbubbleBackgroundColor,\n\t\tcreatedAt,\n\t\tid,\n\t\tuserName,\n\t\tuserId,\n\t\tavatar,\n\t\ttext,\n\t\tsystem,\n\t])\n\tconst renderBubble = () => {\n\t\treturn (\n\t\t\t<Bubble\n\t\t\t\ttext={props.text}\n\t\t\t\tisMe={props.isMe}\n\t\t\t\tstyle={props.bubbleStyle}\n\t\t\t\ttextStyle={props.bubbleTextStyle}\n\t\t\t\tbubbleRef={bubble as MutableRefObject<View>}\n\t\t\t\tbackgroundColor={backgroundColor}\n\t\t\t\ttextColor={props.bubbleTextColor}\n\t\t\t\tmediaContentType={props.mediaContentType}\n\t\t\t\tmediaHeight={props.mediaHeight}\n\t\t\t\tmediaWidth={props.mediaWidth}\n\t\t\t\tmediaUri={props.mediaUri}\n\t\t\t\tmediaUrl={props.mediaUrl}\n\t\t\t\trenderMedia={props.renderMedia}\n\t\t\t\trenderText={props.renderText}\n\t\t\t/>\n\t\t)\n\t}\n\tconst outerStyle = useMemo(\n\t\t() => (props.createsNewBunch ? { marginTop: 10 } : {}),\n\t\t[props.createsNewBunch]\n\t)\n\treturn (\n\t\t<Touchable\n\t\t\tid={props.id}\n\t\t\tlongPressDelay={props.longPressDelay}\n\t\t\tdoubleTapDelay={props.doubleTapDelay}\n\t\t\tonDoubleTap={props.onDoubleTap}\n\t\t\tonPress={props.onPress}\n\t\t\tonLongPress={props.onLongPress}\n\t\t>\n\t\t\t<Transitioning.View\n\t\t\t\tstyle={outerStyle}\n\t\t\t\ttransition={transition}\n\t\t\t\tref={transitionRef as RefObject<TransitioningView>}\n\t\t\t>\n\t\t\t\t<View style={containerStyle}>\n\t\t\t\t\t<View style={wrapperStyle}>\n\t\t\t\t\t\t{renderAvatarOrInitials()}\n\t\t\t\t\t\t<View style={{ flex: 1, justifyContent: 'flex-start' }}>\n\t\t\t\t\t\t\t{maybeRenderName()}\n\t\t\t\t\t\t\t<View style={wrapperStyle}>{renderBubble()}</View>\n\t\t\t\t\t\t</View>\n\t\t\t\t\t</View>\n\t\t\t\t\t{footer()}\n\t\t\t\t</View>\n\t\t\t</Transitioning.View>\n\t\t</Touchable>\n\t)\n}\n\nconst transition = (\n\t// <Transition.Sequence>\n\t// {/* <Transition.Out type=\"fade\" /> */}\n\t<Transition.Together>\n\t\t<Transition.Change interpolation=\"easeOut\" />\n\t\t<Transition.In type=\"fade\" />\n\t</Transition.Together>\n\t// </Transition.Sequence>\n)\n\nconst AvatarContainer: FunctionComponent<{\n\tshowAvatar: boolean\n\topacity: 0 | 1\n}> = React.memo(function AvatarContainer({ children, opacity }) {\n\treturn (\n\t\t<View\n\t\t\tstyle={{\n\t\t\t\topacity,\n\t\t\t\t// transform: [{ rotate: !showAvatar ? '180deg' : '0deg' }],\n\t\t\t}}\n\t\t>\n\t\t\t{children}\n\t\t</View>\n\t)\n})\n\nMessage.displayName = 'Message'\n\nexport default React.memo(Message)\n\nconst styles = StyleSheet.create({\n\touter: {},\n\tcontainer: {\n\t\tmarginTop: 1,\n\t\talignItems: 'flex-end',\n\t\tpaddingHorizontal: 10,\n\t},\n\t// wrapper is concerned with which side the avatar is on relative to the bubble\n\twrapper: {\n\t\tflex: 1,\n\t\talignItems: 'flex-end',\n\t\tjustifyContent: 'flex-start',\n\t},\n\tname: {\n\t\tmarginHorizontal: 10,\n\t\tfontSize: 14,\n\t\tcolor: 'gray',\n\t\tpaddingVertical: 5,\n\t},\n})\n\nconst meStyles = StyleSheet.create({\n\tcontainer: {\n\t\tjustifyContent: 'flex-end',\n\t},\n\twrapper: {\n\t\tflexDirection: 'row-reverse',\n\t},\n\tname: {\n\t\ttextAlign: 'right',\n\t},\n})\n\nconst otherStyles = StyleSheet.create({\n\tcontainer: {\n\t\tjustifyContent: 'flex-end',\n\t},\n\twrapper: {\n\t\tflexDirection: 'row',\n\t},\n\tname: {\n\t\ttextAlign: 'left',\n\t},\n})\n"]}
@@ -1,2 +0,0 @@
1
- var _jsxFileName="/Users/Fernando/Developer/Learning Babel/usechat/src/components/Chat/SystemMessage/index.tsx";import React from'react';import{View,Text,StyleSheet}from'react-native';import moment from'moment';var SystemMessage=React.memo(function(props){return React.createElement(View,{style:[styles.container,props.containerStyle],__source:{fileName:_jsxFileName,lineNumber:8}},React.createElement(Text,{style:styles.date,__source:{fileName:_jsxFileName,lineNumber:9}},props.dateToStringFunc?props.dateToStringFunc(props.createdAt):moment(props.createdAt).calendar(undefined,{lastDay:'[Yesterday]',sameDay:'LT',nextDay:'[Tomorrow at] LT',lastWeek:'dddd',nextWeek:'[Next] dddd',sameElse:'L'})),React.createElement(Text,{style:styles.text,__source:{fileName:_jsxFileName,lineNumber:21}},props.text));});export default SystemMessage;var styles=StyleSheet.create({container:{paddingHorizontal:10,paddingVertical:5},date:{color:'gray',textAlign:'center',fontSize:14},text:{color:'gray',fontWeight:'500',textAlign:'center',fontSize:14}});
2
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["index.tsx"],"names":["React","View","Text","StyleSheet","moment","SystemMessage","memo","props","styles","container","containerStyle","date","dateToStringFunc","createdAt","calendar","undefined","lastDay","sameDay","nextDay","lastWeek","nextWeek","sameElse","text","create","paddingHorizontal","paddingVertical","color","textAlign","fontSize","fontWeight"],"mappings":"gHAAA,MAAOA,CAAAA,KAAP,KAAkB,OAAlB,CACA,OAASC,IAAT,CAAeC,IAAf,CAAqBC,UAArB,KAAuC,cAAvC,CACA,MAAOC,CAAAA,MAAP,KAAmB,QAAnB,CAGA,GAAMC,CAAAA,aAAa,CAAGL,KAAK,CAACM,IAAN,CAAW,SAACC,KAAD,CAA+B,CAC/D,MACC,qBAAC,IAAD,EAAM,KAAK,CAAE,CAACC,MAAM,CAACC,SAAR,CAAmBF,KAAK,CAACG,cAAzB,CAAb,gDACC,oBAAC,IAAD,EAAM,KAAK,CAAEF,MAAM,CAACG,IAApB,gDACEJ,KAAK,CAACK,gBAAN,CACEL,KAAK,CAACK,gBAAN,CAAuBL,KAAK,CAACM,SAA7B,CADF,CAEET,MAAM,CAACG,KAAK,CAACM,SAAP,CAAN,CAAwBC,QAAxB,CAAiCC,SAAjC,CAA4C,CAC5CC,OAAO,CAAE,aADmC,CAE5CC,OAAO,CAAE,IAFmC,CAG5CC,OAAO,CAAE,kBAHmC,CAI5CC,QAAQ,CAAE,MAJkC,CAK5CC,QAAQ,CAAE,aALkC,CAM5CC,QAAQ,CAAE,GANkC,CAA5C,CAHJ,CADD,CAaC,oBAAC,IAAD,EAAM,KAAK,CAAEb,MAAM,CAACc,IAApB,iDAA2Bf,KAAK,CAACe,IAAjC,CAbD,CADD,CAiBA,CAlBqB,CAAtB,CAoBA,cAAejB,CAAAA,aAAf,CAEA,GAAMG,CAAAA,MAAM,CAAGL,UAAU,CAACoB,MAAX,CAAkB,CAChCd,SAAS,CAAE,CACVe,iBAAiB,CAAE,EADT,CAEVC,eAAe,CAAE,CAFP,CADqB,CAKhCd,IAAI,CAAE,CACLe,KAAK,CAAE,MADF,CAELC,SAAS,CAAE,QAFN,CAGLC,QAAQ,CAAE,EAHL,CAL0B,CAUhCN,IAAI,CAAE,CACLI,KAAK,CAAE,MADF,CAELG,UAAU,CAAE,KAFP,CAGLF,SAAS,CAAE,QAHN,CAILC,QAAQ,CAAE,EAJL,CAV0B,CAAlB,CAAf","sourcesContent":["import React from 'react'\nimport { View, Text, StyleSheet } from 'react-native'\nimport moment from 'moment'\nimport { SystemMessageProps } from '../types'\n\nconst SystemMessage = React.memo((props: SystemMessageProps) => {\n\treturn (\n\t\t<View style={[styles.container, props.containerStyle]}>\n\t\t\t<Text style={styles.date}>\n\t\t\t\t{props.dateToStringFunc\n\t\t\t\t\t? props.dateToStringFunc(props.createdAt)\n\t\t\t\t\t: moment(props.createdAt).calendar(undefined, {\n\t\t\t\t\t\t\tlastDay: '[Yesterday]',\n\t\t\t\t\t\t\tsameDay: 'LT',\n\t\t\t\t\t\t\tnextDay: '[Tomorrow at] LT',\n\t\t\t\t\t\t\tlastWeek: 'dddd',\n\t\t\t\t\t\t\tnextWeek: '[Next] dddd',\n\t\t\t\t\t\t\tsameElse: 'L'\n\t\t\t\t\t })}\n\t\t\t</Text>\n\t\t\t<Text style={styles.text}>{props.text}</Text>\n\t\t</View>\n\t)\n})\n\nexport default SystemMessage\n\nconst styles = StyleSheet.create({\n\tcontainer: {\n\t\tpaddingHorizontal: 10,\n\t\tpaddingVertical: 5\n\t},\n\tdate: {\n\t\tcolor: 'gray',\n\t\ttextAlign: 'center',\n\t\tfontSize: 14\n\t},\n\ttext: {\n\t\tcolor: 'gray',\n\t\tfontWeight: '500',\n\t\ttextAlign: 'center',\n\t\tfontSize: 14\n\t}\n})\n"]}
@@ -1,2 +0,0 @@
1
- import _extends from"@babel/runtime/helpers/extends";import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _jsxFileName="/Users/Fernando/Developer/Learning Babel/usechat/src/components/Chat/TypingFooter/index.tsx";import React,{useMemo}from'react';import{StyleSheet,View,Text}from'react-native';import TypingIndicator from'../../TypingIndicator';export default React.memo(function(_ref){var typingText=_ref.typingText,containerStyle=_ref.containerStyle,numberOfUsersTyping=_ref.numberOfUsersTyping,indicatorProps=_objectWithoutProperties(_ref,["typingText","containerStyle","numberOfUsersTyping"]);var extension=useMemo(function(){if(!numberOfUsersTyping)return'';return numberOfUsersTyping>1?'are':'is';},[numberOfUsersTyping]);return React.createElement(View,{style:[styles.container,containerStyle],__source:{fileName:_jsxFileName,lineNumber:19}},React.createElement(View,{style:styles.wrapper,__source:{fileName:_jsxFileName,lineNumber:20}},React.createElement(TypingIndicator,_extends({},indicatorProps,{__source:{fileName:_jsxFileName,lineNumber:21}})),!!typingText&&!!numberOfUsersTyping&&React.createElement(Text,{style:styles.text,__source:{fileName:_jsxFileName,lineNumber:23}},typingText," ",extension," typing...")));});var styles=StyleSheet.create({container:{alignItems:'flex-start',padding:10,paddingBottom:5},wrapper:{flexDirection:'row',alignItems:'center'},text:{color:'gray',fontStyle:'italic',marginLeft:10}});
2
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["index.tsx"],"names":["React","useMemo","StyleSheet","View","Text","TypingIndicator","memo","typingText","containerStyle","numberOfUsersTyping","indicatorProps","extension","styles","container","wrapper","text","create","alignItems","padding","paddingBottom","flexDirection","color","fontStyle","marginLeft"],"mappings":"yPAAA,MAAOA,CAAAA,KAAP,EAAgBC,OAAhB,KAA+B,OAA/B,CACA,OAASC,UAAT,CAAqBC,IAArB,CAA2BC,IAA3B,KAAuC,cAAvC,CAGA,MAAOC,CAAAA,eAAP,KAA4B,uBAA5B,CAEA,cAAeL,CAAAA,KAAK,CAACM,IAAN,CACd,cAKyB,IAJxBC,CAAAA,UAIwB,MAJxBA,UAIwB,CAHxBC,cAGwB,MAHxBA,cAGwB,CAFxBC,mBAEwB,MAFxBA,mBAEwB,CADrBC,cACqB,sFACxB,GAAMC,CAAAA,SAAS,CAAGV,OAAO,CAAC,UAAM,CAC/B,GAAI,CAACQ,mBAAL,CAA0B,MAAO,EAAP,CAC1B,MAAOA,CAAAA,mBAAmB,CAAG,CAAtB,CAA0B,KAA1B,CAAkC,IAAzC,CACA,CAHwB,CAGtB,CAACA,mBAAD,CAHsB,CAAzB,CAIA,MACC,qBAAC,IAAD,EAAM,KAAK,CAAE,CAACG,MAAM,CAACC,SAAR,CAAmBL,cAAnB,CAAb,iDACC,oBAAC,IAAD,EAAM,KAAK,CAAEI,MAAM,CAACE,OAApB,iDACC,oBAAC,eAAD,aAAqBJ,cAArB,mDADD,CAEE,CAAC,CAACH,UAAF,EAAgB,CAAC,CAACE,mBAAlB,EACA,oBAAC,IAAD,EAAM,KAAK,CAAEG,MAAM,CAACG,IAApB,iDACER,UADF,KACeI,SADf,cAHF,CADD,CADD,CAYA,CAvBa,CAAf,CA0BA,GAAMC,CAAAA,MAAM,CAAGV,UAAU,CAACc,MAAX,CAAkB,CAChCH,SAAS,CAAE,CACVI,UAAU,CAAE,YADF,CAEVC,OAAO,CAAE,EAFC,CAGVC,aAAa,CAAE,CAHL,CADqB,CAMhCL,OAAO,CAAE,CACRM,aAAa,CAAE,KADP,CAERH,UAAU,CAAE,QAFJ,CANuB,CAUhCF,IAAI,CAAE,CACLM,KAAK,CAAE,MADF,CAELC,SAAS,CAAE,QAFN,CAGLC,UAAU,CAAE,EAHP,CAV0B,CAAlB,CAAf","sourcesContent":["import React, { useMemo } from 'react'\nimport { StyleSheet, View, Text } from 'react-native'\n// import Juice from 'usechat'\nimport { TypingFooterProps } from '../types'\nimport TypingIndicator from '../../TypingIndicator'\n\nexport default React.memo(\n\t({\n\t\ttypingText,\n\t\tcontainerStyle,\n\t\tnumberOfUsersTyping,\n\t\t...indicatorProps\n\t}: TypingFooterProps) => {\n\t\tconst extension = useMemo(() => {\n\t\t\tif (!numberOfUsersTyping) return ''\n\t\t\treturn numberOfUsersTyping > 1 ? 'are' : 'is'\n\t\t}, [numberOfUsersTyping])\n\t\treturn (\n\t\t\t<View style={[styles.container, containerStyle]}>\n\t\t\t\t<View style={styles.wrapper}>\n\t\t\t\t\t<TypingIndicator {...indicatorProps} />\n\t\t\t\t\t{!!typingText && !!numberOfUsersTyping && (\n\t\t\t\t\t\t<Text style={styles.text}>\n\t\t\t\t\t\t\t{typingText} {extension} typing...\n\t\t\t\t\t\t</Text>\n\t\t\t\t\t)}\n\t\t\t\t</View>\n\t\t\t</View>\n\t\t)\n\t}\n)\n\nconst styles = StyleSheet.create({\n\tcontainer: {\n\t\talignItems: 'flex-start',\n\t\tpadding: 10,\n\t\tpaddingBottom: 5\n\t},\n\twrapper: {\n\t\tflexDirection: 'row',\n\t\talignItems: 'center'\n\t},\n\ttext: {\n\t\tcolor: 'gray',\n\t\tfontStyle: 'italic',\n\t\tmarginLeft: 10\n\t}\n})\n"]}
@@ -1,2 +0,0 @@
1
- import _toConsumableArray from"@babel/runtime/helpers/toConsumableArray";import _defineProperty from"@babel/runtime/helpers/defineProperty";import _extends from"@babel/runtime/helpers/extends";var _jsxFileName="/Users/Fernando/Developer/Learning Babel/usechat/src/components/Chat/index.tsx";function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);if(enumerableOnly)symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable;});keys.push.apply(keys,symbols);}return keys;}function _objectSpread(target){for(var i=1;i<arguments.length;i++){var source=arguments[i]!=null?arguments[i]:{};if(i%2){ownKeys(Object(source),true).forEach(function(key){_defineProperty(target,key,source[key]);});}else if(Object.getOwnPropertyDescriptors){Object.defineProperties(target,Object.getOwnPropertyDescriptors(source));}else{ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key));});}}return target;}import React,{useMemo,useRef,useEffect,useCallback}from'react';import{SafeAreaView,View,StyleSheet,Animated,KeyboardAvoidingView,Alert,Clipboard}from'react-native';import{Transitioning,Transition}from'react-native-reanimated';import Message from'./Message';import Composer from'./Composer';import SystemMessage from'./SystemMessage';import TypingFooter from'./TypingFooter';function Chat(props){var checkForBrokenProps=function checkForBrokenProps(){if(!props.user.name){console.error('Breaking error: Messages component is missing a name in the user prop.');}if(!props.user.id){console.error('Breaking error: Messages component is missing an id in the user prop.');}};checkForBrokenProps();var ref=props.chatRef;var inputRef=useRef();var flatListRef=useRef();var componentRef=useRef();useEffect(function(){componentRef.current={focusInput:function focusInput(){var _inputRef$current;return(_inputRef$current=inputRef.current)==null?void 0:_inputRef$current.focus();},blurInput:function blurInput(){var _inputRef$current2;return(_inputRef$current2=inputRef.current)==null?void 0:_inputRef$current2.blur();},scrollToEnd:function scrollToEnd(){var _flatListRef$current;return(_flatListRef$current=flatListRef.current)==null?void 0:_flatListRef$current.getNode().scrollToEnd();},scrollToIndex:function scrollToIndex(params){var _flatListRef$current2;return(_flatListRef$current2=flatListRef.current)==null?void 0:_flatListRef$current2.getNode().scrollToIndex(params);},scrollToItem:function scrollToItem(params){var _flatListRef$current3;return(_flatListRef$current3=flatListRef.current)==null?void 0:_flatListRef$current3.getNode().scrollToItem(params);},scrollToOffset:function scrollToOffset(params){var _flatListRef$current4;return(_flatListRef$current4=flatListRef.current)==null?void 0:_flatListRef$current4.getNode().scrollToOffset(params);}};if(ref)ref.current=componentRef.current;});var transitionRef=useRef(null);var mounted=useRef(false);var scrollY=useMemo(function(){return props.animatedScrollNode||new Animated.Value(0);},[props.animatedScrollNode]);var onScroll=Animated.event([{nativeEvent:{contentOffset:{y:scrollY}}}],{useNativeDriver:true});var messagesRef=useRef(props.messages);useEffect(function(){var latestMessageIsNew=(props.messages[0]&&props.messages[0].id)!==(messagesRef.current[0]&&messagesRef.current[0].id);if(latestMessageIsNew&&flatListRef.current){var iSentLastMessage=props.messages[0]&&props.messages[0].user&&props.messages[0].user.id===props.user.id;if(iSentLastMessage&&!props.disableScrollToBottomOnSend)flatListRef.current.getNode().scrollToOffset({offset:0});else if(props.scrollToBottomOnAllNewMessages)flatListRef.current.getNode().scrollToOffset({offset:0});}},[props.disableScrollToBottomOnSend,props.scrollToBottomOnAllNewMessages,props.messages,props.user.id]);var onViewableItemsChangedRef=useRef(props.onViewableItemsChanged);var onViewMessagesRef=useRef(props.onViewMessages);var messagesDict=useRef({});useEffect(function(){onViewableItemsChangedRef.current=props.onViewableItemsChanged;onViewMessagesRef.current=props.onViewMessages;messagesRef.current=props.messages;messagesDict.current={};if(props.messages){props.messages.forEach(function(message){messagesDict.current[message.id]=message;});}},[props.onViewableItemsChanged,props.onViewMessages,props.messages]);var onViewableItemsChanged=useCallback(function(info){if(onViewableItemsChangedRef.current)onViewableItemsChangedRef.current(info);if(onViewMessagesRef.current){var visibleMessages=info.viewableItems.filter(function(i){return i.isViewable;}).map(function(i){return i.item;});var latestMessageId=messagesRef.current&&messagesRef.current[0]&&messagesRef.current[0].id;onViewMessagesRef.current({visibleMessages:visibleMessages,latestMessageId:latestMessageId});}},[]);var numberOfUsersTyping=useMemo(function(){var _ref,_props$namesOfUsersTy;return(_ref=(_props$namesOfUsersTy=props.namesOfUsersTyping)==null?void 0:_props$namesOfUsersTy.length)!=null?_ref:0;},[props.namesOfUsersTyping]);useEffect(function(){if(!props.disableTransitions&&(mounted.current||!props.disableTransitionOnMount)&&transitionRef.current)transitionRef.current.animateNextTransition();else mounted.current=true;},[props.disableTransitionOnMount,numberOfUsersTyping,props.messages,props.disableTransitions]);var onPressMessage=props.onPressMessage,onDoubleTapMessage=props.onDoubleTapMessage,onLongPressMessage=props.onLongPressMessage;var onPressItem=useCallback(function(id){var _messagesDict$current;var message=(_messagesDict$current=messagesDict.current)==null?void 0:_messagesDict$current[id];if(onPressMessage)onPressMessage(message);},[onPressMessage]);var onDoubleTapItem=useCallback(function(id){var _messagesDict$current2;var message=(_messagesDict$current2=messagesDict.current)==null?void 0:_messagesDict$current2[id];if(onDoubleTapMessage)onDoubleTapMessage(message);},[onDoubleTapMessage]);var onLongPressItem=useCallback(function(id){var _messagesDict$current3;var message=(_messagesDict$current3=messagesDict.current)==null?void 0:_messagesDict$current3[id];if(onLongPressMessage)return onLongPressMessage(message);if(message&&message.text){Alert.alert('Message',message.text,[{text:'Copy text',onPress:function onPress(){Clipboard.setString(message.text);},style:'cancel'},{text:'Go back'}]);}},[onLongPressMessage]);var renderItem=function renderItem(info){var _message$media,_message$media2,_message$media3,_message$media4,_message$media5;if(props.renderItem)return props.renderItem(info);if(props.renderMessage===null)return null;var message=info.item,index=info.index;if(message.system){var systemProps={text:message.text,createdAt:message.createdAt,textStyle:props.systemMessageTextStyle,containerStyle:props.systemMessageContainerStyle,dateToStringFunc:props.systemMessageDateToStringFunc,dateStyle:props.systemMessageDateStyle};if(props.renderSystemMessage===null)return null;if(props.renderSystemMessage)return props.renderSystemMessage(systemProps);return React.createElement(SystemMessage,_extends({},systemProps,{__source:{fileName:_jsxFileName,lineNumber:268}}));}var isMe=message.user.id===props.user.id;var messageCreatesNewBunch=!(props.messages[index+1]&&props.messages[index+1].user&&props.messages[index+1].user.id===(props.messages[index]&&props.messages[index].user&&props.messages[index].user.id));var isMostRecentMessageInBunch=!(props.messages[index-1]&&props.messages[index-1].user&&props.messages[index-1].user.id===(props.messages[index]&&props.messages[index].user&&props.messages[index].user.id));var showName=props.showNameForEveryMessage||messageCreatesNewBunch;if(isMe&&!props.showMyName)showName=false;var showAvatar=props.showAvatarForEveryMessage||isMostRecentMessageInBunch;var renderAvatar=props.renderAvatar;if(isMe&&props.hideMyAvatar){renderAvatar=null;}var bubbleStyle=props.bubbleStyle==null?void 0:props.bubbleStyle({isMe:isMe});var messageContainerStyle=props.messageContainerStyle==null?void 0:props.messageContainerStyle({isMe:isMe});var bubbleTextStyle=props.bubbleTextStyle==null?void 0:props.bubbleTextStyle({isMe:isMe});var messageWrapperStyle=props.messageWrapperStyle==null?void 0:props.messageWrapperStyle({isMe:isMe});var bubbleBackgroundColor=props.bubbleBackgroundColor==null?void 0:props.bubbleBackgroundColor({isMe:isMe});var bubbleTextColor=props.bubbleTextColor==null?void 0:props.bubbleTextColor({isMe:isMe});var initialsBackgroundColor=props.initialsBackgroundColor==null?void 0:props.initialsBackgroundColor({isMe:isMe});var initialsTextColor=props.initialsTextColor==null?void 0:props.initialsTextColor({isMe:isMe});var messageProps={messageContainerStyle:messageContainerStyle,bubbleStyle:bubbleStyle,bubbleTextStyle:bubbleTextStyle,messageWrapperStyle:messageWrapperStyle,delivered:true,isMe:isMe,renderFooter:props.renderMessageFooter,imageProps:props.imageProps,name:message.user.name,system:message.system,text:message.text,read:true,renderMedia:props.renderMessageMedia,onLongPress:onLongPressItem,onPress:onPressItem,onDoubleTap:onDoubleTapItem,doubleTapDelay:props.messageDoubleTapDelay,disableSwipeActions:props.disableSwipeActions,swipeActions:props.swipeActions,longPressDelay:props.messageLongPressDelay,id:message.id,showName:showName,avatar:message.user.avatar,avatarImageProps:props.avatarImageProps,avatarSize:props.avatarSize,renderAvatar:renderAvatar,showAvatar:showAvatar,initialsBackgroundColor:initialsBackgroundColor,initialsTextColor:initialsTextColor,renderInitials:props.renderInitials,nameStyle:props.nameStyle,tintColor:props.tintColor,swipeActionWidth:props.swipeActionWidth,renderSwipeAction:props.renderSwipeAction,bubbleBackgroundColor:bubbleBackgroundColor,bubbleTextColor:bubbleTextColor,userId:message.user.id,userName:message.user.name,AvatarImageComponent:props.AvatarImageComponent,mediaHeight:(_message$media=message.media)==null?void 0:_message$media.height,mediaWidth:(_message$media2=message.media)==null?void 0:_message$media2.width,mediaUri:(_message$media3=message.media)==null?void 0:_message$media3.uri,mediaContentType:(_message$media4=message.media)==null?void 0:_message$media4.contentType,mediaUrl:(_message$media5=message.media)==null?void 0:_message$media5.url,createsNewBunch:messageCreatesNewBunch,renderText:props.renderMessageText,createdAt:message.createdAt};if(props.renderMessage)return props.renderMessage(messageProps);return React.createElement(Message,_extends({},messageProps,{__source:{fileName:_jsxFileName,lineNumber:372}}));};var keyExtractor=useMemo(function(){return props.keyExtractor||function(_ref2){var id=_ref2.id;return id;};},[props.keyExtractor]);var namesOfUsersTyping=useMemo(function(){return props.namesOfUsersTyping||[];},[props.namesOfUsersTyping]);var typingText=namesOfUsersTyping.join(', ');var renderTypingIndicator=props.renderTypingIndicator,typingIndicatorProps=props.typingIndicatorProps;var ListFooterComponent=useCallback(function(){if(renderTypingIndicator===null||!numberOfUsersTyping)return null;return React.createElement(TypingFooter,_extends({typingText:props.showTypingText?typingText:'',numberOfUsersTyping:numberOfUsersTyping},typingIndicatorProps,{__source:{fileName:_jsxFileName,lineNumber:437}}));},[typingText,props.showTypingText,renderTypingIndicator,numberOfUsersTyping,typingIndicatorProps]);var flatListProps=props.flatListProps,_props$keyboardDismis=props.keyboardDismissMode,keyboardDismissMode=_props$keyboardDismis===void 0?'interactive':_props$keyboardDismis,_props$keyboardShould=props.keyboardShouldPersistTaps,keyboardShouldPersistTaps=_props$keyboardShould===void 0?'handled':_props$keyboardShould,extraData=props.extraData,messages=props.messages,contentContainerStyle=props.contentContainerStyle;var renderList=function renderList(){return React.createElement(Animated.FlatList,_extends({},flatListProps,{ref:flatListRef,data:messages,keyExtractor:keyExtractor,renderItem:renderItem,extraData:extraData,ListHeaderComponent:ListFooterComponent,inverted:true,onScroll:onScroll,onViewableItemsChanged:onViewableItemsChanged,keyboardShouldPeristTaps:keyboardShouldPersistTaps,keyboardDismissMode:keyboardDismissMode,contentContainerStyle:_objectSpread({},styles.contentContainer,{},contentContainerStyle||{}),initialNumToRender:20,__source:{fileName:_jsxFileName,lineNumber:461}}));};var renderHeader=function renderHeader(){if(props.renderHeader)return props.renderHeader();return null;};var renderFooter=function renderFooter(){if(props.renderFooter)return props.renderFooter();return null;};var renderComposer=function renderComposer(){if(props.renderComposer===null)return null;var composerProps={onInputTextChanged:props.onInputTextChanged,text:props.text,initialText:props.initialText,placeholderColor:props.placeholderColor,placeholderText:props.placeholderText,renderSendButton:props.renderSendButton,renderTextInput:props.renderTextInput,textInputProps:props.textInputProps,media:props.media,onChangeMedia:props.onChangeMedia,user:props.user,onSend:props.onSend,sendButtonMode:props.sendButtonMode,containerStyle:props.composerContainerStyle,inputContainerStyle:props.inputContainerStyle,inputStyle:props.inputStyle,tintColor:props.tintColor,inputRef:inputRef,sendButtonContainerStyle:props.sendButtonContainerStyle,sendOnKeyboardReturn:props.sendOnKeyboardReturn};if(props.renderComposer)return props.renderComposer(composerProps);return React.createElement(Composer,_extends({},composerProps,{__source:{fileName:_jsxFileName,lineNumber:531}}));};var Container=props.ContainerComponent||(props.safeArea?SafeAreaView:View);var KeyboardView=props.avoidKeyboard===false?View:KeyboardAvoidingView;var transition=useMemo(function(){return props.transitionConfig||true&&React.createElement(Transition.Together,{__source:{fileName:_jsxFileName,lineNumber:545}},React.createElement(Transition.Change,{interpolation:"easeInOut",__source:{fileName:_jsxFileName,lineNumber:547}}),React.createElement(Transition.In,{type:"fade",__source:{fileName:_jsxFileName,lineNumber:548}}));},[props.transitionConfig]);var containerStyle=useMemo(function(){return _objectSpread({},styles.container,{},props.containerStyle);},[props.containerStyle]);return React.createElement(Transitioning.View,{ref:transitionRef,transition:transition,style:containerStyle,__source:{fileName:_jsxFileName,lineNumber:561}},React.createElement(Container,{style:containerStyle,__source:{fileName:_jsxFileName,lineNumber:566}},React.createElement(KeyboardView,{style:containerStyle,behavior:"padding",__source:{fileName:_jsxFileName,lineNumber:567}},renderHeader(),renderList(),renderFooter(),renderComposer())));}Chat.append=function(state,messages){return[].concat(_toConsumableArray(messages),_toConsumableArray(state));};export default Chat;var styles=StyleSheet.create({container:{flex:1},contentContainer:{flexGrow:1,marginTop:5}});
2
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["index.tsx"],"names":["React","useMemo","useRef","useEffect","useCallback","SafeAreaView","View","StyleSheet","Animated","KeyboardAvoidingView","Alert","Clipboard","Transitioning","Transition","Message","Composer","SystemMessage","TypingFooter","Chat","props","checkForBrokenProps","user","name","console","error","id","ref","chatRef","inputRef","flatListRef","componentRef","current","focusInput","focus","blurInput","blur","scrollToEnd","getNode","scrollToIndex","params","scrollToItem","scrollToOffset","transitionRef","mounted","scrollY","animatedScrollNode","Value","onScroll","event","nativeEvent","contentOffset","y","useNativeDriver","messagesRef","messages","latestMessageIsNew","iSentLastMessage","disableScrollToBottomOnSend","offset","scrollToBottomOnAllNewMessages","onViewableItemsChangedRef","onViewableItemsChanged","onViewMessagesRef","onViewMessages","messagesDict","forEach","message","info","visibleMessages","viewableItems","filter","i","isViewable","map","item","latestMessageId","numberOfUsersTyping","namesOfUsersTyping","length","disableTransitions","disableTransitionOnMount","animateNextTransition","onPressMessage","onDoubleTapMessage","onLongPressMessage","onPressItem","onDoubleTapItem","onLongPressItem","text","alert","onPress","setString","style","renderItem","renderMessage","index","system","systemProps","createdAt","textStyle","systemMessageTextStyle","containerStyle","systemMessageContainerStyle","dateToStringFunc","systemMessageDateToStringFunc","dateStyle","systemMessageDateStyle","renderSystemMessage","isMe","messageCreatesNewBunch","isMostRecentMessageInBunch","showName","showNameForEveryMessage","showMyName","showAvatar","showAvatarForEveryMessage","renderAvatar","hideMyAvatar","bubbleStyle","messageContainerStyle","bubbleTextStyle","messageWrapperStyle","bubbleBackgroundColor","bubbleTextColor","initialsBackgroundColor","initialsTextColor","messageProps","delivered","renderFooter","renderMessageFooter","imageProps","read","renderMedia","renderMessageMedia","onLongPress","onDoubleTap","doubleTapDelay","messageDoubleTapDelay","disableSwipeActions","swipeActions","longPressDelay","messageLongPressDelay","avatar","avatarImageProps","avatarSize","renderInitials","nameStyle","tintColor","swipeActionWidth","renderSwipeAction","userId","userName","AvatarImageComponent","mediaHeight","media","height","mediaWidth","width","mediaUri","uri","mediaContentType","contentType","mediaUrl","url","createsNewBunch","renderText","renderMessageText","keyExtractor","typingText","join","renderTypingIndicator","typingIndicatorProps","ListFooterComponent","showTypingText","flatListProps","keyboardDismissMode","keyboardShouldPersistTaps","extraData","contentContainerStyle","renderList","styles","contentContainer","renderHeader","renderComposer","composerProps","onInputTextChanged","initialText","placeholderColor","placeholderText","renderSendButton","renderTextInput","textInputProps","onChangeMedia","onSend","sendButtonMode","composerContainerStyle","inputContainerStyle","inputStyle","sendButtonContainerStyle","sendOnKeyboardReturn","Container","ContainerComponent","safeArea","KeyboardView","avoidKeyboard","transition","transitionConfig","container","append","state","create","flex","flexGrow","marginTop"],"mappings":"+jCAAA,MAAOA,CAAAA,KAAP,EACCC,OADD,CAECC,MAFD,CAGCC,SAHD,CAICC,WAJD,KAMO,OANP,CAOA,OAGCC,YAHD,CAICC,IAJD,CAKCC,UALD,CAMCC,QAND,CASCC,oBATD,CAUCC,KAVD,CAWCC,SAXD,KAYO,cAZP,CAaA,OACC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AAI,CAAC,MAApB,kDAHD,CAHF,EADyB,CAUzB,CAAC3L,KAAK,CAAC2L,gBAAP,CAVyB,CAA1B,CAYA,GAAMzG,CAAAA,cAAc,CAAGpG,OAAO,CAC7B,mCACImL,MAAM,CAAC2B,SADX,IAEI5L,KAAK,CAACkF,cAFV,GAD6B,CAK7B,CAAClF,KAAK,CAACkF,cAAP,CAL6B,CAA9B,CAOA,MACC,qBAAC,aAAD,CAAe,IAAf,EACC,GAAG,CAAE3D,aADN,CAEC,UAAU,CAAEmK,UAFb,CAGC,KAAK,CAAExG,cAHR,kDAKC,oBAAC,SAAD,EAAW,KAAK,CAAEA,cAAlB,kDACC,oBAAC,YAAD,EACC,KAAK,CAAEA,cADR,CAGC,QAAQ,CAAC,SAHV,kDAKEiF,YAAY,EALd,CAMEH,UAAU,EANZ,CAOEnD,YAAY,EAPd,CAQEuD,cAAc,EARhB,CADD,CALD,CADD,CAoBA,CAEDrK,IAAI,CAAC8L,MAAL,CAAc,SAAYC,KAAZ,CAAwB3J,QAAxB,CAAuC,CACpD,mCAAWA,QAAX,qBAAwB2J,KAAxB,GACA,CAFD,CAIA,cAAe/L,CAAAA,IAAf,CAEA,GAAMkK,CAAAA,MAAM,CAAG7K,UAAU,CAAC2M,MAAX,CAAkB,CAChCH,SAAS,CAAE,CACVI,IAAI,CAAE,CADI,CADqB,CAIhC9B,gBAAgB,CAAE,CACjB+B,QAAQ,CAAE,CADO,CAEjBC,SAAS,CAAE,CAFM,CAJc,CAAlB,CAAf","sourcesContent":["import React, {\n\tuseMemo,\n\tuseRef,\n\tuseEffect,\n\tuseCallback,\n\tMutableRefObject,\n} from 'react'\nimport {\n\tFlatList,\n\tListRenderItemInfo,\n\tSafeAreaView,\n\tView,\n\tStyleSheet,\n\tAnimated,\n\tViewToken,\n\tTextInput,\n\tKeyboardAvoidingView,\n\tAlert,\n\tClipboard,\n} from 'react-native'\nimport {\n\tTransitioning,\n\tTransition,\n\tTransitioningView,\n} from 'react-native-reanimated'\nimport { NewMessageModel } from '../../classes/Message/types'\nimport Message from './Message'\nimport {\n\tChatProps,\n\tMessageProps,\n\tComposerProps,\n\tSystemMessageProps,\n\tChatRef,\n} from './types'\nimport Composer from './Composer'\nimport SystemMessage from './SystemMessage'\nimport TypingFooter from './TypingFooter'\n\nfunction Chat<MessageModel extends NewMessageModel = NewMessageModel>(\n\tprops: ChatProps<MessageModel>\n) {\n\tconst checkForBrokenProps = () => {\n\t\tif (!props.user.name) {\n\t\t\tconsole.error(\n\t\t\t\t'Breaking error: Messages component is missing a name in the user prop.'\n\t\t\t)\n\t\t}\n\t\tif (!props.user.id) {\n\t\t\tconsole.error(\n\t\t\t\t'Breaking error: Messages component is missing an id in the user prop.'\n\t\t\t)\n\t\t}\n\t}\n\tcheckForBrokenProps()\n\t// \"constructor\" variables\n\tconst { chatRef: ref } = props\n\tconst inputRef = useRef<TextInput>()\n\tconst flatListRef = useRef<typeof Animated.ScrollView>()\n\t// const flatListRef = useRef<typeof Animated.FlatList<MessageModel>>()\n\tconst componentRef = useRef<ChatRef<MessageModel>>()\n\n\tuseEffect(() => {\n\t\tcomponentRef.current = {\n\t\t\tfocusInput: () => inputRef.current?.focus(),\n\t\t\tblurInput: () => inputRef.current?.blur(),\n\t\t\tscrollToEnd: () => flatListRef.current?.getNode().scrollToEnd(),\n\t\t\tscrollToIndex: params =>\n\t\t\t\tflatListRef.current?.getNode().scrollToIndex(params),\n\t\t\tscrollToItem: params =>\n\t\t\t\tflatListRef.current?.getNode().scrollToItem(params),\n\t\t\tscrollToOffset: params =>\n\t\t\t\tflatListRef.current?.getNode().scrollToOffset(params),\n\t\t}\n\t\tif (ref) ref.current = componentRef.current\n\t})\n\n\t// if (!componentRef.current) {\n\t// \tcomponentRef.current = {\n\t// \t\tfocusInput: () => inputRef.current && inputRef.current.focus(),\n\t// \t\tblurInput: () => inputRef.current && inputRef.current.blur(),\n\t// \t\tscrollToEnd: () =>\n\t// \t\t\tflatListRef.current && flatListRef.current.getNode().scrollToEnd(),\n\t// \t\tscrollToIndex: params =>\n\t// \t\t\tflatListRef.current &&\n\t// \t\t\tflatListRef.current.getNode().scrollToIndex(params),\n\t// \t\tscrollToItem: params =>\n\t// \t\t\tflatListRef.current &&\n\t// \t\t\tflatListRef.current.getNode().scrollToItem(params),\n\t// \t\tscrollToOffset: params =>\n\t// \t\t\tflatListRef.current &&\n\t// \t\t\tflatListRef.current.getNode().scrollToOffset(params),\n\t// \t}\n\t// \tif (ref) ref.current = componentRef.current\n\t// }\n\n\t// used to shuffle/transition the inbox when it changes\n\tconst transitionRef = useRef<TransitioningView>(null)\n\tconst mounted = useRef(false)\n\n\t// track animated position of scroll\n\tconst scrollY: Animated.Value = useMemo(\n\t\t() => props.animatedScrollNode || new Animated.Value(0),\n\t\t[props.animatedScrollNode]\n\t)\n\n\t// upate position of scroll variable\n\tconst onScroll = Animated.event(\n\t\t[{ nativeEvent: { contentOffset: { y: scrollY } } }],\n\t\t{ useNativeDriver: true }\n\t)\n\n\tconst messagesRef = useRef(props.messages)\n\n\t// effect to handle new messages coming in / scrolling to bottom\n\t// TODO we may have to use getNode() for the animated flatlist, right?\n\tuseEffect(() => {\n\t\tconst latestMessageIsNew =\n\t\t\t(props.messages[0] && props.messages[0].id) !==\n\t\t\t(messagesRef.current[0] && messagesRef.current[0].id)\n\t\t// const numberOfMessagesIncreased =\n\t\t// \tprops.messages.length > messagesRef.current.length\n\t\tif (\n\t\t\tlatestMessageIsNew &&\n\t\t\t// numberOfMessagesIncreased &&\n\t\t\tflatListRef.current\n\t\t) {\n\t\t\tconst iSentLastMessage =\n\t\t\t\tprops.messages[0] &&\n\t\t\t\tprops.messages[0].user &&\n\t\t\t\tprops.messages[0].user.id === props.user.id\n\t\t\tif (iSentLastMessage && !props.disableScrollToBottomOnSend)\n\t\t\t\tflatListRef.current.getNode().scrollToOffset({ offset: 0 })\n\t\t\telse if (props.scrollToBottomOnAllNewMessages)\n\t\t\t\tflatListRef.current.getNode().scrollToOffset({ offset: 0 })\n\t\t}\n\t}, [\n\t\tprops.disableScrollToBottomOnSend,\n\t\tprops.scrollToBottomOnAllNewMessages,\n\t\tprops.messages,\n\t\tprops.user.id,\n\t])\n\n\t// 💩 a super way of handling viewable items not on the fly. (easy way to track viewed messages)\n\t// TODO abstract this to a different custom hook.\n\tconst onViewableItemsChangedRef = useRef(props.onViewableItemsChanged)\n\tconst onViewMessagesRef = useRef(props.onViewMessages)\n\t// track the messages in a non-array too for fast querying.\n\tconst messagesDict = useRef<{ [id: string]: MessageModel }>({})\n\t// ...onto the effect 😅\n\tuseEffect(() => {\n\t\t// make updated methods available to onviewable items changed\n\t\tonViewableItemsChangedRef.current = props.onViewableItemsChanged\n\t\tonViewMessagesRef.current = props.onViewMessages\n\t\tmessagesRef.current = props.messages\n\t\tmessagesDict.current = {}\n\t\tif (props.messages) {\n\t\t\tprops.messages.forEach(message => {\n\t\t\t\tmessagesDict.current[message.id] = message\n\t\t\t})\n\t\t}\n\t}, [props.onViewableItemsChanged, props.onViewMessages, props.messages])\n\n\tconst onViewableItemsChanged: FlatList<\n\t\tMessageModel\n\t>['props']['onViewableItemsChanged'] = useCallback(\n\t\t(info: { viewableItems: ViewToken[]; changed: ViewToken[] }) => {\n\t\t\tif (onViewableItemsChangedRef.current)\n\t\t\t\tonViewableItemsChangedRef.current(info)\n\n\t\t\tif (onViewMessagesRef.current) {\n\t\t\t\tconst visibleMessages = info.viewableItems\n\t\t\t\t\t.filter(i => i.isViewable)\n\t\t\t\t\t.map(i => i.item)\n\t\t\t\tconst latestMessageId =\n\t\t\t\t\tmessagesRef.current &&\n\t\t\t\t\tmessagesRef.current[0] &&\n\t\t\t\t\tmessagesRef.current[0].id\n\t\t\t\tonViewMessagesRef.current({\n\t\t\t\t\tvisibleMessages,\n\t\t\t\t\tlatestMessageId,\n\t\t\t\t})\n\t\t\t}\n\t\t},\n\t\t[]\n\t)\n\t// END OF THAT 💩\n\n\tconst numberOfUsersTyping = useMemo(\n\t\t() => props.namesOfUsersTyping?.length ?? 0,\n\t\t[props.namesOfUsersTyping]\n\t)\n\t// effect to handle animating the screen if the messages changed or people typing just changed\n\tuseEffect(() => {\n\t\tif (\n\t\t\t!props.disableTransitions &&\n\t\t\t// if we've already mounted, or we want to transition even if we haven't...\n\t\t\t(mounted.current || !props.disableTransitionOnMount) &&\n\t\t\t// and assuming the transition component is initialized...\n\t\t\ttransitionRef.current\n\t\t)\n\t\t\t// animate\n\t\t\ttransitionRef.current.animateNextTransition()\n\t\telse mounted.current = true\n\t}, [\n\t\tprops.disableTransitionOnMount,\n\t\tnumberOfUsersTyping,\n\t\tprops.messages,\n\t\tprops.disableTransitions,\n\t])\n\n\tconst { onPressMessage, onDoubleTapMessage, onLongPressMessage } = props\n\tconst onPressItem = useCallback(\n\t\tid => {\n\t\t\tconst message = messagesDict.current?.[id]\n\t\t\tif (onPressMessage) onPressMessage(message)\n\t\t},\n\t\t[onPressMessage]\n\t)\n\n\tconst onDoubleTapItem = useCallback(\n\t\tid => {\n\t\t\tconst message = messagesDict.current?.[id]\n\t\t\tif (onDoubleTapMessage) onDoubleTapMessage(message)\n\t\t},\n\t\t[onDoubleTapMessage]\n\t)\n\n\tconst onLongPressItem = useCallback(\n\t\tid => {\n\t\t\tconst message = messagesDict.current?.[id]\n\t\t\tif (onLongPressMessage) return onLongPressMessage(message)\n\t\t\tif (message && message.text) {\n\t\t\t\tAlert.alert('Message', message.text, [\n\t\t\t\t\t{\n\t\t\t\t\t\ttext: 'Copy text',\n\t\t\t\t\t\tonPress: () => {\n\t\t\t\t\t\t\tClipboard.setString(message.text)\n\t\t\t\t\t\t},\n\t\t\t\t\t\tstyle: 'cancel',\n\t\t\t\t\t},\n\t\t\t\t\t{ text: 'Go back' },\n\t\t\t\t])\n\t\t\t}\n\t\t},\n\t\t[onLongPressMessage]\n\t)\n\n\tconst renderItem = (info: ListRenderItemInfo<MessageModel>) => {\n\t\tif (props.renderItem) return props.renderItem(info)\n\t\tif (props.renderMessage === null) return null\n\n\t\tconst { item: message, index } = info\n\n\t\tif (message.system) {\n\t\t\tconst systemProps: SystemMessageProps = {\n\t\t\t\ttext: message.text,\n\t\t\t\tcreatedAt: message.createdAt,\n\t\t\t\ttextStyle: props.systemMessageTextStyle,\n\t\t\t\tcontainerStyle: props.systemMessageContainerStyle,\n\t\t\t\tdateToStringFunc: props.systemMessageDateToStringFunc,\n\t\t\t\tdateStyle: props.systemMessageDateStyle,\n\t\t\t}\n\n\t\t\tif (props.renderSystemMessage === null) return null\n\t\t\tif (props.renderSystemMessage)\n\t\t\t\treturn props.renderSystemMessage(systemProps)\n\n\t\t\treturn <SystemMessage {...systemProps} />\n\t\t}\n\n\t\tconst isMe = message.user.id === props.user.id\n\n\t\t// indicates that the previous message was sent by someone else, so this starts a new bunch\n\t\tconst messageCreatesNewBunch = !(\n\t\t\tprops.messages[index + 1] &&\n\t\t\tprops.messages[index + 1].user &&\n\t\t\tprops.messages[index + 1].user.id ===\n\t\t\t\t(props.messages[index] &&\n\t\t\t\t\tprops.messages[index].user &&\n\t\t\t\t\tprops.messages[index].user.id)\n\t\t)\n\n\t\tconst isMostRecentMessageInBunch = !(\n\t\t\tprops.messages[index - 1] &&\n\t\t\tprops.messages[index - 1].user &&\n\t\t\tprops.messages[index - 1].user.id ===\n\t\t\t\t(props.messages[index] &&\n\t\t\t\t\tprops.messages[index].user &&\n\t\t\t\t\tprops.messages[index].user.id)\n\t\t)\n\n\t\t// show name if the previous message was sent by someone else\n\t\t// also, only show my own name if specified, since that's kinda weird to show my own. beat my dribble\n\t\tlet showName = props.showNameForEveryMessage || messageCreatesNewBunch\n\t\tif (isMe && !props.showMyName) showName = false\n\n\t\t// by default, only show avatar for a the bottom of a bunch\n\t\tconst showAvatar =\n\t\t\tprops.showAvatarForEveryMessage || isMostRecentMessageInBunch\n\t\tlet renderAvatar = props.renderAvatar\n\t\t// and we hide the avatar if we say to\n\t\tif (isMe && props.hideMyAvatar) {\n\t\t\t// showAvatar = false\n\t\t\trenderAvatar = null\n\t\t}\n\n\t\tconst bubbleStyle = props.bubbleStyle?.({ isMe })\n\t\tconst messageContainerStyle = props.messageContainerStyle?.({ isMe })\n\t\tconst bubbleTextStyle = props.bubbleTextStyle?.({ isMe })\n\t\tconst messageWrapperStyle = props.messageWrapperStyle?.({ isMe })\n\t\tconst bubbleBackgroundColor = props.bubbleBackgroundColor?.({ isMe })\n\t\tconst bubbleTextColor = props.bubbleTextColor?.({ isMe })\n\t\tconst initialsBackgroundColor = props.initialsBackgroundColor?.({ isMe })\n\t\tconst initialsTextColor = props.initialsTextColor?.({ isMe })\n\n\t\tconst messageProps: MessageProps = {\n\t\t\tmessageContainerStyle,\n\t\t\tbubbleStyle,\n\t\t\tbubbleTextStyle,\n\t\t\tmessageWrapperStyle,\n\t\t\tdelivered: true,\n\t\t\t// isMe: (message.user && message.user.id) === (props.user && props.user.id),\n\t\t\tisMe,\n\t\t\trenderFooter: props.renderMessageFooter,\n\t\t\timageProps: props.imageProps,\n\t\t\t// media: message.media,\n\t\t\tname: message.user.name,\n\t\t\tsystem: message.system,\n\t\t\ttext: message.text,\n\t\t\tread: true,\n\t\t\trenderMedia: props.renderMessageMedia,\n\t\t\tonLongPress: onLongPressItem,\n\t\t\tonPress: onPressItem,\n\t\t\t// pressType: props.messagePressType || 'double',\n\t\t\tonDoubleTap: onDoubleTapItem,\n\t\t\tdoubleTapDelay: props.messageDoubleTapDelay,\n\t\t\tdisableSwipeActions: props.disableSwipeActions,\n\t\t\tswipeActions: props.swipeActions,\n\t\t\tlongPressDelay: props.messageLongPressDelay,\n\t\t\tid: message.id,\n\t\t\tshowName,\n\t\t\tavatar: message.user.avatar,\n\t\t\tavatarImageProps: props.avatarImageProps,\n\t\t\tavatarSize: props.avatarSize,\n\t\t\trenderAvatar,\n\t\t\tshowAvatar,\n\t\t\t// initialsBackgroundColor: props.initialsBackgroundColor,\n\t\t\t// initialsTextColor: props.initialsTextColor,\n\t\t\tinitialsBackgroundColor,\n\t\t\tinitialsTextColor,\n\t\t\trenderInitials: props.renderInitials,\n\t\t\tnameStyle: props.nameStyle,\n\t\t\ttintColor: props.tintColor,\n\t\t\tswipeActionWidth: props.swipeActionWidth,\n\t\t\trenderSwipeAction: props.renderSwipeAction,\n\t\t\tbubbleBackgroundColor,\n\t\t\tbubbleTextColor,\n\t\t\tuserId: message.user.id,\n\t\t\tuserName: message.user.name,\n\t\t\tAvatarImageComponent: props.AvatarImageComponent,\n\t\t\tmediaHeight: message.media?.height,\n\t\t\tmediaWidth: message.media?.width,\n\t\t\tmediaUri: message.media?.uri,\n\t\t\tmediaContentType: message.media?.contentType,\n\t\t\tmediaUrl: message.media?.url,\n\t\t\tcreatesNewBunch: messageCreatesNewBunch,\n\t\t\trenderText: props.renderMessageText,\n\t\t\tcreatedAt: message.createdAt,\n\t\t}\n\n\t\tif (props.renderMessage) return props.renderMessage(messageProps)\n\t\treturn <Message {...messageProps} />\n\t}\n\t// \t,\n\t// \t[\n\t// \t\tprops.tintColor,\n\t// \t\tprops.user,\n\t// \t\tprops.renderItem,\n\t// \t\tprops.renderMessage,\n\t// \t\tprops.renderMessageFooter,\n\t// \t\tprops.renderSystemMessage,\n\t// \t\tprops.renderMessageMedia,\n\t// \t\tprops.onPressMessage,\n\t// \t\tprops.systemMessageContainerStyle,\n\t// \t\tprops.systemMessageDateToStringFunc,\n\t// \t\tprops.systemMessageDateStyle,\n\t// \t\tprops.systemMessageTextStyle,\n\t// \t\tprops.messages,\n\t// \t\tprops.showNameForEveryMessage,\n\t// \t\tprops.showMyName,\n\t// \t\tprops.showAvatarForEveryMessage,\n\t// \t\tprops.renderAvatar,\n\t// \t\tprops.hideMyAvatar,\n\t// \t\tprops.bubbleStyle,\n\t// \t\tprops.messageContainerStyle,\n\t// \t\tprops.bubbleTextStyle,\n\t// \t\tprops.messageWrapperStyle,\n\t// \t\tprops.bubbleBackgroundColor,\n\t// \t\tprops.bubbleTextStyle,\n\t// \t\tprops.bubbleTextColor,\n\t// \t\tprops.renderMessageFooter,\n\t// \t\tprops.imageProps,\n\t// \t\tprops.onLongPressMessage,\n\t// \t\tprops.messagePressType,\n\t// \t\tprops.onPressMessage,\n\t// \t\tprops.messageDoubleTapDelay,\n\t// \t\tprops.disableSwipeActions,\n\t// \t\tprops.swipeActionWidth,\n\t// \t\tprops.swipeActions,\n\t// \t\tprops.messageLongPressDelay,\n\t// \t\tprops.avatarImageProps,\n\t// \t\tprops.avatarSize,\n\t// \t\tprops.initialsBackgroundColor,\n\t// \t\tprops.initialsTextColor,\n\t// \t\tprops.renderInitials,\n\t// \t\tprops.nameStyle,\n\t// \t\tprops.swipeActionWidth,\n\t// \t\tprops.AvatarImageComponent,\n\t// \t],\n\t// )\n\n\tconst keyExtractor = useMemo(\n\t\t() => props.keyExtractor || (({ id }: MessageModel) => id),\n\t\t[props.keyExtractor]\n\t)\n\tconst namesOfUsersTyping = useMemo(() => props.namesOfUsersTyping || [], [\n\t\tprops.namesOfUsersTyping,\n\t])\n\n\tconst typingText = namesOfUsersTyping.join(', ')\n\n\tconst { renderTypingIndicator, typingIndicatorProps } = props\n\tconst ListFooterComponent = useCallback(() => {\n\t\tif (renderTypingIndicator === null || !numberOfUsersTyping) return null\n\n\t\treturn (\n\t\t\t<TypingFooter\n\t\t\t\ttypingText={props.showTypingText ? typingText : ''}\n\t\t\t\tnumberOfUsersTyping={numberOfUsersTyping}\n\t\t\t\t{...typingIndicatorProps}\n\t\t\t/>\n\t\t)\n\t}, [\n\t\ttypingText,\n\t\tprops.showTypingText,\n\t\trenderTypingIndicator,\n\t\tnumberOfUsersTyping,\n\t\ttypingIndicatorProps,\n\t])\n\n\tconst {\n\t\tflatListProps,\n\t\tkeyboardDismissMode = 'interactive',\n\t\tkeyboardShouldPersistTaps = 'handled',\n\t\textraData,\n\t\tmessages,\n\t\tcontentContainerStyle,\n\t} = props\n\tconst renderList = () => {\n\t\treturn (\n\t\t\t<Animated.FlatList\n\t\t\t\t{...flatListProps}\n\t\t\t\tref={flatListRef as MutableRefObject<FlatList<MessageModel>>}\n\t\t\t\tdata={messages}\n\t\t\t\tkeyExtractor={keyExtractor}\n\t\t\t\trenderItem={renderItem}\n\t\t\t\textraData={extraData}\n\t\t\t\tListHeaderComponent={ListFooterComponent}\n\t\t\t\tinverted\n\t\t\t\t// initialNum\n\t\t\t\tonScroll={onScroll}\n\t\t\t\tonViewableItemsChanged={onViewableItemsChanged}\n\t\t\t\tkeyboardShouldPeristTaps={keyboardShouldPersistTaps}\n\t\t\t\tkeyboardDismissMode={keyboardDismissMode}\n\t\t\t\tcontentContainerStyle={{\n\t\t\t\t\t...styles.contentContainer,\n\t\t\t\t\t...(contentContainerStyle || {}),\n\t\t\t\t}}\n\t\t\t\tinitialNumToRender={20}\n\t\t\t/>\n\t\t)\n\t}\n\t// , [\n\t// \tflatListProps,\n\t// \tkeyboardDismissMode,\n\t// \tkeyboardShouldPersistTaps,\n\t// \textraData,\n\t// \tmessages,\n\t// \tonViewableItemsChanged,\n\t// \tListFooterComponent,\n\t// \tonScroll,\n\t// \tkeyExtractor,\n\t// \trenderItem,\n\t// \tcontentContainerStyle,\n\t// ])\n\tconst renderHeader = () => {\n\t\tif (props.renderHeader) return props.renderHeader()\n\t\treturn null\n\t}\n\tconst renderFooter = () => {\n\t\tif (props.renderFooter) return props.renderFooter()\n\t\treturn null\n\t}\n\tconst renderComposer = () => {\n\t\tif (props.renderComposer === null) return null\n\n\t\tconst composerProps: ComposerProps = {\n\t\t\tonInputTextChanged: props.onInputTextChanged,\n\t\t\ttext: props.text,\n\t\t\tinitialText: props.initialText,\n\t\t\tplaceholderColor: props.placeholderColor,\n\t\t\tplaceholderText: props.placeholderText,\n\t\t\trenderSendButton: props.renderSendButton,\n\t\t\trenderTextInput: props.renderTextInput,\n\t\t\ttextInputProps: props.textInputProps,\n\t\t\tmedia: props.media,\n\t\t\tonChangeMedia: props.onChangeMedia,\n\t\t\tuser: props.user,\n\t\t\tonSend: props.onSend,\n\t\t\tsendButtonMode: props.sendButtonMode,\n\t\t\tcontainerStyle: props.composerContainerStyle,\n\t\t\tinputContainerStyle: props.inputContainerStyle,\n\t\t\tinputStyle: props.inputStyle,\n\t\t\ttintColor: props.tintColor,\n\t\t\tinputRef: inputRef as MutableRefObject<TextInput>,\n\t\t\tsendButtonContainerStyle: props.sendButtonContainerStyle,\n\t\t\tsendOnKeyboardReturn: props.sendOnKeyboardReturn,\n\t\t}\n\t\tif (props.renderComposer) return props.renderComposer(composerProps)\n\n\t\treturn <Composer {...composerProps} />\n\t}\n\n\t// now, onto the actual render code\n\tconst Container =\n\t\tprops.ContainerComponent || (props.safeArea ? SafeAreaView : View)\n\tconst KeyboardView =\n\t\tprops.avoidKeyboard === false ? View : KeyboardAvoidingView\n\n\t// reanimated transition\n\tconst transition = useMemo(\n\t\t() =>\n\t\t\tprops.transitionConfig ||\n\t\t\t(true && (\n\t\t\t\t<Transition.Together>\n\t\t\t\t\t{/* <Transition.Out type=\"fade\" durationMs={100} /> */}\n\t\t\t\t\t<Transition.Change interpolation=\"easeInOut\" />\n\t\t\t\t\t<Transition.In type=\"fade\" />\n\t\t\t\t</Transition.Together>\n\t\t\t)),\n\t\t[props.transitionConfig]\n\t)\n\tconst containerStyle = useMemo(\n\t\t() => ({\n\t\t\t...styles.container,\n\t\t\t...props.containerStyle,\n\t\t}),\n\t\t[props.containerStyle]\n\t)\n\treturn (\n\t\t<Transitioning.View\n\t\t\tref={transitionRef}\n\t\t\ttransition={transition}\n\t\t\tstyle={containerStyle}\n\t\t>\n\t\t\t<Container style={containerStyle}>\n\t\t\t\t<KeyboardView\n\t\t\t\t\tstyle={containerStyle}\n\t\t\t\t\t// behavior={Platform.OS === 'ios' ? 'padding' : undefined}\n\t\t\t\t\tbehavior=\"padding\"\n\t\t\t\t>\n\t\t\t\t\t{renderHeader()}\n\t\t\t\t\t{renderList()}\n\t\t\t\t\t{renderFooter()}\n\t\t\t\t\t{renderComposer()}\n\t\t\t\t</KeyboardView>\n\t\t\t</Container>\n\t\t</Transitioning.View>\n\t)\n}\n\nChat.append = function<M>(state: M[], messages: M[]) {\n\treturn [...messages, ...state]\n}\n\nexport default Chat\n\nconst styles = StyleSheet.create({\n\tcontainer: {\n\t\tflex: 1,\n\t},\n\tcontentContainer: {\n\t\tflexGrow: 1,\n\t\tmarginTop: 5,\n\t},\n})\n"]}
@@ -1,2 +0,0 @@
1
-
2
- //# sourceMappingURL=types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[]}
@@ -1,2 +0,0 @@
1
- var _jsxFileName="/Users/Fernando/Developer/Learning Babel/usechat/src/components/Chat-Old/Bubble/index.tsx";import React,{useMemo}from'react';import{View,Text,StyleSheet}from'react-native';var Bubble=function Bubble(props){var containerStyles=useMemo(function(){return[styles.container,props.isMe?meStyles.container:otherStyles.container,props.style];},[props.style,props.isMe]);var textStyles=useMemo(function(){return[styles.text,props.isMe?meStyles.text:otherStyles.text,props.style];},[props.style,props.isMe]);return React.createElement(View,{style:containerStyles,ref:props.bubbleRef,__source:{fileName:_jsxFileName,lineNumber:23}},React.createElement(Text,{style:textStyles,__source:{fileName:_jsxFileName,lineNumber:24}},props.text));};export default Bubble;var styles=StyleSheet.create({container:{paddingHorizontal:10,paddingVertical:5,borderRadius:10},text:{textAlign:'left'}});var meStyles=StyleSheet.create({container:{backgroundColor:'blue'},text:{color:'white'}});var otherStyles=StyleSheet.create({container:{backgroundColor:'lightgray'},text:{color:'black'}});
2
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["index.tsx"],"names":["React","useMemo","View","Text","StyleSheet","Bubble","props","containerStyles","styles","container","isMe","meStyles","otherStyles","style","textStyles","text","bubbleRef","create","paddingHorizontal","paddingVertical","borderRadius","textAlign","backgroundColor","color"],"mappings":"6GAAA,MAAOA,CAAAA,KAAP,EAAgBC,OAAhB,KAAkD,OAAlD,CAEA,OAASC,IAAT,CAAeC,IAAf,CAAqBC,UAArB,KAAuC,cAAvC,CAEA,GAAMC,CAAAA,MAAsC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ACa,MAAX,CAAkB,CACrCR,SAAS,CAAE,CACVa,eAAe,CAAE,WADP,CAD0B,CAIrCP,IAAI,CAAE,CACLQ,KAAK,CAAE,OADF,CAJ+B,CAAlB,CAApB","sourcesContent":["import React, { useMemo, FunctionComponent } from 'react'\nimport { BubbleProps } from '../types'\nimport { View, Text, StyleSheet } from 'react-native'\n\nconst Bubble: FunctionComponent<BubbleProps> = props => {\n\tconst containerStyles = useMemo(\n\t\t() => [\n\t\t\tstyles.container,\n\t\t\tprops.isMe ? meStyles.container : otherStyles.container,\n\t\t\tprops.style\n\t\t],\n\t\t[props.style, props.isMe]\n\t)\n\tconst textStyles = useMemo(\n\t\t() => [\n\t\t\tstyles.text,\n\t\t\tprops.isMe ? meStyles.text : otherStyles.text,\n\t\t\tprops.style\n\t\t],\n\t\t[props.style, props.isMe]\n\t)\n\treturn (\n\t\t<View style={containerStyles} ref={props.bubbleRef}>\n\t\t\t<Text style={textStyles}>{props.text}</Text>\n\t\t</View>\n\t)\n}\n\nexport default Bubble\n\nconst styles = StyleSheet.create({\n\tcontainer: {\n\t\tpaddingHorizontal: 10,\n\t\tpaddingVertical: 5,\n\t\tborderRadius: 10\n\t},\n\ttext: {\n\t\ttextAlign: 'left'\n\t}\n})\n\nconst meStyles = StyleSheet.create({\n\tcontainer: {\n\t\tbackgroundColor: 'blue'\n\t},\n\ttext: {\n\t\tcolor: 'white'\n\t}\n})\n\nconst otherStyles = StyleSheet.create({\n\tcontainer: {\n\t\tbackgroundColor: 'lightgray'\n\t},\n\ttext: {\n\t\tcolor: 'black'\n\t}\n})\n"]}
@@ -1,2 +0,0 @@
1
- import _extends from"@babel/runtime/helpers/extends";var _jsxFileName="/Users/Fernando/Developer/Learning Babel/usechat/src/components/Chat-Old/Composer/Input/index.tsx";import React from'react';import{TextInput,StyleSheet,View}from'react-native';var Input=function Input(props){return React.createElement(View,{style:[styles.container,props.containerStyle],__source:{fileName:_jsxFileName,lineNumber:7}},React.createElement(TextInput,_extends({},props.inputProps,{placeholder:props.placeholderText||'Type a new message...',placeholderTextColor:props.placeholderColor||'lightgray',selectionColor:props.tintColor||'blue',onChangeText:props.onChangeText,value:props.text,style:[styles.input,props.style],multiline:true,ref:props.inputRef,__source:{fileName:_jsxFileName,lineNumber:8}})));};export default Input;var styles=StyleSheet.create({container:{flex:1,flexDirection:'row'},input:{flex:1,padding:10}});
2
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["index.tsx"],"names":["React","TextInput","StyleSheet","View","Input","props","styles","container","containerStyle","inputProps","placeholderText","placeholderColor","tintColor","onChangeText","text","input","style","inputRef","create","flex","flexDirection","padding"],"mappings":"0KAAA,MAAOA,CAAAA,KAAP,KAAkB,OAAlB,CACA,OAASC,SAAT,CAAoBC,UAApB,CAAgCC,IAAhC,KAA4C,cAA5C,CAGA,GAAMC,CAAAA,KAAK,CAAG,QAARA,CAAAA,KAAQ,CAACC,KAAD,CAAuB,CACpC,MACC,qBAAC,IAAD,EAAM,KAAK,CAAE,CAACC,MAAM,CAACC,SAAR,CAAmBF,KAAK,CAACG,cAAzB,CAAb,gDACC,oBAAC,SAAD,aACKH,KAAK,CAACI,UADX,EAEC,WAAW,CAAEJ,KAAK,CAACK,eAAN,EAAyB,uBAFvC,CAGC,oBAAoB,CAAEL,KAAK,CAACM,gBAAN,EAA0B,WAHjD,CAIC,cAAc,CAAEN,KAAK,CAACO,SAAN,EAAmB,MAJpC,CAKC,YAAY,CAAEP,KAAK,CAACQ,YALrB,CAMC,KAAK,CAAER,KAAK,CAACS,IANd,CAOC,KAAK,CAAE,CAACR,MAAM,CAACS,KAAR,CAAeV,KAAK,CAACW,KAArB,CAPR,CAQC,SAAS,KARV,CASC,GAAG,CAAEX,KAAK,CAACY,QATZ,iDADD,CADD,CAeA,CAhBD,CAkBA,cAAeb,CAAAA,KAAf,CAEA,GAAME,CAAAA,MAAM,CAAGJ,UAAU,CAACgB,MAAX,CAAkB,CAChCX,SAAS,CAAE,CACVY,IAAI,CAAE,CADI,CAEVC,aAAa,CAAE,KAFL,CADqB,CAKhCL,KAAK,CAAE,CACNI,IAAI,CAAE,CADA,CAENE,OAAO,CAAE,EAFH,CALyB,CAAlB,CAAf","sourcesContent":["import React from 'react'\nimport { TextInput, StyleSheet, View } from 'react-native'\nimport { InputProps } from '../../types'\n\nconst Input = (props: InputProps) => {\n\treturn (\n\t\t<View style={[styles.container, props.containerStyle]}>\n\t\t\t<TextInput\n\t\t\t\t{...props.inputProps}\n\t\t\t\tplaceholder={props.placeholderText || 'Type a new message...'}\n\t\t\t\tplaceholderTextColor={props.placeholderColor || 'lightgray'}\n\t\t\t\tselectionColor={props.tintColor || 'blue'}\n\t\t\t\tonChangeText={props.onChangeText}\n\t\t\t\tvalue={props.text}\n\t\t\t\tstyle={[styles.input, props.style]}\n\t\t\t\tmultiline\n\t\t\t\tref={props.inputRef}\n\t\t\t/>\n\t\t</View>\n\t)\n}\n\nexport default Input\n\nconst styles = StyleSheet.create({\n\tcontainer: {\n\t\tflex: 1,\n\t\tflexDirection: 'row'\n\t},\n\tinput: {\n\t\tflex: 1,\n\t\tpadding: 10\n\t}\n})\n"]}
@@ -1,2 +0,0 @@
1
- var _jsxFileName="/Users/Fernando/Developer/Learning Babel/usechat/src/components/Chat-Old/Composer/Send/index.tsx";import React from'react';import{Button,StyleSheet,TouchableOpacity}from'react-native';import{Ionicons}from'@expo/vector-icons';export default(function(props){if(props.mode==='hidden')return null;if(props.mode==='icon')return React.createElement(TouchableOpacity,{onPress:props.onSend,style:[styles.button,{backgroundColor:props.tintColor||'blue'}],__source:{fileName:_jsxFileName,lineNumber:10}},React.createElement(Ionicons,{name:"ios-arrow-round-up",size:size,color:'white',__source:{fileName:_jsxFileName,lineNumber:14}}));return React.createElement(Button,{title:"Send",onPress:props.onSend,color:props.tintColor||'blue',__source:{fileName:_jsxFileName,lineNumber:18}});});var size=20;var styles=StyleSheet.create({button:{borderRadius:size,height:size*1.5,width:size*1.5,justifyContent:'center',alignItems:'center',padding:size/2}});
2
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["index.tsx"],"names":["React","Button","StyleSheet","TouchableOpacity","Ionicons","props","mode","onSend","styles","button","backgroundColor","tintColor","size","create","borderRadius","height","width","justifyContent","alignItems","padding"],"mappings":"oHAAA,MAAOA,CAAAA,KAAP,KAAkB,OAAlB,CACA,OAASC,MAAT,CAAiBC,UAAjB,CAA6BC,gBAA7B,KAAqD,cAArD,CACA,OAASC,QAAT,KAAyB,oBAAzB,CAGA,eAAe,SAACC,KAAD,CAA4B,CAC1C,GAAIA,KAAK,CAACC,IAAN,GAAe,QAAnB,CAA6B,MAAO,KAAP,CAC7B,GAAID,KAAK,CAACC,IAAN,GAAe,MAAnB,CACC,MACC,qBAAC,gBAAD,EACC,OAAO,CAAED,KAAK,CAACE,MADhB,CAEC,KAAK,CAAE,CAACC,MAAM,CAACC,MAAR,CAAgB,CAAEC,eAAe,CAAEL,KAAK,CAACM,SAAN,EAAmB,MAAtC,CAAhB,CAFR,iDAIC,oBAAC,QAAD,EAAU,IAAI,CAAC,oBAAf,CAAoC,IAAI,CAAEC,IAA1C,CAAgD,KAAK,CAAE,OAAvD,iDAJD,CADD,CAQD,MACC,qBAAC,MAAD,EACC,KAAK,CAAC,MADP,CAEC,OAAO,CAAEP,KAAK,CAACE,MAFhB,CAGC,KAAK,CAAEF,KAAK,CAACM,SAAN,EAAmB,MAH3B,iDADD,CAOA,CAlBD,EAoBA,GAAMC,CAAAA,IAAI,CAAG,EAAb,CAEA,GAAMJ,CAAAA,MAAM,CAAGN,UAAU,CAACW,MAAX,CAAkB,CAChCJ,MAAM,CAAE,CACPK,YAAY,CAAEF,IADP,CAEPG,MAAM,CAAEH,IAAI,CAAG,GAFR,CAGPI,KAAK,CAAEJ,IAAI,CAAG,GAHP,CAIPK,cAAc,CAAE,QAJT,CAKPC,UAAU,CAAE,QALL,CAMPC,OAAO,CAAEP,IAAI,CAAG,CANT,CADwB,CAAlB,CAAf","sourcesContent":["import React from 'react'\nimport { Button, StyleSheet, TouchableOpacity } from 'react-native'\nimport { Ionicons } from '@expo/vector-icons'\nimport { SendButtonProps } from '../../types'\n\nexport default (props: SendButtonProps) => {\n\tif (props.mode === 'hidden') return null\n\tif (props.mode === 'icon')\n\t\treturn (\n\t\t\t<TouchableOpacity\n\t\t\t\tonPress={props.onSend}\n\t\t\t\tstyle={[styles.button, { backgroundColor: props.tintColor || 'blue' }]}\n\t\t\t>\n\t\t\t\t<Ionicons name=\"ios-arrow-round-up\" size={size} color={'white'} />\n\t\t\t</TouchableOpacity>\n\t\t)\n\treturn (\n\t\t<Button\n\t\t\ttitle=\"Send\"\n\t\t\tonPress={props.onSend}\n\t\t\tcolor={props.tintColor || 'blue'}\n\t\t/>\n\t)\n}\n\nconst size = 20\n\nconst styles = StyleSheet.create({\n\tbutton: {\n\t\tborderRadius: size,\n\t\theight: size * 1.5,\n\t\twidth: size * 1.5,\n\t\tjustifyContent: 'center',\n\t\talignItems: 'center',\n\t\tpadding: size / 2\n\t}\n})\n"]}
@@ -1,2 +0,0 @@
1
- import _defineProperty from"@babel/runtime/helpers/defineProperty";import _extends from"@babel/runtime/helpers/extends";import _slicedToArray from"@babel/runtime/helpers/slicedToArray";var _jsxFileName="/Users/Fernando/Developer/Learning Babel/usechat/src/components/Chat-Old/Composer/index.tsx";function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);if(enumerableOnly)symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable;});keys.push.apply(keys,symbols);}return keys;}function _objectSpread(target){for(var i=1;i<arguments.length;i++){var source=arguments[i]!=null?arguments[i]:{};if(i%2){ownKeys(Object(source),true).forEach(function(key){_defineProperty(target,key,source[key]);});}else if(Object.getOwnPropertyDescriptors){Object.defineProperties(target,Object.getOwnPropertyDescriptors(source));}else{ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key));});}}return target;}import React,{useState,useCallback,useMemo}from'react';import uuid from'uuid';import{View,StyleSheet}from'react-native';import Input from'./Input';import Send from'./Send';var emptyMedia=[];export default React.memo(function(props){var _useState=useState(props.initialText||''),_useState2=_slicedToArray(_useState,2),textState=_useState2[0],setText=_useState2[1];var _ref=[props.text||textState,props.text&&props.onInputTextChanged||setText],text=_ref[0],onChangeText=_ref[1];var _useState3=useState(emptyMedia),_useState4=_slicedToArray(_useState3,2),mediaState=_useState4[0],setMedia=_useState4[1];var _ref2=[props.media||mediaState,props.media&&props.onChangeMedia||setMedia],media=_ref2[0],onChangeMedia=_ref2[1];var textInputProps=props.textInputProps,renderTextInput=props.renderTextInput;var renderInput=useCallback(function(){if(renderTextInput===null)return null;var inputProps={inputProps:textInputProps,onChangeText:onChangeText,text:text,containerStyle:props.inputContainerStyle,placeholderColor:props.placeholderColor,placeholderText:props.placeholderText,style:props.inputStyle,tintColor:props.tintColor,inputRef:props.inputRef};if(renderTextInput)return renderTextInput(inputProps);return React.createElement(Input,_extends({},inputProps,{__source:{fileName:_jsxFileName,lineNumber:44}}));},[onChangeText,text,textInputProps,renderTextInput,props.inputContainerStyle,props.placeholderColor,props.placeholderText,props.inputStyle,props.tintColor,props.inputRef]);var user=props.user;var messagesReadyToSend=useMemo(function(){var messages=[];if(media.length){;media.forEach(function(item){var message={user:user,text:'',id:uuid.v4(),createdAt:new Date(),media:item};messages.push(message);});}if(text){var message={user:user,text:text&&text.trim(),id:uuid.v4(),createdAt:new Date()};messages.push(message);}return messages;},[user,text,media]);var onSend=props.onSend;var send=useCallback(function(){if(messagesReadyToSend.length){onChangeText('');onChangeMedia([]);onSend(messagesReadyToSend);}},[onChangeText,onChangeMedia,messagesReadyToSend,onSend]);var renderSendButton=props.renderSendButton,sendButtonMode=props.sendButtonMode;var renderSend=useCallback(function(){if(renderSendButton===null)return null;var mode=_objectSpread({empty:'hidden',withText:'icon'},sendButtonMode||{});var sendProps={onSend:send,text:text,media:media,user:user,mode:(text&&text.trim?mode.withText:mode.empty)||'icon'};if(renderSendButton)return renderSendButton(sendProps);return React.createElement(Send,_extends({},sendProps,{__source:{fileName:_jsxFileName,lineNumber:113}}));},[send,text,user,media,renderSendButton,sendButtonMode]);return React.createElement(View,{style:props.containerStyle,__source:{fileName:_jsxFileName,lineNumber:117}},React.createElement(View,{style:styles.wrapper,__source:{fileName:_jsxFileName,lineNumber:118}},renderInput(),renderSend()));});var styles=StyleSheet.create({container:{},wrapper:{flexDirection:'row'}});
2
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["index.tsx"],"names":["React","useState","useCallback","useMemo","uuid","View","StyleSheet","Input","Send","emptyMedia","memo","props","initialText","textState","setText","text","onInputTextChanged","onChangeText","mediaState","setMedia","media","onChangeMedia","textInputProps","renderTextInput","renderInput","inputProps","containerStyle","inputContainerStyle","placeholderColor","placeholderText","style","inputStyle","tintColor","inputRef","user","messagesReadyToSend","messages","length","forEach","item","message","id","v4","createdAt","Date","push","trim","onSend","send","renderSendButton","sendButtonMode","renderSend","mode","empty","withText","sendProps","styles","wrapper","create","container","flexDirection"],"mappings":"okCAAA,MAAOA,CAAAA,KAAP,EAAgBC,QAAhB,CAA0BC,WAA1B,CAAuCC,OAAvC,KAAsD,OAAtD,CACA,MAAOC,CAAAA,IAAP,KAAiB,MAAjB,CACA,OAASC,IAAT,CAAeC,UAAf,KAAiC,cAAjC,CAEA,MAAOC,CAAAA,KAAP,KAAkB,SAAlB,CAEA,MAAOC,CAAAA,IAAP,KAAiB,QAAjB,CAEA,GAAMC,CAAAA,UAAuC,CAAG,EAAhD,CAEA,cAAeT,CAAAA,KAAK,CAACU,IAAN,CAAW,SAACC,KAAD,CAA0B,eAEtBV,QAAQ,CAACU,KAAK,CAACC,WAAN,EAAqB,EAAtB,CAFc,wCAE5CC,SAF4C,eAEjCC,OAFiC,wBAItB,CAC5BH,KAAK,CAACI,IAAN,EAAcF,SADc,CAE3BF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AA,MAAM,CAAGlD,UAAU,CAACoD,MAAX,CAAkB,CAChCC,SAAS,CAAE,EADqB,CAEhCF,OAAO,CAAE,CACRG,aAAa,CAAE,KADP,CAFuB,CAAlB,CAAf","sourcesContent":["import React, { useState, useCallback, useMemo } from 'react'\nimport uuid from 'uuid'\nimport { View, StyleSheet } from 'react-native'\nimport { ComposerProps, InputProps, SendButtonProps, ChatProps } from '../types'\nimport Input from './Input'\nimport { MessageMedia, NewMessageModel, MessageMediaWithUri } from '../../../classes/Message/types'\nimport Send from './Send'\n\nconst emptyMedia: Omit<MessageMedia, 'url'>[] = []\n\nexport default React.memo((props: ComposerProps) => {\n\t// First, we set up a state manager for the composer's text.\n\tconst [textState, setText] = useState(props.initialText || '')\n\t// if you pass a text prop, use that state instead\n\tconst [text, onChangeText] = [\n\t\tprops.text || textState,\n\t\t(props.text && props.onInputTextChanged) || setText\n\t]\n\n\tconst [mediaState, setMedia] = useState<MessageMediaWithUri[]>(emptyMedia)\n\tconst [media, onChangeMedia] = [\n\t\tprops.media || mediaState,\n\t\t(props.media && props.onChangeMedia) || setMedia\n\t]\n\n\tconst { textInputProps, renderTextInput } = props\n\tconst renderInput = useCallback(() => {\n\t\tif (renderTextInput === null) return null\n\n\t\tconst inputProps: InputProps = {\n\t\t\tinputProps: textInputProps,\n\t\t\tonChangeText,\n\t\t\ttext,\n\t\t\tcontainerStyle: props.inputContainerStyle,\n\t\t\tplaceholderColor: props.placeholderColor,\n\t\t\tplaceholderText: props.placeholderText,\n\t\t\tstyle: props.inputStyle,\n\t\t\ttintColor: props.tintColor,\n\t\t\tinputRef: props.inputRef\n\t\t}\n\n\t\tif (renderTextInput) return renderTextInput(inputProps)\n\n\t\treturn <Input {...inputProps} />\n\t}, [\n\t\tonChangeText,\n\t\ttext,\n\t\ttextInputProps,\n\t\trenderTextInput,\n\t\tprops.inputContainerStyle,\n\t\tprops.placeholderColor,\n\t\tprops.placeholderText,\n\t\tprops.inputStyle,\n\t\tprops.tintColor,\n\t\t// TODO leave or take out?\n\t\tprops.inputRef\n\t])\n\n\tconst { user } = props\n\tconst messagesReadyToSend = useMemo(() => {\n\t\tconst messages: NewMessageModel[] = []\n\t\tif (media.length) {\n\t\t\t;(media as MessageMedia[]).forEach(item => {\n\t\t\t\tconst message: NewMessageModel = {\n\t\t\t\t\tuser,\n\t\t\t\t\ttext: '',\n\t\t\t\t\tid: uuid.v4(),\n\t\t\t\t\tcreatedAt: new Date(),\n\t\t\t\t\tmedia: item\n\t\t\t\t}\n\t\t\t\tmessages.push(message)\n\t\t\t})\n\t\t}\n\t\tif (text) {\n\t\t\tconst message: NewMessageModel = {\n\t\t\t\tuser,\n\t\t\t\ttext: text && text.trim(),\n\t\t\t\tid: uuid.v4(),\n\t\t\t\tcreatedAt: new Date()\n\t\t\t}\n\t\t\tmessages.push(message)\n\t\t}\n\t\treturn messages\n\t}, [user, text, media])\n\n\tconst { onSend } = props\n\tconst send = useCallback(() => {\n\t\tif (messagesReadyToSend.length) {\n\t\t\tonChangeText('')\n\t\t\tonChangeMedia([])\n\t\t\tonSend(messagesReadyToSend)\n\t\t}\n\t}, [onChangeText, onChangeMedia, messagesReadyToSend, onSend])\n\n\tconst { renderSendButton, sendButtonMode } = props\n\tconst renderSend = useCallback(() => {\n\t\tif (renderSendButton === null) return null\n\n\t\tconst mode: ChatProps['sendButtonMode'] = {\n\t\t\tempty: 'hidden',\n\t\t\twithText: 'icon',\n\t\t\t...(sendButtonMode || {})\n\t\t}\n\t\tconst sendProps: SendButtonProps = {\n\t\t\tonSend: send,\n\t\t\ttext,\n\t\t\tmedia,\n\t\t\tuser,\n\t\t\tmode: (text && text.trim ? mode.withText : mode.empty) || 'icon'\n\t\t}\n\t\tif (renderSendButton) return renderSendButton(sendProps)\n\n\t\treturn <Send {...sendProps} />\n\t}, [send, text, user, media, renderSendButton, sendButtonMode])\n\n\treturn (\n\t\t<View style={props.containerStyle}>\n\t\t\t<View style={styles.wrapper}>\n\t\t\t\t{renderInput()}\n\t\t\t\t{renderSend()}\n\t\t\t</View>\n\t\t</View>\n\t)\n})\n\nconst styles = StyleSheet.create({\n\tcontainer: {},\n\twrapper: {\n\t\tflexDirection: 'row'\n\t}\n})\n"]}
@@ -1,2 +0,0 @@
1
- import _extends from"@babel/runtime/helpers/extends";var _jsxFileName="/Users/Fernando/Developer/Learning Babel/usechat/src/components/Chat-Old/Message/index.tsx";import React,{useCallback,useRef,useMemo}from'react';import{View,StyleSheet,Text}from'react-native';import Bubble from'../Bubble';import{Avatar,Initials}from'../..';import{getInitials}from'../../../helpers/getInitials';var Message=function Message(props){var bubble=useRef();var renderFooter=props.renderFooter;var footer=useCallback(function(){return renderFooter?renderFooter({id:props.id}):null;},[props.id,renderFooter]);var containerStyle=useMemo(function(){return[styles.container,props.isMe?meStyles.container:otherStyles.container,props.messageContainerStyle];},[props.isMe,props.messageContainerStyle]);var wrapperStyle=useMemo(function(){return[styles.wrapper,props.isMe?meStyles.wrapper:otherStyles.wrapper,props.messageWrapperStyle];},[props.isMe,props.messageWrapperStyle]);var maybeRenderName=useCallback(function(){return props.showName&&props.name?React.createElement(Text,{style:styles.name,__source:{fileName:_jsxFileName,lineNumber:45}},props.name):null;},[props.showName,props.name]);var renderAvatar=props.renderAvatar,avatar=props.avatar,avatarImageProps=props.avatarImageProps,avatarSize=props.avatarSize,showAvatar=props.showAvatar,name=props.name,renderInitials=props.renderInitials,initialsBackgroundColor=props.initialsBackgroundColor,initialsTextColor=props.initialsTextColor;var renderAvatarOrInitials=useCallback(function(){if(renderAvatar===null)return null;var opacity=showAvatar===false?0:1;var size=avatarSize||40;var Container=function Container(_ref){var children=_ref.children;return React.createElement(View,{style:{opacity:opacity},__source:{fileName:_jsxFileName,lineNumber:67}},children);};if(avatar){var avatarProps={avatar:avatar,imageProps:avatarImageProps,size:size};if(renderAvatar)return renderAvatar(avatarProps);return React.createElement(Container,{__source:{fileName:_jsxFileName,lineNumber:78}},React.createElement(Avatar,_extends({},avatarProps,{__source:{fileName:_jsxFileName,lineNumber:79}})));}var initialsProps={initials:getInitials(name),size:size,textColor:initialsTextColor,backgroundColor:initialsBackgroundColor||props.tintColor};if(renderInitials)return renderInitials(initialsProps);return React.createElement(Container,{__source:{fileName:_jsxFileName,lineNumber:91}},React.createElement(Initials,_extends({},initialsProps,{__source:{fileName:_jsxFileName,lineNumber:92}})));},[avatar,avatarImageProps,avatarSize,renderAvatar,showAvatar,name,renderInitials,initialsBackgroundColor,initialsTextColor,props.tintColor]);return React.createElement(View,{style:containerStyle,__source:{fileName:_jsxFileName,lineNumber:109}},React.createElement(View,{style:wrapperStyle,__source:{fileName:_jsxFileName,lineNumber:110}},renderAvatarOrInitials(),React.createElement(View,{__source:{fileName:_jsxFileName,lineNumber:112}},maybeRenderName(),React.createElement(Bubble,{text:props.text,isMe:props.isMe,style:props.bubbleStyle,textStyle:props.bubbleTextStyle,bubbleRef:bubble,__source:{fileName:_jsxFileName,lineNumber:114}}))),footer());};export default React.memo(Message);var styles=StyleSheet.create({container:{marginTop:1,flexDirection:'row'},wrapper:{flex:1},name:{marginLeft:5}});var meStyles=StyleSheet.create({container:{justifyContent:'flex-end'},wrapper:{flexDirection:'row-reverse'}});var otherStyles=StyleSheet.create({container:{justifyContent:'flex-end'},wrapper:{flexDirection:'row'}});
2
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["index.tsx"],"names":["React","useCallback","useRef","useMemo","View","StyleSheet","Text","Bubble","Avatar","Initials","getInitials","Message","props","bubble","renderFooter","footer","id","containerStyle","styles","container","isMe","meStyles","otherStyles","messageContainerStyle","wrapperStyle","wrapper","messageWrapperStyle","maybeRenderName","showName","name","renderAvatar","avatar","avatarImageProps","avatarSize","showAvatar","renderInitials","initialsBackgroundColor","initialsTextColor","renderAvatarOrInitials","opacity","size","Container","children","avatarProps","imageProps","initialsProps","initials","textColor","backgroundColor","tintColor","text","bubbleStyle","bubbleTextStyle","memo","create","marginTop","flexDirection","flex","marginLeft","justifyContent"],"mappings":"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IAAN,CAAW1C,OAAX,CAAf,CAEA,GAAMO,CAAAA,MAAM,CAAGb,UAAU,CAACiD,MAAX,CAAkB,CAChCnC,SAAS,CAAE,CACVoC,SAAS,CAAE,CADD,CAEVC,aAAa,CAAE,KAFL,CADqB,CAMhC/B,OAAO,CAAE,CACRgC,IAAI,CAAE,CADE,CANuB,CAShC5B,IAAI,CAAE,CACL6B,UAAU,CAAE,CADP,CAT0B,CAAlB,CAAf,CAcA,GAAMrC,CAAAA,QAAQ,CAAGhB,UAAU,CAACiD,MAAX,CAAkB,CAClCnC,SAAS,CAAE,CACVwC,cAAc,CAAE,UADN,CADuB,CAIlClC,OAAO,CAAE,CACR+B,aAAa,CAAE,aADP,CAJyB,CAAlB,CAAjB,CASA,GAAMlC,CAAAA,WAAW,CAAGjB,UAAU,CAACiD,MAAX,CAAkB,CACrCnC,SAAS,CAAE,CACVwC,cAAc,CAAE,UADN,CAD0B,CAIrClC,OAAO,CAAE,CACR+B,aAAa,CAAE,KADP,CAJ4B,CAAlB,CAApB","sourcesContent":["import React, {\n\tuseCallback,\n\tuseRef,\n\tMutableRefObject,\n\tuseMemo,\n\tFunctionComponent\n} from 'react'\nimport { View, StyleSheet, Text } from 'react-native'\nimport { MessageProps } from '../types'\nimport { NewMessageModel } from '../../../classes/Message/types'\nimport Bubble from '../Bubble'\nimport { Avatar, Initials } from '../..'\nimport { AvatarProps, InitialsProps } from '../../Inbox/types'\nimport { getInitials } from '../../../helpers/getInitials'\n\nconst Message = <Model extends NewMessageModel = NewMessageModel>(\n\tprops: MessageProps<Model>\n) => {\n\tconst bubble = useRef<View>()\n\n\tconst { renderFooter } = props\n\tconst footer = useCallback(\n\t\t() => (renderFooter ? renderFooter({ id: props.id }) : null),\n\t\t[props.id, renderFooter]\n\t)\n\n\tconst containerStyle = useMemo(() => {\n\t\treturn [\n\t\t\tstyles.container,\n\t\t\tprops.isMe ? meStyles.container : otherStyles.container,\n\t\t\tprops.messageContainerStyle\n\t\t]\n\t}, [props.isMe, props.messageContainerStyle])\n\n\tconst wrapperStyle = useMemo(() => {\n\t\treturn [\n\t\t\tstyles.wrapper,\n\t\t\tprops.isMe ? meStyles.wrapper : otherStyles.wrapper,\n\t\t\tprops.messageWrapperStyle\n\t\t]\n\t}, [props.isMe, props.messageWrapperStyle])\n\n\tconst maybeRenderName = useCallback(() => {\n\t\treturn props.showName && props.name ? (\n\t\t\t<Text style={styles.name}>{props.name}</Text>\n\t\t) : null\n\t}, [props.showName, props.name])\n\n\tconst {\n\t\trenderAvatar,\n\t\tavatar,\n\t\tavatarImageProps,\n\t\tavatarSize,\n\t\tshowAvatar,\n\t\tname,\n\t\trenderInitials,\n\t\tinitialsBackgroundColor,\n\t\tinitialsTextColor\n\t} = props\n\tconst renderAvatarOrInitials = useCallback(() => {\n\t\tif (renderAvatar === null) return null\n\t\t// we make opacity 0 instead of hiding it to maintain the same width from the side\n\t\tconst opacity = showAvatar === false ? 0 : 1\n\t\tconst size = avatarSize || 40\n\n\t\tconst Container: FunctionComponent<{}> = ({ children }) => (\n\t\t\t<View style={{ opacity }}>{children}</View>\n\t\t)\n\n\t\tif (avatar) {\n\t\t\tconst avatarProps: AvatarProps = {\n\t\t\t\tavatar: avatar,\n\t\t\t\timageProps: avatarImageProps,\n\t\t\t\tsize\n\t\t\t}\n\t\t\tif (renderAvatar) return renderAvatar(avatarProps)\n\t\t\treturn (\n\t\t\t\t<Container>\n\t\t\t\t\t<Avatar {...avatarProps} />\n\t\t\t\t</Container>\n\t\t\t)\n\t\t}\n\t\tconst initialsProps: InitialsProps = {\n\t\t\tinitials: getInitials(name),\n\t\t\tsize,\n\t\t\ttextColor: initialsTextColor,\n\t\t\tbackgroundColor: initialsBackgroundColor || props.tintColor\n\t\t}\n\t\tif (renderInitials) return renderInitials(initialsProps)\n\t\treturn (\n\t\t\t<Container>\n\t\t\t\t<Initials {...initialsProps} />\n\t\t\t</Container>\n\t\t)\n\t}, [\n\t\tavatar,\n\t\tavatarImageProps,\n\t\tavatarSize,\n\t\trenderAvatar,\n\t\tshowAvatar,\n\t\tname,\n\t\trenderInitials,\n\t\tinitialsBackgroundColor,\n\t\tinitialsTextColor,\n\t\tprops.tintColor\n\t])\n\n\treturn (\n\t\t<View style={containerStyle}>\n\t\t\t<View style={wrapperStyle}>\n\t\t\t\t{renderAvatarOrInitials()}\n\t\t\t\t<View>\n\t\t\t\t\t{maybeRenderName()}\n\t\t\t\t\t<Bubble\n\t\t\t\t\t\ttext={props.text}\n\t\t\t\t\t\tisMe={props.isMe}\n\t\t\t\t\t\tstyle={props.bubbleStyle}\n\t\t\t\t\t\ttextStyle={props.bubbleTextStyle}\n\t\t\t\t\t\tbubbleRef={bubble as MutableRefObject<View>}\n\t\t\t\t\t/>\n\t\t\t\t</View>\n\t\t\t</View>\n\t\t\t{footer()}\n\t\t</View>\n\t)\n}\n\nexport default React.memo(Message)\n\nconst styles = StyleSheet.create({\n\tcontainer: {\n\t\tmarginTop: 1,\n\t\tflexDirection: 'row'\n\t},\n\t// wrapper is concerned with which side the avatar is on relative to the bubble\n\twrapper: {\n\t\tflex: 1\n\t},\n\tname: {\n\t\tmarginLeft: 5\n\t}\n})\n\nconst meStyles = StyleSheet.create({\n\tcontainer: {\n\t\tjustifyContent: 'flex-end'\n\t},\n\twrapper: {\n\t\tflexDirection: 'row-reverse'\n\t}\n})\n\nconst otherStyles = StyleSheet.create({\n\tcontainer: {\n\t\tjustifyContent: 'flex-end'\n\t},\n\twrapper: {\n\t\tflexDirection: 'row'\n\t}\n})\n"]}
@@ -1,2 +0,0 @@
1
- var _jsxFileName="/Users/Fernando/Developer/Learning Babel/usechat/src/components/Chat-Old/Swiper/Action/index.tsx";import React from'react';import{View}from'react-native';export default(function(props){return React.createElement(View,{__source:{fileName:_jsxFileName,lineNumber:6}});});
2
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["index.tsx"],"names":["React","View","props"],"mappings":"oHAAA,MAAOA,CAAAA,KAAP,KAAkB,OAAlB,CAEA,OAASC,IAAT,KAAqB,cAArB,CAEA,eAAe,SAACC,KAAD,CAA6B,CAC3C,MAAO,qBAAC,IAAD,iDAAP,CACA,CAFD","sourcesContent":["import React from 'react'\nimport { SwipeableProps, SwipeActionProps } from '../../types'\nimport { View } from 'react-native'\n\nexport default (props: SwipeActionProps) => {\n\treturn <View></View>\n}\n"]}
@@ -1,2 +0,0 @@
1
- import _extends from"@babel/runtime/helpers/extends";var _jsxFileName="/Users/Fernando/Developer/Learning Babel/usechat/src/components/Chat-Old/Swiper/index.tsx";import React,{useCallback}from'react';import Swipeable from'react-native-gesture-handler/Swipeable';import Action from'./Action';export default(function(props){var renderSwipeAction=props.renderSwipeAction;var renderAction=useCallback(function(actionProps){if(renderSwipeAction)return renderSwipeAction(actionProps);return React.createElement(Action,_extends({},actionProps,{__source:{fileName:_jsxFileName,lineNumber:12}}));},[renderSwipeAction]);var swipeActions=props.swipeActions;var leftActions=swipeActions&&swipeActions.left;var rightActions=swipeActions&&swipeActions.right;var renderRightActions=useCallback(function(){if(rightActions){rightActions.forEach(function(action){});}},[rightActions]);var renderActionList=useCallback(function(){},[]);return React.createElement(Swipeable,{__source:{fileName:_jsxFileName,lineNumber:29}});});
2
- //# sourceMappingURL=index.js.map