@unif/react-native-chat 2.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 (345) hide show
  1. package/LICENSE +20 -0
  2. package/README.md +48 -0
  3. package/lib/module/actions/index.js +2 -0
  4. package/lib/module/actions/index.js.map +1 -0
  5. package/lib/module/actions/types.js +4 -0
  6. package/lib/module/actions/types.js.map +1 -0
  7. package/lib/module/components/Attachments/AttachmentItem.js +108 -0
  8. package/lib/module/components/Attachments/AttachmentItem.js.map +1 -0
  9. package/lib/module/components/Attachments/Attachments.js +60 -0
  10. package/lib/module/components/Attachments/Attachments.js.map +1 -0
  11. package/lib/module/components/Attachments/constants.js +18 -0
  12. package/lib/module/components/Attachments/constants.js.map +1 -0
  13. package/lib/module/components/Attachments/index.js +4 -0
  14. package/lib/module/components/Attachments/index.js.map +1 -0
  15. package/lib/module/components/Attachments/styles.js +83 -0
  16. package/lib/module/components/Attachments/styles.js.map +1 -0
  17. package/lib/module/components/Attachments/types.js +4 -0
  18. package/lib/module/components/Attachments/types.js.map +1 -0
  19. package/lib/module/components/Chat/Chat.js +29 -0
  20. package/lib/module/components/Chat/Chat.js.map +1 -0
  21. package/lib/module/components/Chat/index.js +4 -0
  22. package/lib/module/components/Chat/index.js.map +1 -0
  23. package/lib/module/components/Chat/styles.js +17 -0
  24. package/lib/module/components/Chat/styles.js.map +1 -0
  25. package/lib/module/components/Chat/types.js +4 -0
  26. package/lib/module/components/Chat/types.js.map +1 -0
  27. package/lib/module/components/Citation/Citation.js +32 -0
  28. package/lib/module/components/Citation/Citation.js.map +1 -0
  29. package/lib/module/components/Citation/index.js +4 -0
  30. package/lib/module/components/Citation/index.js.map +1 -0
  31. package/lib/module/components/Citation/styles.js +15 -0
  32. package/lib/module/components/Citation/styles.js.map +1 -0
  33. package/lib/module/components/Citation/types.js +2 -0
  34. package/lib/module/components/Citation/types.js.map +1 -0
  35. package/lib/module/components/Composer/Composer.js +149 -0
  36. package/lib/module/components/Composer/Composer.js.map +1 -0
  37. package/lib/module/components/Composer/constants.js +14 -0
  38. package/lib/module/components/Composer/constants.js.map +1 -0
  39. package/lib/module/components/Composer/index.js +4 -0
  40. package/lib/module/components/Composer/index.js.map +1 -0
  41. package/lib/module/components/Composer/styles.js +43 -0
  42. package/lib/module/components/Composer/styles.js.map +1 -0
  43. package/lib/module/components/Composer/types.js +4 -0
  44. package/lib/module/components/Composer/types.js.map +1 -0
  45. package/lib/module/components/Confirmation/Confirmation.js +56 -0
  46. package/lib/module/components/Confirmation/Confirmation.js.map +1 -0
  47. package/lib/module/components/Confirmation/constants.js +10 -0
  48. package/lib/module/components/Confirmation/constants.js.map +1 -0
  49. package/lib/module/components/Confirmation/index.js +4 -0
  50. package/lib/module/components/Confirmation/index.js.map +1 -0
  51. package/lib/module/components/Confirmation/styles.js +34 -0
  52. package/lib/module/components/Confirmation/styles.js.map +1 -0
  53. package/lib/module/components/Confirmation/types.js +4 -0
  54. package/lib/module/components/Confirmation/types.js.map +1 -0
  55. package/lib/module/components/Feedback/Feedback.js +82 -0
  56. package/lib/module/components/Feedback/Feedback.js.map +1 -0
  57. package/lib/module/components/Feedback/constants.js +15 -0
  58. package/lib/module/components/Feedback/constants.js.map +1 -0
  59. package/lib/module/components/Feedback/index.js +4 -0
  60. package/lib/module/components/Feedback/index.js.map +1 -0
  61. package/lib/module/components/Feedback/styles.js +30 -0
  62. package/lib/module/components/Feedback/styles.js.map +1 -0
  63. package/lib/module/components/Feedback/types.js +4 -0
  64. package/lib/module/components/Feedback/types.js.map +1 -0
  65. package/lib/module/components/Message/MarkdownContent/MarkdownContent.js +68 -0
  66. package/lib/module/components/Message/MarkdownContent/MarkdownContent.js.map +1 -0
  67. package/lib/module/components/Message/MarkdownContent/MarkdownImage/MarkdownImage.js +53 -0
  68. package/lib/module/components/Message/MarkdownContent/MarkdownImage/MarkdownImage.js.map +1 -0
  69. package/lib/module/components/Message/MarkdownContent/MarkdownImage/styles.js +10 -0
  70. package/lib/module/components/Message/MarkdownContent/MarkdownImage/styles.js.map +1 -0
  71. package/lib/module/components/Message/MarkdownContent/MarkdownImage/types.js +2 -0
  72. package/lib/module/components/Message/MarkdownContent/MarkdownImage/types.js.map +1 -0
  73. package/lib/module/components/Message/MarkdownContent/styles.js +85 -0
  74. package/lib/module/components/Message/MarkdownContent/styles.js.map +1 -0
  75. package/lib/module/components/Message/MarkdownContent/types.js +2 -0
  76. package/lib/module/components/Message/MarkdownContent/types.js.map +1 -0
  77. package/lib/module/components/Message/Message.js +87 -0
  78. package/lib/module/components/Message/Message.js.map +1 -0
  79. package/lib/module/components/Message/constants.js +4 -0
  80. package/lib/module/components/Message/constants.js.map +1 -0
  81. package/lib/module/components/Message/index.js +4 -0
  82. package/lib/module/components/Message/index.js.map +1 -0
  83. package/lib/module/components/Message/isNestedAction.js +14 -0
  84. package/lib/module/components/Message/isNestedAction.js.map +1 -0
  85. package/lib/module/components/Message/styles.js +73 -0
  86. package/lib/module/components/Message/styles.js.map +1 -0
  87. package/lib/module/components/Message/types.js +4 -0
  88. package/lib/module/components/Message/types.js.map +1 -0
  89. package/lib/module/components/MessageList/MessageList.js +223 -0
  90. package/lib/module/components/MessageList/MessageList.js.map +1 -0
  91. package/lib/module/components/MessageList/constants.js +4 -0
  92. package/lib/module/components/MessageList/constants.js.map +1 -0
  93. package/lib/module/components/MessageList/index.js +4 -0
  94. package/lib/module/components/MessageList/index.js.map +1 -0
  95. package/lib/module/components/MessageList/styles.js +20 -0
  96. package/lib/module/components/MessageList/styles.js.map +1 -0
  97. package/lib/module/components/MessageList/types.js +4 -0
  98. package/lib/module/components/MessageList/types.js.map +1 -0
  99. package/lib/module/components/MessageList/webPrependAnchor/constants.js +4 -0
  100. package/lib/module/components/MessageList/webPrependAnchor/constants.js.map +1 -0
  101. package/lib/module/components/MessageList/webPrependAnchor/index.js +4 -0
  102. package/lib/module/components/MessageList/webPrependAnchor/index.js.map +1 -0
  103. package/lib/module/components/MessageList/webPrependAnchor/types.js +4 -0
  104. package/lib/module/components/MessageList/webPrependAnchor/types.js.map +1 -0
  105. package/lib/module/components/MessageList/webPrependAnchor/useWebPrependAnchor.js +19 -0
  106. package/lib/module/components/MessageList/webPrependAnchor/useWebPrependAnchor.js.map +1 -0
  107. package/lib/module/components/MessageList/webPrependAnchor/useWebPrependAnchor.web.js +208 -0
  108. package/lib/module/components/MessageList/webPrependAnchor/useWebPrependAnchor.web.js.map +1 -0
  109. package/lib/module/components/Process/Process.js +121 -0
  110. package/lib/module/components/Process/Process.js.map +1 -0
  111. package/lib/module/components/Process/constants.js +17 -0
  112. package/lib/module/components/Process/constants.js.map +1 -0
  113. package/lib/module/components/Process/index.js +4 -0
  114. package/lib/module/components/Process/index.js.map +1 -0
  115. package/lib/module/components/Process/styles.js +77 -0
  116. package/lib/module/components/Process/styles.js.map +1 -0
  117. package/lib/module/components/Process/types.js +4 -0
  118. package/lib/module/components/Process/types.js.map +1 -0
  119. package/lib/module/components/Sources/Sources.js +64 -0
  120. package/lib/module/components/Sources/Sources.js.map +1 -0
  121. package/lib/module/components/Sources/constants.js +4 -0
  122. package/lib/module/components/Sources/constants.js.map +1 -0
  123. package/lib/module/components/Sources/index.js +4 -0
  124. package/lib/module/components/Sources/index.js.map +1 -0
  125. package/lib/module/components/Sources/styles.js +52 -0
  126. package/lib/module/components/Sources/styles.js.map +1 -0
  127. package/lib/module/components/Sources/types.js +4 -0
  128. package/lib/module/components/Sources/types.js.map +1 -0
  129. package/lib/module/components/Suggestions/Suggestions.js +31 -0
  130. package/lib/module/components/Suggestions/Suggestions.js.map +1 -0
  131. package/lib/module/components/Suggestions/index.js +4 -0
  132. package/lib/module/components/Suggestions/index.js.map +1 -0
  133. package/lib/module/components/Suggestions/styles.js +18 -0
  134. package/lib/module/components/Suggestions/styles.js.map +1 -0
  135. package/lib/module/components/Suggestions/types.js +4 -0
  136. package/lib/module/components/Suggestions/types.js.map +1 -0
  137. package/lib/module/index.js +14 -0
  138. package/lib/module/index.js.map +1 -0
  139. package/lib/module/package.json +1 -0
  140. package/lib/typescript/package.json +1 -0
  141. package/lib/typescript/src/actions/index.d.ts +2 -0
  142. package/lib/typescript/src/actions/index.d.ts.map +1 -0
  143. package/lib/typescript/src/actions/types.d.ts +11 -0
  144. package/lib/typescript/src/actions/types.d.ts.map +1 -0
  145. package/lib/typescript/src/components/Attachments/AttachmentItem.d.ts +3 -0
  146. package/lib/typescript/src/components/Attachments/AttachmentItem.d.ts.map +1 -0
  147. package/lib/typescript/src/components/Attachments/Attachments.d.ts +3 -0
  148. package/lib/typescript/src/components/Attachments/Attachments.d.ts.map +1 -0
  149. package/lib/typescript/src/components/Attachments/constants.d.ts +13 -0
  150. package/lib/typescript/src/components/Attachments/constants.d.ts.map +1 -0
  151. package/lib/typescript/src/components/Attachments/index.d.ts +3 -0
  152. package/lib/typescript/src/components/Attachments/index.d.ts.map +1 -0
  153. package/lib/typescript/src/components/Attachments/styles.d.ts +80 -0
  154. package/lib/typescript/src/components/Attachments/styles.d.ts.map +1 -0
  155. package/lib/typescript/src/components/Attachments/types.d.ts +34 -0
  156. package/lib/typescript/src/components/Attachments/types.d.ts.map +1 -0
  157. package/lib/typescript/src/components/Chat/Chat.d.ts +3 -0
  158. package/lib/typescript/src/components/Chat/Chat.d.ts.map +1 -0
  159. package/lib/typescript/src/components/Chat/index.d.ts +3 -0
  160. package/lib/typescript/src/components/Chat/index.d.ts.map +1 -0
  161. package/lib/typescript/src/components/Chat/styles.d.ts +15 -0
  162. package/lib/typescript/src/components/Chat/styles.d.ts.map +1 -0
  163. package/lib/typescript/src/components/Chat/types.d.ts +12 -0
  164. package/lib/typescript/src/components/Chat/types.d.ts.map +1 -0
  165. package/lib/typescript/src/components/Citation/Citation.d.ts +3 -0
  166. package/lib/typescript/src/components/Citation/Citation.d.ts.map +1 -0
  167. package/lib/typescript/src/components/Citation/index.d.ts +3 -0
  168. package/lib/typescript/src/components/Citation/index.d.ts.map +1 -0
  169. package/lib/typescript/src/components/Citation/styles.d.ts +12 -0
  170. package/lib/typescript/src/components/Citation/styles.d.ts.map +1 -0
  171. package/lib/typescript/src/components/Citation/types.d.ts +8 -0
  172. package/lib/typescript/src/components/Citation/types.d.ts.map +1 -0
  173. package/lib/typescript/src/components/Composer/Composer.d.ts +4 -0
  174. package/lib/typescript/src/components/Composer/Composer.d.ts.map +1 -0
  175. package/lib/typescript/src/components/Composer/constants.d.ts +12 -0
  176. package/lib/typescript/src/components/Composer/constants.d.ts.map +1 -0
  177. package/lib/typescript/src/components/Composer/index.d.ts +3 -0
  178. package/lib/typescript/src/components/Composer/index.d.ts.map +1 -0
  179. package/lib/typescript/src/components/Composer/styles.d.ts +40 -0
  180. package/lib/typescript/src/components/Composer/styles.d.ts.map +1 -0
  181. package/lib/typescript/src/components/Composer/types.d.ts +53 -0
  182. package/lib/typescript/src/components/Composer/types.d.ts.map +1 -0
  183. package/lib/typescript/src/components/Confirmation/Confirmation.d.ts +3 -0
  184. package/lib/typescript/src/components/Confirmation/Confirmation.d.ts.map +1 -0
  185. package/lib/typescript/src/components/Confirmation/constants.d.ts +5 -0
  186. package/lib/typescript/src/components/Confirmation/constants.d.ts.map +1 -0
  187. package/lib/typescript/src/components/Confirmation/index.d.ts +3 -0
  188. package/lib/typescript/src/components/Confirmation/index.d.ts.map +1 -0
  189. package/lib/typescript/src/components/Confirmation/styles.d.ts +31 -0
  190. package/lib/typescript/src/components/Confirmation/styles.d.ts.map +1 -0
  191. package/lib/typescript/src/components/Confirmation/types.d.ts +19 -0
  192. package/lib/typescript/src/components/Confirmation/types.d.ts.map +1 -0
  193. package/lib/typescript/src/components/Feedback/Feedback.d.ts +3 -0
  194. package/lib/typescript/src/components/Feedback/Feedback.d.ts.map +1 -0
  195. package/lib/typescript/src/components/Feedback/constants.d.ts +5 -0
  196. package/lib/typescript/src/components/Feedback/constants.d.ts.map +1 -0
  197. package/lib/typescript/src/components/Feedback/index.d.ts +3 -0
  198. package/lib/typescript/src/components/Feedback/index.d.ts.map +1 -0
  199. package/lib/typescript/src/components/Feedback/styles.d.ts +27 -0
  200. package/lib/typescript/src/components/Feedback/styles.d.ts.map +1 -0
  201. package/lib/typescript/src/components/Feedback/types.d.ts +12 -0
  202. package/lib/typescript/src/components/Feedback/types.d.ts.map +1 -0
  203. package/lib/typescript/src/components/Message/MarkdownContent/MarkdownContent.d.ts +3 -0
  204. package/lib/typescript/src/components/Message/MarkdownContent/MarkdownContent.d.ts.map +1 -0
  205. package/lib/typescript/src/components/Message/MarkdownContent/MarkdownImage/MarkdownImage.d.ts +3 -0
  206. package/lib/typescript/src/components/Message/MarkdownContent/MarkdownImage/MarkdownImage.d.ts.map +1 -0
  207. package/lib/typescript/src/components/Message/MarkdownContent/MarkdownImage/styles.d.ts +7 -0
  208. package/lib/typescript/src/components/Message/MarkdownContent/MarkdownImage/styles.d.ts.map +1 -0
  209. package/lib/typescript/src/components/Message/MarkdownContent/MarkdownImage/types.d.ts +9 -0
  210. package/lib/typescript/src/components/Message/MarkdownContent/MarkdownImage/types.d.ts.map +1 -0
  211. package/lib/typescript/src/components/Message/MarkdownContent/styles.d.ts +92 -0
  212. package/lib/typescript/src/components/Message/MarkdownContent/styles.d.ts.map +1 -0
  213. package/lib/typescript/src/components/Message/MarkdownContent/types.d.ts +5 -0
  214. package/lib/typescript/src/components/Message/MarkdownContent/types.d.ts.map +1 -0
  215. package/lib/typescript/src/components/Message/Message.d.ts +3 -0
  216. package/lib/typescript/src/components/Message/Message.d.ts.map +1 -0
  217. package/lib/typescript/src/components/Message/constants.d.ts +2 -0
  218. package/lib/typescript/src/components/Message/constants.d.ts.map +1 -0
  219. package/lib/typescript/src/components/Message/index.d.ts +3 -0
  220. package/lib/typescript/src/components/Message/index.d.ts.map +1 -0
  221. package/lib/typescript/src/components/Message/isNestedAction.d.ts +3 -0
  222. package/lib/typescript/src/components/Message/isNestedAction.d.ts.map +1 -0
  223. package/lib/typescript/src/components/Message/styles.d.ts +70 -0
  224. package/lib/typescript/src/components/Message/styles.d.ts.map +1 -0
  225. package/lib/typescript/src/components/Message/types.d.ts +44 -0
  226. package/lib/typescript/src/components/Message/types.d.ts.map +1 -0
  227. package/lib/typescript/src/components/MessageList/MessageList.d.ts +4 -0
  228. package/lib/typescript/src/components/MessageList/MessageList.d.ts.map +1 -0
  229. package/lib/typescript/src/components/MessageList/constants.d.ts +2 -0
  230. package/lib/typescript/src/components/MessageList/constants.d.ts.map +1 -0
  231. package/lib/typescript/src/components/MessageList/index.d.ts +3 -0
  232. package/lib/typescript/src/components/MessageList/index.d.ts.map +1 -0
  233. package/lib/typescript/src/components/MessageList/styles.d.ts +16 -0
  234. package/lib/typescript/src/components/MessageList/styles.d.ts.map +1 -0
  235. package/lib/typescript/src/components/MessageList/types.d.ts +36 -0
  236. package/lib/typescript/src/components/MessageList/types.d.ts.map +1 -0
  237. package/lib/typescript/src/components/MessageList/webPrependAnchor/constants.d.ts +2 -0
  238. package/lib/typescript/src/components/MessageList/webPrependAnchor/constants.d.ts.map +1 -0
  239. package/lib/typescript/src/components/MessageList/webPrependAnchor/index.d.ts +3 -0
  240. package/lib/typescript/src/components/MessageList/webPrependAnchor/index.d.ts.map +1 -0
  241. package/lib/typescript/src/components/MessageList/webPrependAnchor/types.d.ts +72 -0
  242. package/lib/typescript/src/components/MessageList/webPrependAnchor/types.d.ts.map +1 -0
  243. package/lib/typescript/src/components/MessageList/webPrependAnchor/useWebPrependAnchor.d.ts +3 -0
  244. package/lib/typescript/src/components/MessageList/webPrependAnchor/useWebPrependAnchor.d.ts.map +1 -0
  245. package/lib/typescript/src/components/MessageList/webPrependAnchor/useWebPrependAnchor.web.d.ts +3 -0
  246. package/lib/typescript/src/components/MessageList/webPrependAnchor/useWebPrependAnchor.web.d.ts.map +1 -0
  247. package/lib/typescript/src/components/Process/Process.d.ts +3 -0
  248. package/lib/typescript/src/components/Process/Process.d.ts.map +1 -0
  249. package/lib/typescript/src/components/Process/constants.d.ts +5 -0
  250. package/lib/typescript/src/components/Process/constants.d.ts.map +1 -0
  251. package/lib/typescript/src/components/Process/index.d.ts +3 -0
  252. package/lib/typescript/src/components/Process/index.d.ts.map +1 -0
  253. package/lib/typescript/src/components/Process/styles.d.ts +74 -0
  254. package/lib/typescript/src/components/Process/styles.d.ts.map +1 -0
  255. package/lib/typescript/src/components/Process/types.d.ts +32 -0
  256. package/lib/typescript/src/components/Process/types.d.ts.map +1 -0
  257. package/lib/typescript/src/components/Sources/Sources.d.ts +3 -0
  258. package/lib/typescript/src/components/Sources/Sources.d.ts.map +1 -0
  259. package/lib/typescript/src/components/Sources/constants.d.ts +2 -0
  260. package/lib/typescript/src/components/Sources/constants.d.ts.map +1 -0
  261. package/lib/typescript/src/components/Sources/index.d.ts +3 -0
  262. package/lib/typescript/src/components/Sources/index.d.ts.map +1 -0
  263. package/lib/typescript/src/components/Sources/styles.d.ts +49 -0
  264. package/lib/typescript/src/components/Sources/styles.d.ts.map +1 -0
  265. package/lib/typescript/src/components/Sources/types.d.ts +16 -0
  266. package/lib/typescript/src/components/Sources/types.d.ts.map +1 -0
  267. package/lib/typescript/src/components/Suggestions/Suggestions.d.ts +3 -0
  268. package/lib/typescript/src/components/Suggestions/Suggestions.d.ts.map +1 -0
  269. package/lib/typescript/src/components/Suggestions/index.d.ts +3 -0
  270. package/lib/typescript/src/components/Suggestions/index.d.ts.map +1 -0
  271. package/lib/typescript/src/components/Suggestions/styles.d.ts +14 -0
  272. package/lib/typescript/src/components/Suggestions/styles.d.ts.map +1 -0
  273. package/lib/typescript/src/components/Suggestions/types.d.ts +18 -0
  274. package/lib/typescript/src/components/Suggestions/types.d.ts.map +1 -0
  275. package/lib/typescript/src/index.d.ts +24 -0
  276. package/lib/typescript/src/index.d.ts.map +1 -0
  277. package/package.json +178 -0
  278. package/src/actions/index.ts +1 -0
  279. package/src/actions/types.ts +11 -0
  280. package/src/components/Attachments/AttachmentItem.tsx +139 -0
  281. package/src/components/Attachments/Attachments.tsx +72 -0
  282. package/src/components/Attachments/constants.ts +21 -0
  283. package/src/components/Attachments/index.ts +6 -0
  284. package/src/components/Attachments/styles.ts +54 -0
  285. package/src/components/Attachments/types.ts +38 -0
  286. package/src/components/Chat/Chat.tsx +26 -0
  287. package/src/components/Chat/index.ts +2 -0
  288. package/src/components/Chat/styles.ts +12 -0
  289. package/src/components/Chat/types.ts +11 -0
  290. package/src/components/Citation/Citation.tsx +33 -0
  291. package/src/components/Citation/index.ts +2 -0
  292. package/src/components/Citation/styles.ts +15 -0
  293. package/src/components/Citation/types.ts +7 -0
  294. package/src/components/Composer/Composer.tsx +208 -0
  295. package/src/components/Composer/constants.ts +11 -0
  296. package/src/components/Composer/index.ts +11 -0
  297. package/src/components/Composer/styles.ts +25 -0
  298. package/src/components/Composer/types.ts +61 -0
  299. package/src/components/Confirmation/Confirmation.tsx +63 -0
  300. package/src/components/Confirmation/constants.ts +12 -0
  301. package/src/components/Confirmation/index.ts +2 -0
  302. package/src/components/Confirmation/styles.ts +39 -0
  303. package/src/components/Confirmation/types.ts +21 -0
  304. package/src/components/Feedback/Feedback.tsx +87 -0
  305. package/src/components/Feedback/constants.ts +16 -0
  306. package/src/components/Feedback/index.ts +2 -0
  307. package/src/components/Feedback/styles.ts +30 -0
  308. package/src/components/Feedback/types.ts +13 -0
  309. package/src/components/Message/MarkdownContent/MarkdownContent.tsx +70 -0
  310. package/src/components/Message/MarkdownContent/MarkdownImage/MarkdownImage.tsx +52 -0
  311. package/src/components/Message/MarkdownContent/MarkdownImage/styles.ts +4 -0
  312. package/src/components/Message/MarkdownContent/MarkdownImage/types.ts +8 -0
  313. package/src/components/Message/MarkdownContent/styles.ts +61 -0
  314. package/src/components/Message/MarkdownContent/types.ts +4 -0
  315. package/src/components/Message/Message.tsx +137 -0
  316. package/src/components/Message/constants.ts +2 -0
  317. package/src/components/Message/index.ts +10 -0
  318. package/src/components/Message/isNestedAction.ts +22 -0
  319. package/src/components/Message/styles.ts +42 -0
  320. package/src/components/Message/types.ts +45 -0
  321. package/src/components/MessageList/MessageList.tsx +238 -0
  322. package/src/components/MessageList/constants.ts +1 -0
  323. package/src/components/MessageList/index.ts +6 -0
  324. package/src/components/MessageList/styles.ts +7 -0
  325. package/src/components/MessageList/types.ts +36 -0
  326. package/src/components/MessageList/webPrependAnchor/constants.ts +6 -0
  327. package/src/components/MessageList/webPrependAnchor/index.ts +7 -0
  328. package/src/components/MessageList/webPrependAnchor/types.ts +92 -0
  329. package/src/components/MessageList/webPrependAnchor/useWebPrependAnchor.ts +27 -0
  330. package/src/components/MessageList/webPrependAnchor/useWebPrependAnchor.web.ts +293 -0
  331. package/src/components/Process/Process.tsx +160 -0
  332. package/src/components/Process/constants.ts +22 -0
  333. package/src/components/Process/index.ts +9 -0
  334. package/src/components/Process/styles.ts +77 -0
  335. package/src/components/Process/types.ts +39 -0
  336. package/src/components/Sources/Sources.tsx +70 -0
  337. package/src/components/Sources/constants.ts +1 -0
  338. package/src/components/Sources/index.ts +2 -0
  339. package/src/components/Sources/styles.ts +59 -0
  340. package/src/components/Sources/types.ts +17 -0
  341. package/src/components/Suggestions/Suggestions.tsx +34 -0
  342. package/src/components/Suggestions/index.ts +2 -0
  343. package/src/components/Suggestions/styles.ts +16 -0
  344. package/src/components/Suggestions/types.ts +19 -0
  345. package/src/index.tsx +61 -0
@@ -0,0 +1,52 @@
1
+ import { useEffect, useState } from 'react';
2
+ import { Image, View } from 'react-native';
3
+ import { Icon, Thumbnail } from '@unif/react-native-design';
4
+ import { styles } from './styles';
5
+ import type { ImageRatio, MarkdownImageProps } from './types';
6
+
7
+ export function MarkdownImage({ uri, label }: MarkdownImageProps) {
8
+ const [width, setWidth] = useState(1);
9
+ const [ratio, setRatio] = useState<ImageRatio | undefined>(undefined);
10
+ useEffect(() => {
11
+ let active = true;
12
+ // 只取资源几何;加载与失败占位仍由 Design Thumbnail 持有。
13
+ Image.getSize(
14
+ uri,
15
+ (imageWidth, imageHeight) => {
16
+ if (
17
+ active &&
18
+ Number.isFinite(imageWidth) &&
19
+ Number.isFinite(imageHeight) &&
20
+ imageWidth > 0 &&
21
+ imageHeight > 0
22
+ ) {
23
+ setRatio({ uri, value: imageWidth / imageHeight });
24
+ }
25
+ },
26
+ () => {}
27
+ );
28
+ return () => {
29
+ active = false;
30
+ };
31
+ }, [uri]);
32
+ return (
33
+ <View
34
+ style={styles.root}
35
+ onLayout={({ nativeEvent: { layout } }) =>
36
+ setWidth(Math.max(1, layout.width))
37
+ }
38
+ >
39
+ <Thumbnail
40
+ source={{ uri }}
41
+ size={{
42
+ width,
43
+ height: width / (ratio?.uri === uri ? ratio.value : 1),
44
+ borderRadius: 0,
45
+ }}
46
+ resizeMode="contain"
47
+ fallback={<Icon name="image" />}
48
+ accessibilityLabel={label || '图片'}
49
+ />
50
+ </View>
51
+ );
52
+ }
@@ -0,0 +1,4 @@
1
+ import { StyleSheet } from 'react-native';
2
+ export const styles = StyleSheet.create({
3
+ root: { width: '100%', minWidth: 1 },
4
+ });
@@ -0,0 +1,8 @@
1
+ export interface MarkdownImageProps {
2
+ uri: string;
3
+ label?: string;
4
+ }
5
+ export interface ImageRatio {
6
+ uri: string;
7
+ value: number;
8
+ }
@@ -0,0 +1,61 @@
1
+ import { StyleSheet } from 'react-native';
2
+ import { type, space, fontMono } from '@unif/react-native-design';
3
+ import type { ColorTokens } from '@unif/react-native-design';
4
+
5
+ export const createStyles = (colors: ColorTokens) => {
6
+ const body = {
7
+ fontSize: type.body,
8
+ lineHeight: type.body * 1.5,
9
+ color: colors.foreground,
10
+ };
11
+ return StyleSheet.create({
12
+ text: body,
13
+ em: { ...body, fontStyle: 'italic' },
14
+ strong: { ...body, fontWeight: 'bold' },
15
+ strikethrough: { ...body, textDecorationLine: 'line-through' },
16
+ link: { ...body, color: colors.primary },
17
+ li: body,
18
+ codespan: {
19
+ ...body,
20
+ fontFamily: fontMono,
21
+ backgroundColor: colors.surfaceContainer,
22
+ },
23
+ h1: {
24
+ fontSize: type.h1,
25
+ lineHeight: type.h1 * 1.4,
26
+ color: colors.foreground,
27
+ borderBottomColor: colors.outline,
28
+ },
29
+ h2: {
30
+ fontSize: type.h2,
31
+ lineHeight: type.h2 * 1.4,
32
+ color: colors.foreground,
33
+ borderBottomColor: colors.outline,
34
+ },
35
+ h3: {
36
+ fontSize: type.h3,
37
+ lineHeight: type.h3 * 1.4,
38
+ color: colors.foreground,
39
+ },
40
+ h4: {
41
+ fontSize: type.body,
42
+ lineHeight: type.body * 1.4,
43
+ color: colors.foreground,
44
+ },
45
+ h5: {
46
+ fontSize: type.sm,
47
+ lineHeight: type.sm * 1.4,
48
+ color: colors.foreground,
49
+ },
50
+ h6: {
51
+ fontSize: type.xs,
52
+ lineHeight: type.xs * 1.4,
53
+ color: colors.foreground,
54
+ },
55
+ paragraph: { paddingVertical: space[1] },
56
+ code: { padding: space[2], backgroundColor: colors.surfaceContainer },
57
+ blockquote: { borderLeftColor: colors.outline },
58
+ hr: { borderBottomColor: colors.outline },
59
+ table: { borderColor: colors.outline },
60
+ });
61
+ };
@@ -0,0 +1,4 @@
1
+ export interface MarkdownContentProps {
2
+ text: string;
3
+ onLinkPress?(url: string): void;
4
+ }
@@ -0,0 +1,137 @@
1
+ import { Pressable, Text, View } from 'react-native';
2
+ import { Button, Spinner, useThemedStyles } from '@unif/react-native-design';
3
+ import { MarkdownContent } from './MarkdownContent/MarkdownContent';
4
+ import { createStyles } from './styles';
5
+ import { isNestedAction } from './isNestedAction';
6
+ import type { MessageProps } from './types';
7
+
8
+ export function Message(props: MessageProps) {
9
+ const {
10
+ placement = 'start',
11
+ avatar,
12
+ name,
13
+ surface = 'bubble',
14
+ fullWidth = false,
15
+ status = 'idle',
16
+ statusText,
17
+ header,
18
+ footer,
19
+ actions = [],
20
+ onPress,
21
+ onLongPress,
22
+ style,
23
+ testID,
24
+ } = props;
25
+ const styles = useThemedStyles(createStyles);
26
+ const hasContent =
27
+ Boolean(props.text?.length) ||
28
+ (props.children !== undefined &&
29
+ props.children !== null &&
30
+ props.children !== false) ||
31
+ (header !== undefined && header !== null && header !== false) ||
32
+ (footer !== undefined && footer !== null && footer !== false);
33
+ const waiting =
34
+ (status === 'pending' || status === 'streaming') && !hasContent;
35
+ const contentStyle = [
36
+ styles.content,
37
+ fullWidth && styles.fullWidth,
38
+ surface === 'bubble' && [
39
+ styles.bubble,
40
+ placement === 'end' && styles.outgoing,
41
+ ],
42
+ surface === 'outlined' && styles.outlined,
43
+ status === 'failed' && styles.failed,
44
+ ];
45
+ const content = (
46
+ <>
47
+ {header}
48
+ {props.text !== undefined ? (
49
+ props.format === 'markdown' ? (
50
+ <MarkdownContent text={props.text} onLinkPress={props.onLinkPress} />
51
+ ) : (
52
+ <Text
53
+ selectable
54
+ style={styles.text}
55
+ numberOfLines={props.numberOfLines}
56
+ >
57
+ {props.text}
58
+ </Text>
59
+ )
60
+ ) : (
61
+ props.children
62
+ )}
63
+ {waiting ? (
64
+ <View
65
+ accessible
66
+ accessibilityLabel="正在等待回复"
67
+ accessibilityState={{ busy: true }}
68
+ >
69
+ <Spinner />
70
+ </View>
71
+ ) : null}
72
+ {statusText ? (
73
+ <Text style={[styles.status, status === 'failed' && styles.errorText]}>
74
+ {statusText}
75
+ </Text>
76
+ ) : null}
77
+ {footer}
78
+ </>
79
+ );
80
+ return (
81
+ <View
82
+ style={[styles.root, placement === 'end' && styles.end, style]}
83
+ testID={testID}
84
+ >
85
+ {avatar}
86
+ <View
87
+ style={[
88
+ styles.column,
89
+ placement === 'end' && styles.columnEnd,
90
+ fullWidth && styles.fullWidth,
91
+ ]}
92
+ >
93
+ {name ? <Text style={styles.name}>{name}</Text> : null}
94
+ {onPress || onLongPress ? (
95
+ <Pressable
96
+ style={contentStyle}
97
+ onPress={
98
+ onPress
99
+ ? (event) => {
100
+ if (!isNestedAction(event)) onPress();
101
+ }
102
+ : undefined
103
+ }
104
+ onLongPress={
105
+ onLongPress
106
+ ? (event) => {
107
+ if (!isNestedAction(event)) onLongPress();
108
+ }
109
+ : undefined
110
+ }
111
+ accessible={false}
112
+ >
113
+ {content}
114
+ </Pressable>
115
+ ) : (
116
+ <View style={contentStyle}>{content}</View>
117
+ )}
118
+ {actions.length ? (
119
+ <View style={styles.actions}>
120
+ {actions.map((action) => (
121
+ <Button
122
+ key={action.id}
123
+ label={action.label}
124
+ leftIcon={action.icon}
125
+ disabled={action.disabled}
126
+ loading={action.loading}
127
+ accessibilityHint={action.accessibilityHint}
128
+ variant="text"
129
+ onPress={action.onPress}
130
+ />
131
+ ))}
132
+ </View>
133
+ ) : null}
134
+ </View>
135
+ </View>
136
+ );
137
+ }
@@ -0,0 +1,2 @@
1
+ export const INTERACTIVE_CONTENT_SELECTOR =
2
+ 'button,a,input,textarea,select,[role="button"],[role="link"],[role="checkbox"],[role="switch"],[role="menuitem"],[role="tab"]';
@@ -0,0 +1,10 @@
1
+ export { Message } from './Message';
2
+ export type {
3
+ MessageBaseProps,
4
+ MessageCustomContent,
5
+ MessageMarkdownContent,
6
+ MessagePlainContent,
7
+ MessagePlacement,
8
+ MessageProps,
9
+ MessageStatus,
10
+ } from './types';
@@ -0,0 +1,22 @@
1
+ import type { GestureResponderEvent } from 'react-native';
2
+ import { INTERACTIVE_CONTENT_SELECTOR } from './constants';
3
+
4
+ export function isNestedAction(event: GestureResponderEvent): boolean {
5
+ const { target, currentTarget } = event;
6
+ // 原生由 responder 交付实际目标;Web 的 RNGH 按钮仍可能冒泡到 RN Pressable。
7
+ if (
8
+ typeof target !== 'object' ||
9
+ target === null ||
10
+ !('closest' in target) ||
11
+ typeof target.closest !== 'function' ||
12
+ typeof currentTarget !== 'object' ||
13
+ currentTarget === null ||
14
+ !('contains' in currentTarget) ||
15
+ typeof currentTarget.contains !== 'function'
16
+ )
17
+ return false;
18
+ const action = target.closest(INTERACTIVE_CONTENT_SELECTOR);
19
+ return Boolean(
20
+ action && action !== currentTarget && currentTarget.contains(action)
21
+ );
22
+ }
@@ -0,0 +1,42 @@
1
+ import { StyleSheet } from 'react-native';
2
+ import { radius, space, type } from '@unif/react-native-design';
3
+ import type { ColorTokens } from '@unif/react-native-design';
4
+
5
+ export const createStyles = (colors: ColorTokens) =>
6
+ StyleSheet.create({
7
+ root: {
8
+ flexDirection: 'row',
9
+ alignItems: 'flex-start',
10
+ gap: space[2],
11
+ minWidth: 0,
12
+ paddingVertical: space[2],
13
+ },
14
+ end: { flexDirection: 'row-reverse' },
15
+ column: {
16
+ flexShrink: 1,
17
+ maxWidth: '100%',
18
+ gap: space[1],
19
+ alignItems: 'flex-start',
20
+ },
21
+ columnEnd: { alignItems: 'flex-end' },
22
+ fullWidth: { flex: 1, alignSelf: 'stretch' },
23
+ content: { minWidth: 0, maxWidth: '100%', gap: space[2] },
24
+ bubble: {
25
+ padding: space[3],
26
+ borderRadius: radius.lg,
27
+ backgroundColor: colors.surface,
28
+ },
29
+ outgoing: { backgroundColor: colors.primaryContainer },
30
+ outlined: {
31
+ padding: space[3],
32
+ borderRadius: radius.lg,
33
+ borderWidth: 1,
34
+ borderColor: colors.outline,
35
+ },
36
+ failed: { borderWidth: 1, borderColor: colors.error },
37
+ text: { fontSize: type.body, color: colors.foreground },
38
+ name: { fontSize: type.sm, color: colors.foregroundMuted },
39
+ status: { fontSize: type.sm, color: colors.foregroundMuted },
40
+ errorText: { color: colors.error },
41
+ actions: { flexDirection: 'row', flexWrap: 'wrap', gap: space[2] },
42
+ });
@@ -0,0 +1,45 @@
1
+ import type { ReactNode } from 'react';
2
+ import type { StyleProp, ViewStyle } from 'react-native';
3
+ import type { ChatAction } from '../../actions';
4
+
5
+ export type MessagePlacement = 'start' | 'end';
6
+ export type MessageStatus = 'idle' | 'pending' | 'streaming' | 'failed';
7
+ export interface MessageBaseProps {
8
+ placement?: MessagePlacement;
9
+ avatar?: ReactNode;
10
+ name?: string;
11
+ surface?: 'bubble' | 'outlined' | 'plain';
12
+ fullWidth?: boolean;
13
+ status?: MessageStatus;
14
+ statusText?: string;
15
+ header?: ReactNode;
16
+ footer?: ReactNode;
17
+ actions?: readonly ChatAction[];
18
+ onPress?(): void;
19
+ onLongPress?(): void;
20
+ style?: StyleProp<ViewStyle>;
21
+ testID?: string;
22
+ }
23
+ export interface MessagePlainContent {
24
+ text: string;
25
+ format?: 'text';
26
+ numberOfLines?: number;
27
+ children?: never;
28
+ onLinkPress?: never;
29
+ }
30
+ export interface MessageMarkdownContent {
31
+ text: string;
32
+ format: 'markdown';
33
+ onLinkPress?(url: string): void;
34
+ numberOfLines?: never;
35
+ children?: never;
36
+ }
37
+ export interface MessageCustomContent {
38
+ children?: ReactNode;
39
+ text?: never;
40
+ format?: never;
41
+ numberOfLines?: never;
42
+ onLinkPress?: never;
43
+ }
44
+ export type MessageProps = MessageBaseProps &
45
+ (MessagePlainContent | MessageMarkdownContent | MessageCustomContent);
@@ -0,0 +1,238 @@
1
+ import { useImperativeHandle, useLayoutEffect, useRef, useState } from 'react';
2
+ import type { RefAttributes } from 'react';
3
+ import { FlatList, View } from 'react-native';
4
+ import type { NativeScrollEvent, NativeSyntheticEvent } from 'react-native';
5
+ import { Button } from '@unif/react-native-design';
6
+ import { DEFAULT_END_THRESHOLD } from './constants';
7
+ import { styles } from './styles';
8
+ import { useWebPrependAnchor } from './webPrependAnchor';
9
+ import type {
10
+ ListMeasurements,
11
+ MessageListHandle,
12
+ MessageListProps,
13
+ MessageListScrollOptions,
14
+ } from './types';
15
+
16
+ export function MessageList<T>({
17
+ items,
18
+ keyExtractor,
19
+ renderItem,
20
+ extraData,
21
+ header,
22
+ footer,
23
+ empty,
24
+ renderSeparator,
25
+ initialPosition = 'end',
26
+ followOutput = 'whenAtEnd',
27
+ endThreshold = DEFAULT_END_THRESHOLD,
28
+ showScrollToEnd = true,
29
+ onAtEndChange,
30
+ hasEarlier = false,
31
+ loadingEarlier = false,
32
+ onRequestEarlier,
33
+ keyboardDismissMode = 'on-drag',
34
+ style,
35
+ testID,
36
+ ref,
37
+ }: MessageListProps<T> & RefAttributes<MessageListHandle>) {
38
+ const listRef = useRef<FlatList<T>>(null);
39
+ const measurements = useRef<ListMeasurements>({
40
+ viewport: 0,
41
+ content: 0,
42
+ offset: 0,
43
+ hasContentSize: false,
44
+ });
45
+ const initial = useRef(initialPosition);
46
+ const initialized = useRef(false);
47
+ const previousKeys = useRef<readonly string[]>([]);
48
+ const prependPending = useRef(false);
49
+ const pendingScroll = useRef<MessageListScrollOptions | undefined>(undefined);
50
+ const userScrolling = useRef(false);
51
+ const atEndRef = useRef<boolean | undefined>(undefined);
52
+ const [atEnd, setAtEnd] = useState(true);
53
+ const threshold = Number.isFinite(endThreshold)
54
+ ? Math.max(0, endThreshold)
55
+ : DEFAULT_END_THRESHOLD;
56
+ const keys = items.map(keyExtractor);
57
+ const { getRowNativeID, preservingPrependRef, cancelPrependPreservation } =
58
+ useWebPrependAnchor({ listRef, itemsIdentity: items, keys });
59
+
60
+ useLayoutEffect(() => {
61
+ const previous = previousKeys.current;
62
+ const added = keys.length - previous.length;
63
+ const onlyPrepended =
64
+ previous.length > 0 &&
65
+ added > 0 &&
66
+ previous.every((key, index) => keys[index + added] === key);
67
+ const changed =
68
+ keys.length !== previous.length ||
69
+ keys.some((key, index) => key !== previous[index]);
70
+ if (changed) prependPending.current = onlyPrepended;
71
+ previousKeys.current = keys;
72
+ });
73
+
74
+ function ready() {
75
+ const current = measurements.current;
76
+ return current.viewport > 0 && current.hasContentSize;
77
+ }
78
+
79
+ function publishPosition() {
80
+ if (!ready()) return;
81
+ const { viewport, content, offset } = measurements.current;
82
+ const next = content - viewport - Math.max(0, offset) <= threshold;
83
+ if (next !== atEndRef.current) {
84
+ atEndRef.current = next;
85
+ setAtEnd(next);
86
+ onAtEndChange?.(next);
87
+ }
88
+ }
89
+
90
+ function scrollToEnd(options: MessageListScrollOptions = {}) {
91
+ cancelPrependPreservation();
92
+ const request = { animated: options.animated ?? true };
93
+ if (!ready()) {
94
+ pendingScroll.current = request;
95
+ return;
96
+ }
97
+ pendingScroll.current = undefined;
98
+ listRef.current?.scrollToOffset({
99
+ offset: Math.max(
100
+ 0,
101
+ measurements.current.content - measurements.current.viewport
102
+ ),
103
+ animated: request.animated,
104
+ });
105
+ if (measurements.current.content <= measurements.current.viewport)
106
+ publishPosition();
107
+ }
108
+
109
+ useImperativeHandle(ref, () => ({ scrollToEnd }));
110
+
111
+ function reconcileLayout(contentChanged: boolean) {
112
+ if (!ready()) return;
113
+ const request = pendingScroll.current;
114
+ if (items.length > 0 && !initialized.current) {
115
+ initialized.current = true;
116
+ if (request || initial.current === 'end') {
117
+ scrollToEnd(request ?? { animated: false });
118
+ return;
119
+ }
120
+ publishPosition();
121
+ return;
122
+ }
123
+ if (request) {
124
+ scrollToEnd(request);
125
+ return;
126
+ }
127
+ const prepended = prependPending.current;
128
+ if (contentChanged) prependPending.current = false;
129
+ const shouldFollow =
130
+ initialized.current &&
131
+ followOutput === 'whenAtEnd' &&
132
+ !userScrolling.current &&
133
+ !prepended &&
134
+ !preservingPrependRef.current &&
135
+ atEndRef.current;
136
+ if (shouldFollow) scrollToEnd({ animated: false });
137
+ else publishPosition();
138
+ }
139
+
140
+ function onScroll(event: NativeSyntheticEvent<NativeScrollEvent>) {
141
+ const { contentOffset, contentSize, layoutMeasurement } = event.nativeEvent;
142
+ const movedUp = contentOffset.y < measurements.current.offset;
143
+ const resizingAtEnd =
144
+ atEndRef.current &&
145
+ !movedUp &&
146
+ !userScrolling.current &&
147
+ followOutput === 'whenAtEnd' &&
148
+ (measurements.current.content !== contentSize.height ||
149
+ measurements.current.viewport !== layoutMeasurement.height);
150
+ measurements.current = {
151
+ offset: contentOffset.y,
152
+ content: contentSize.height,
153
+ viewport: layoutMeasurement.height,
154
+ hasContentSize: true,
155
+ };
156
+ if (!resizingAtEnd) publishPosition();
157
+ }
158
+
159
+ const history = hasEarlier && onRequestEarlier;
160
+ const hasHeader = Boolean(header || history);
161
+ return (
162
+ <View style={[styles.root, style]} testID={testID}>
163
+ <FlatList
164
+ ref={listRef}
165
+ testID={testID ? `${testID}-list` : undefined}
166
+ style={styles.list}
167
+ data={items}
168
+ keyExtractor={keyExtractor}
169
+ extraData={extraData}
170
+ renderItem={({ item, index }) => (
171
+ <View nativeID={getRowNativeID(keyExtractor(item))}>
172
+ {index > 0 && renderSeparator
173
+ ? renderSeparator(items[index - 1]!, item)
174
+ : null}
175
+ {renderItem(item, index)}
176
+ </View>
177
+ )}
178
+ ListHeaderComponent={
179
+ hasHeader ? (
180
+ <View>
181
+ {header}
182
+ {history ? (
183
+ <Button
184
+ label={loadingEarlier ? '正在加载…' : '查看更早消息'}
185
+ variant="text"
186
+ loading={loadingEarlier}
187
+ onPress={onRequestEarlier}
188
+ />
189
+ ) : null}
190
+ </View>
191
+ ) : undefined
192
+ }
193
+ ListFooterComponent={footer ? <View>{footer}</View> : undefined}
194
+ ListEmptyComponent={empty ? <View>{empty}</View> : undefined}
195
+ maintainVisibleContentPosition={{ minIndexForVisible: 0 }}
196
+ keyboardDismissMode={keyboardDismissMode}
197
+ keyboardShouldPersistTaps="handled"
198
+ scrollEventThrottle={16}
199
+ onLayout={({ nativeEvent: { layout } }) => {
200
+ measurements.current.viewport = layout.height;
201
+ reconcileLayout(false);
202
+ }}
203
+ onContentSizeChange={(_width, height) => {
204
+ measurements.current.content = height;
205
+ measurements.current.hasContentSize = true;
206
+ reconcileLayout(true);
207
+ }}
208
+ onScroll={onScroll}
209
+ onScrollBeginDrag={() => {
210
+ userScrolling.current = true;
211
+ }}
212
+ onMomentumScrollBegin={() => {
213
+ userScrolling.current = true;
214
+ }}
215
+ onScrollEndDrag={(event) => {
216
+ onScroll(event);
217
+ if (!event.nativeEvent.velocity?.y) {
218
+ userScrolling.current = false;
219
+ publishPosition();
220
+ }
221
+ }}
222
+ onMomentumScrollEnd={(event) => {
223
+ onScroll(event);
224
+ userScrolling.current = false;
225
+ publishPosition();
226
+ }}
227
+ />
228
+ {showScrollToEnd && items.length > 0 && !atEnd ? (
229
+ <Button
230
+ label="回到最新消息"
231
+ variant="secondary"
232
+ style={styles.returnToEnd}
233
+ onPress={() => scrollToEnd()}
234
+ />
235
+ ) : null}
236
+ </View>
237
+ );
238
+ }
@@ -0,0 +1 @@
1
+ export const DEFAULT_END_THRESHOLD = 24;
@@ -0,0 +1,6 @@
1
+ export { MessageList } from './MessageList';
2
+ export type {
3
+ MessageListHandle,
4
+ MessageListProps,
5
+ MessageListScrollOptions,
6
+ } from './types';
@@ -0,0 +1,7 @@
1
+ import { StyleSheet } from 'react-native';
2
+ import { space } from '@unif/react-native-design';
3
+ export const styles = StyleSheet.create({
4
+ root: { flex: 1, minHeight: 0, minWidth: 0 },
5
+ list: { flex: 1 },
6
+ returnToEnd: { position: 'absolute', bottom: space[3], alignSelf: 'center' },
7
+ });
@@ -0,0 +1,36 @@
1
+ import type { ReactNode } from 'react';
2
+ import type { StyleProp, ViewStyle } from 'react-native';
3
+
4
+ export interface MessageListScrollOptions {
5
+ animated?: boolean;
6
+ }
7
+ export interface MessageListHandle {
8
+ scrollToEnd(options?: MessageListScrollOptions): void;
9
+ }
10
+ export interface MessageListProps<T> {
11
+ items: readonly T[];
12
+ keyExtractor(item: T): string;
13
+ renderItem(item: T, index: number): ReactNode;
14
+ extraData?: unknown;
15
+ header?: ReactNode;
16
+ footer?: ReactNode;
17
+ empty?: ReactNode;
18
+ renderSeparator?(previous: T, next: T): ReactNode;
19
+ initialPosition?: 'start' | 'end';
20
+ followOutput?: 'whenAtEnd' | 'never';
21
+ endThreshold?: number;
22
+ showScrollToEnd?: boolean;
23
+ onAtEndChange?(atEnd: boolean): void;
24
+ hasEarlier?: boolean;
25
+ loadingEarlier?: boolean;
26
+ onRequestEarlier?(): void;
27
+ keyboardDismissMode?: 'none' | 'on-drag';
28
+ style?: StyleProp<ViewStyle>;
29
+ testID?: string;
30
+ }
31
+ export interface ListMeasurements {
32
+ viewport: number;
33
+ content: number;
34
+ offset: number;
35
+ hasContentSize: boolean;
36
+ }