@ethora/chat-component-rn 26.7.4 → 26.7.5

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 (288) hide show
  1. package/CHANGELOG.md +0 -54
  2. package/README.md +8 -31
  3. package/lib/commonjs/assets/icons.js +2 -7
  4. package/lib/commonjs/assets/icons.js.map +1 -1
  5. package/lib/commonjs/components/Header/HeaderRoomList.js +6 -20
  6. package/lib/commonjs/components/Header/HeaderRoomList.js.map +1 -1
  7. package/lib/commonjs/components/MainComponents/ChatRoom.js +14 -36
  8. package/lib/commonjs/components/MainComponents/ChatRoom.js.map +1 -1
  9. package/lib/commonjs/components/MainComponents/MessageList.js +23 -7
  10. package/lib/commonjs/components/MainComponents/MessageList.js.map +1 -1
  11. package/lib/commonjs/components/MainComponents/ProfileImagePlaceholder.js +13 -14
  12. package/lib/commonjs/components/MainComponents/ProfileImagePlaceholder.js.map +1 -1
  13. package/lib/commonjs/components/MainComponents/RoomList.js +32 -62
  14. package/lib/commonjs/components/MainComponents/RoomList.js.map +1 -1
  15. package/lib/commonjs/components/Menu/HeaderRoomListMenu.js +98 -309
  16. package/lib/commonjs/components/Menu/HeaderRoomListMenu.js.map +1 -1
  17. package/lib/commonjs/components/Modals/AttachSheet/AttachSheet.js +110 -320
  18. package/lib/commonjs/components/Modals/AttachSheet/AttachSheet.js.map +1 -1
  19. package/lib/commonjs/components/Modals/ChatProfileModal/ChatProfileModal.js +213 -552
  20. package/lib/commonjs/components/Modals/ChatProfileModal/ChatProfileModal.js.map +1 -1
  21. package/lib/commonjs/components/Modals/FilePreviewModal/FilePreviewModal.js +2 -6
  22. package/lib/commonjs/components/Modals/FilePreviewModal/FilePreviewModal.js.map +1 -1
  23. package/lib/commonjs/components/Modals/Modal/Modal.js +0 -8
  24. package/lib/commonjs/components/Modals/Modal/Modal.js.map +1 -1
  25. package/lib/commonjs/components/Modals/NewChatModal/ModalContent.js +1 -2
  26. package/lib/commonjs/components/Modals/NewChatModal/ModalContent.js.map +1 -1
  27. package/lib/commonjs/components/Modals/NewChatModal/NewChatModal.js +104 -202
  28. package/lib/commonjs/components/Modals/NewChatModal/NewChatModal.js.map +1 -1
  29. package/lib/commonjs/components/Modals/NewChatModal/UpdNewChatModal.js +0 -8
  30. package/lib/commonjs/components/Modals/NewChatModal/UpdNewChatModal.js.map +1 -1
  31. package/lib/commonjs/components/Modals/SelectUsersModal/SelectUsersModal.js +2 -4
  32. package/lib/commonjs/components/Modals/SelectUsersModal/SelectUsersModal.js.map +1 -1
  33. package/lib/commonjs/components/Modals/UserProfileModal/EditUserModal.js +21 -7
  34. package/lib/commonjs/components/Modals/UserProfileModal/EditUserModal.js.map +1 -1
  35. package/lib/commonjs/components/Modals/UserProfileModal/UserProfileModal.js +244 -507
  36. package/lib/commonjs/components/Modals/UserProfileModal/UserProfileModal.js.map +1 -1
  37. package/lib/commonjs/components/Modals/UserSettingsModal/UserSettingsModal.js +46 -74
  38. package/lib/commonjs/components/Modals/UserSettingsModal/UserSettingsModal.js.map +1 -1
  39. package/lib/commonjs/components/Modals/styledModalComponents.js +2 -9
  40. package/lib/commonjs/components/Modals/styledModalComponents.js.map +1 -1
  41. package/lib/commonjs/components/RoomComponents/ChatRoomItem.js +7 -17
  42. package/lib/commonjs/components/RoomComponents/ChatRoomItem.js.map +1 -1
  43. package/lib/commonjs/components/styled/SendInput.js +11 -80
  44. package/lib/commonjs/components/styled/SendInput.js.map +1 -1
  45. package/lib/commonjs/components/styled/StyledComponents.js +3 -9
  46. package/lib/commonjs/components/styled/StyledComponents.js.map +1 -1
  47. package/lib/commonjs/components/styled/StyledInputComponents/StyledInputComponents.js +4 -11
  48. package/lib/commonjs/components/styled/StyledInputComponents/StyledInputComponents.js.map +1 -1
  49. package/lib/commonjs/context/xmppProvider.js +35 -6
  50. package/lib/commonjs/context/xmppProvider.js.map +1 -1
  51. package/lib/commonjs/helpers/updateMessagesTillLast.js +40 -12
  52. package/lib/commonjs/helpers/updateMessagesTillLast.js.map +1 -1
  53. package/lib/commonjs/hooks/useChatRoomFocus.js +9 -3
  54. package/lib/commonjs/hooks/useChatRoomFocus.js.map +1 -1
  55. package/lib/commonjs/hooks/useLogout.js +5 -0
  56. package/lib/commonjs/hooks/useLogout.js.map +1 -1
  57. package/lib/commonjs/hooks/useSendMessage.js +50 -23
  58. package/lib/commonjs/hooks/useSendMessage.js.map +1 -1
  59. package/lib/commonjs/i18n/strings.js +1 -121
  60. package/lib/commonjs/i18n/strings.js.map +1 -1
  61. package/lib/commonjs/main.js +0 -6
  62. package/lib/commonjs/main.js.map +1 -1
  63. package/lib/commonjs/networking/api-requests/user.api.js +0 -59
  64. package/lib/commonjs/networking/api-requests/user.api.js.map +1 -1
  65. package/lib/commonjs/networking/outboundQueue.js +18 -0
  66. package/lib/commonjs/networking/outboundQueue.js.map +1 -1
  67. package/lib/commonjs/networking/stanzaHandlers.js +10 -1
  68. package/lib/commonjs/networking/stanzaHandlers.js.map +1 -1
  69. package/lib/commonjs/networking/xmppClient.js +107 -7
  70. package/lib/commonjs/networking/xmppClient.js.map +1 -1
  71. package/lib/commonjs/roomStore/chatSettingsSlice.js +1 -3
  72. package/lib/commonjs/roomStore/chatSettingsSlice.js.map +1 -1
  73. package/lib/commonjs/roomStore/roomsSlice.js +22 -3
  74. package/lib/commonjs/roomStore/roomsSlice.js.map +1 -1
  75. package/lib/module/assets/icons.js +1 -6
  76. package/lib/module/assets/icons.js.map +1 -1
  77. package/lib/module/components/Header/HeaderRoomList.js +6 -20
  78. package/lib/module/components/Header/HeaderRoomList.js.map +1 -1
  79. package/lib/module/components/MainComponents/ChatRoom.js +14 -36
  80. package/lib/module/components/MainComponents/ChatRoom.js.map +1 -1
  81. package/lib/module/components/MainComponents/MessageList.js +24 -8
  82. package/lib/module/components/MainComponents/MessageList.js.map +1 -1
  83. package/lib/module/components/MainComponents/ProfileImagePlaceholder.js +13 -14
  84. package/lib/module/components/MainComponents/ProfileImagePlaceholder.js.map +1 -1
  85. package/lib/module/components/MainComponents/RoomList.js +32 -62
  86. package/lib/module/components/MainComponents/RoomList.js.map +1 -1
  87. package/lib/module/components/Menu/HeaderRoomListMenu.js +101 -311
  88. package/lib/module/components/Menu/HeaderRoomListMenu.js.map +1 -1
  89. package/lib/module/components/Modals/AttachSheet/AttachSheet.js +113 -311
  90. package/lib/module/components/Modals/AttachSheet/AttachSheet.js.map +1 -1
  91. package/lib/module/components/Modals/ChatProfileModal/ChatProfileModal.js +217 -555
  92. package/lib/module/components/Modals/ChatProfileModal/ChatProfileModal.js.map +1 -1
  93. package/lib/module/components/Modals/FilePreviewModal/FilePreviewModal.js +2 -6
  94. package/lib/module/components/Modals/FilePreviewModal/FilePreviewModal.js.map +1 -1
  95. package/lib/module/components/Modals/Modal/Modal.js +1 -9
  96. package/lib/module/components/Modals/Modal/Modal.js.map +1 -1
  97. package/lib/module/components/Modals/NewChatModal/ModalContent.js +1 -2
  98. package/lib/module/components/Modals/NewChatModal/ModalContent.js.map +1 -1
  99. package/lib/module/components/Modals/NewChatModal/NewChatModal.js +106 -205
  100. package/lib/module/components/Modals/NewChatModal/NewChatModal.js.map +1 -1
  101. package/lib/module/components/Modals/NewChatModal/UpdNewChatModal.js +0 -8
  102. package/lib/module/components/Modals/NewChatModal/UpdNewChatModal.js.map +1 -1
  103. package/lib/module/components/Modals/SelectUsersModal/SelectUsersModal.js +2 -4
  104. package/lib/module/components/Modals/SelectUsersModal/SelectUsersModal.js.map +1 -1
  105. package/lib/module/components/Modals/UserProfileModal/EditUserModal.js +23 -9
  106. package/lib/module/components/Modals/UserProfileModal/EditUserModal.js.map +1 -1
  107. package/lib/module/components/Modals/UserProfileModal/UserProfileModal.js +248 -509
  108. package/lib/module/components/Modals/UserProfileModal/UserProfileModal.js.map +1 -1
  109. package/lib/module/components/Modals/UserSettingsModal/UserSettingsModal.js +48 -76
  110. package/lib/module/components/Modals/UserSettingsModal/UserSettingsModal.js.map +1 -1
  111. package/lib/module/components/Modals/styledModalComponents.js +2 -9
  112. package/lib/module/components/Modals/styledModalComponents.js.map +1 -1
  113. package/lib/module/components/RoomComponents/ChatRoomItem.js +7 -17
  114. package/lib/module/components/RoomComponents/ChatRoomItem.js.map +1 -1
  115. package/lib/module/components/styled/SendInput.js +12 -81
  116. package/lib/module/components/styled/SendInput.js.map +1 -1
  117. package/lib/module/components/styled/StyledComponents.js +3 -9
  118. package/lib/module/components/styled/StyledComponents.js.map +1 -1
  119. package/lib/module/components/styled/StyledInputComponents/StyledInputComponents.js +4 -11
  120. package/lib/module/components/styled/StyledInputComponents/StyledInputComponents.js.map +1 -1
  121. package/lib/module/context/xmppProvider.js +35 -6
  122. package/lib/module/context/xmppProvider.js.map +1 -1
  123. package/lib/module/helpers/updateMessagesTillLast.js +41 -13
  124. package/lib/module/helpers/updateMessagesTillLast.js.map +1 -1
  125. package/lib/module/hooks/useChatRoomFocus.js +9 -3
  126. package/lib/module/hooks/useChatRoomFocus.js.map +1 -1
  127. package/lib/module/hooks/useLogout.js +5 -0
  128. package/lib/module/hooks/useLogout.js.map +1 -1
  129. package/lib/module/hooks/useSendMessage.js +51 -24
  130. package/lib/module/hooks/useSendMessage.js.map +1 -1
  131. package/lib/module/i18n/strings.js +1 -121
  132. package/lib/module/i18n/strings.js.map +1 -1
  133. package/lib/module/main.js +1 -1
  134. package/lib/module/main.js.map +1 -1
  135. package/lib/module/networking/api-requests/user.api.js +0 -56
  136. package/lib/module/networking/api-requests/user.api.js.map +1 -1
  137. package/lib/module/networking/outboundQueue.js +17 -0
  138. package/lib/module/networking/outboundQueue.js.map +1 -1
  139. package/lib/module/networking/stanzaHandlers.js +10 -1
  140. package/lib/module/networking/stanzaHandlers.js.map +1 -1
  141. package/lib/module/networking/xmppClient.js +107 -7
  142. package/lib/module/networking/xmppClient.js.map +1 -1
  143. package/lib/module/roomStore/chatSettingsSlice.js +1 -3
  144. package/lib/module/roomStore/chatSettingsSlice.js.map +1 -1
  145. package/lib/module/roomStore/roomsSlice.js +20 -2
  146. package/lib/module/roomStore/roomsSlice.js.map +1 -1
  147. package/lib/typescript/assets/icons.d.ts +0 -16
  148. package/lib/typescript/assets/icons.d.ts.map +1 -1
  149. package/lib/typescript/components/Header/HeaderRoomList.d.ts.map +1 -1
  150. package/lib/typescript/components/MainComponents/ChatRoom.d.ts.map +1 -1
  151. package/lib/typescript/components/MainComponents/MessageList.d.ts.map +1 -1
  152. package/lib/typescript/components/MainComponents/ProfileImagePlaceholder.d.ts.map +1 -1
  153. package/lib/typescript/components/MainComponents/RoomList.d.ts.map +1 -1
  154. package/lib/typescript/components/Menu/HeaderRoomListMenu.d.ts +0 -3
  155. package/lib/typescript/components/Menu/HeaderRoomListMenu.d.ts.map +1 -1
  156. package/lib/typescript/components/Modals/AttachSheet/AttachSheet.d.ts +0 -9
  157. package/lib/typescript/components/Modals/AttachSheet/AttachSheet.d.ts.map +1 -1
  158. package/lib/typescript/components/Modals/ChatProfileModal/ChatProfileModal.d.ts +0 -10
  159. package/lib/typescript/components/Modals/ChatProfileModal/ChatProfileModal.d.ts.map +1 -1
  160. package/lib/typescript/components/Modals/FilePreviewModal/FilePreviewModal.d.ts.map +1 -1
  161. package/lib/typescript/components/Modals/Modal/Modal.d.ts.map +1 -1
  162. package/lib/typescript/components/Modals/NewChatModal/ModalContent.d.ts +2 -4
  163. package/lib/typescript/components/Modals/NewChatModal/ModalContent.d.ts.map +1 -1
  164. package/lib/typescript/components/Modals/NewChatModal/NewChatModal.d.ts +1 -1
  165. package/lib/typescript/components/Modals/NewChatModal/NewChatModal.d.ts.map +1 -1
  166. package/lib/typescript/components/Modals/NewChatModal/UpdNewChatModal.d.ts.map +1 -1
  167. package/lib/typescript/components/Modals/SelectUsersModal/SelectUsersModal.d.ts +1 -6
  168. package/lib/typescript/components/Modals/SelectUsersModal/SelectUsersModal.d.ts.map +1 -1
  169. package/lib/typescript/components/Modals/UserProfileModal/EditUserModal.d.ts.map +1 -1
  170. package/lib/typescript/components/Modals/UserProfileModal/UserProfileModal.d.ts +0 -16
  171. package/lib/typescript/components/Modals/UserProfileModal/UserProfileModal.d.ts.map +1 -1
  172. package/lib/typescript/components/Modals/UserSettingsModal/UserSettingsModal.d.ts +0 -1
  173. package/lib/typescript/components/Modals/UserSettingsModal/UserSettingsModal.d.ts.map +1 -1
  174. package/lib/typescript/components/Modals/styledModalComponents.d.ts.map +1 -1
  175. package/lib/typescript/components/RoomComponents/ChatRoomItem.d.ts.map +1 -1
  176. package/lib/typescript/components/styled/SendInput.d.ts.map +1 -1
  177. package/lib/typescript/components/styled/StyledComponents.d.ts.map +1 -1
  178. package/lib/typescript/components/styled/StyledInputComponents/StyledInputComponents.d.ts.map +1 -1
  179. package/lib/typescript/context/xmppProvider.d.ts.map +1 -1
  180. package/lib/typescript/helpers/updateMessagesTillLast.d.ts.map +1 -1
  181. package/lib/typescript/hooks/useChatRoomFocus.d.ts.map +1 -1
  182. package/lib/typescript/hooks/useLogout.d.ts.map +1 -1
  183. package/lib/typescript/hooks/useSendMessage.d.ts.map +1 -1
  184. package/lib/typescript/i18n/strings.d.ts.map +1 -1
  185. package/lib/typescript/main.d.ts +1 -1
  186. package/lib/typescript/main.d.ts.map +1 -1
  187. package/lib/typescript/networking/api-requests/user.api.d.ts +0 -27
  188. package/lib/typescript/networking/api-requests/user.api.d.ts.map +1 -1
  189. package/lib/typescript/networking/outboundQueue.d.ts +16 -0
  190. package/lib/typescript/networking/outboundQueue.d.ts.map +1 -1
  191. package/lib/typescript/networking/stanzaHandlers.d.ts.map +1 -1
  192. package/lib/typescript/networking/xmppClient.d.ts +33 -1
  193. package/lib/typescript/networking/xmppClient.d.ts.map +1 -1
  194. package/lib/typescript/roomStore/chatSettingsSlice.d.ts.map +1 -1
  195. package/lib/typescript/roomStore/roomsSlice.d.ts +18 -1
  196. package/lib/typescript/roomStore/roomsSlice.d.ts.map +1 -1
  197. package/lib/typescript/types/models/room.model.d.ts +15 -0
  198. package/lib/typescript/types/models/room.model.d.ts.map +1 -1
  199. package/lib/typescript/types/types.d.ts +20 -20
  200. package/lib/typescript/types/types.d.ts.map +1 -1
  201. package/package.json +1 -6
  202. package/src/assets/icons.tsx +9 -48
  203. package/src/components/Header/HeaderRoomList.tsx +5 -20
  204. package/src/components/MainComponents/ChatRoom.tsx +20 -38
  205. package/src/components/MainComponents/MessageList.tsx +24 -8
  206. package/src/components/MainComponents/ProfileImagePlaceholder.tsx +14 -21
  207. package/src/components/MainComponents/RoomList.tsx +34 -65
  208. package/src/components/Menu/HeaderRoomListMenu.tsx +71 -310
  209. package/src/components/Modals/AttachSheet/AttachSheet.tsx +97 -331
  210. package/src/components/Modals/ChatProfileModal/ChatProfileModal.tsx +279 -598
  211. package/src/components/Modals/FilePreviewModal/FilePreviewModal.tsx +2 -4
  212. package/src/components/Modals/Modal/Modal.tsx +0 -7
  213. package/src/components/Modals/NewChatModal/ModalContent.tsx +3 -6
  214. package/src/components/Modals/NewChatModal/NewChatModal.tsx +117 -219
  215. package/src/components/Modals/NewChatModal/UpdNewChatModal.tsx +1 -12
  216. package/src/components/Modals/SelectUsersModal/SelectUsersModal.tsx +4 -14
  217. package/src/components/Modals/UserProfileModal/EditUserModal.tsx +25 -9
  218. package/src/components/Modals/UserProfileModal/UserProfileModal.tsx +307 -617
  219. package/src/components/Modals/UserSettingsModal/UserSettingsModal.tsx +58 -75
  220. package/src/components/Modals/styledModalComponents.tsx +2 -9
  221. package/src/components/RoomComponents/ChatRoomItem.tsx +7 -14
  222. package/src/components/styled/SendInput.tsx +12 -83
  223. package/src/components/styled/StyledComponents.ts +3 -9
  224. package/src/components/styled/StyledInputComponents/StyledInputComponents.tsx +4 -11
  225. package/src/context/xmppProvider.tsx +41 -8
  226. package/src/helpers/updateMessagesTillLast.tsx +42 -17
  227. package/src/hooks/useChatRoomFocus.ts +11 -3
  228. package/src/hooks/useLogout.tsx +7 -0
  229. package/src/hooks/useSendMessage.tsx +60 -24
  230. package/src/i18n/strings.ts +1 -121
  231. package/src/main.ts +1 -1
  232. package/src/networking/api-requests/user.api.ts +0 -71
  233. package/src/networking/outboundQueue.ts +29 -0
  234. package/src/networking/stanzaHandlers.ts +9 -1
  235. package/src/networking/xmppClient.ts +118 -7
  236. package/src/roomStore/chatSettingsSlice.ts +1 -3
  237. package/src/roomStore/roomsSlice.ts +20 -2
  238. package/src/types/models/room.model.ts +15 -0
  239. package/src/types/types.ts +20 -22
  240. package/lib/commonjs/components/Modals/ChatProfileModal/ReportChatModal.js +0 -226
  241. package/lib/commonjs/components/Modals/ChatProfileModal/ReportChatModal.js.map +0 -1
  242. package/lib/commonjs/components/Modals/ProfileHeader/ProfileHeader.js +0 -556
  243. package/lib/commonjs/components/Modals/ProfileHeader/ProfileHeader.js.map +0 -1
  244. package/lib/commonjs/components/Modals/ProfileHeader/ProfileMenu.js +0 -210
  245. package/lib/commonjs/components/Modals/ProfileHeader/ProfileMenu.js.map +0 -1
  246. package/lib/commonjs/helpers/getChatBackground.js +0 -23
  247. package/lib/commonjs/helpers/getChatBackground.js.map +0 -1
  248. package/lib/commonjs/helpers/mediaLibraryRuntime.js +0 -31
  249. package/lib/commonjs/helpers/mediaLibraryRuntime.js.map +0 -1
  250. package/lib/commonjs/helpers/pickImageAsset.js +0 -68
  251. package/lib/commonjs/helpers/pickImageAsset.js.map +0 -1
  252. package/lib/commonjs/helpers/sheetGestures.js +0 -32
  253. package/lib/commonjs/helpers/sheetGestures.js.map +0 -1
  254. package/lib/module/components/Modals/ChatProfileModal/ReportChatModal.js +0 -223
  255. package/lib/module/components/Modals/ChatProfileModal/ReportChatModal.js.map +0 -1
  256. package/lib/module/components/Modals/ProfileHeader/ProfileHeader.js +0 -548
  257. package/lib/module/components/Modals/ProfileHeader/ProfileHeader.js.map +0 -1
  258. package/lib/module/components/Modals/ProfileHeader/ProfileMenu.js +0 -205
  259. package/lib/module/components/Modals/ProfileHeader/ProfileMenu.js.map +0 -1
  260. package/lib/module/helpers/getChatBackground.js +0 -18
  261. package/lib/module/helpers/getChatBackground.js.map +0 -1
  262. package/lib/module/helpers/mediaLibraryRuntime.js +0 -25
  263. package/lib/module/helpers/mediaLibraryRuntime.js.map +0 -1
  264. package/lib/module/helpers/pickImageAsset.js +0 -63
  265. package/lib/module/helpers/pickImageAsset.js.map +0 -1
  266. package/lib/module/helpers/sheetGestures.js +0 -26
  267. package/lib/module/helpers/sheetGestures.js.map +0 -1
  268. package/lib/typescript/components/Modals/ChatProfileModal/ReportChatModal.d.ts +0 -9
  269. package/lib/typescript/components/Modals/ChatProfileModal/ReportChatModal.d.ts.map +0 -1
  270. package/lib/typescript/components/Modals/ProfileHeader/ProfileHeader.d.ts +0 -75
  271. package/lib/typescript/components/Modals/ProfileHeader/ProfileHeader.d.ts.map +0 -1
  272. package/lib/typescript/components/Modals/ProfileHeader/ProfileMenu.d.ts +0 -25
  273. package/lib/typescript/components/Modals/ProfileHeader/ProfileMenu.d.ts.map +0 -1
  274. package/lib/typescript/helpers/getChatBackground.d.ts +0 -15
  275. package/lib/typescript/helpers/getChatBackground.d.ts.map +0 -1
  276. package/lib/typescript/helpers/mediaLibraryRuntime.d.ts +0 -3
  277. package/lib/typescript/helpers/mediaLibraryRuntime.d.ts.map +0 -1
  278. package/lib/typescript/helpers/pickImageAsset.d.ts +0 -27
  279. package/lib/typescript/helpers/pickImageAsset.d.ts.map +0 -1
  280. package/lib/typescript/helpers/sheetGestures.d.ts +0 -20
  281. package/lib/typescript/helpers/sheetGestures.d.ts.map +0 -1
  282. package/src/components/Modals/ChatProfileModal/ReportChatModal.tsx +0 -244
  283. package/src/components/Modals/ProfileHeader/ProfileHeader.tsx +0 -615
  284. package/src/components/Modals/ProfileHeader/ProfileMenu.tsx +0 -217
  285. package/src/helpers/getChatBackground.ts +0 -18
  286. package/src/helpers/mediaLibraryRuntime.ts +0 -25
  287. package/src/helpers/pickImageAsset.ts +0 -68
  288. package/src/helpers/sheetGestures.ts +0 -25
@@ -1,217 +0,0 @@
1
- /** @format */
2
-
3
- import React, { useRef, useState } from 'react';
4
- import {
5
- Animated,
6
- Dimensions,
7
- Easing,
8
- Modal,
9
- Pressable,
10
- StyleSheet,
11
- Text,
12
- TouchableOpacity,
13
- View,
14
- } from 'react-native';
15
- import { MoreIcon } from '../../../assets/icons';
16
-
17
- export interface ProfileMenuItem {
18
- key: string;
19
- label: string;
20
- icon: React.ReactNode;
21
- destructive?: boolean;
22
- onPress: () => void;
23
- }
24
-
25
- /** Fallbacks used for the very first frame, before the card is measured. */
26
- const ESTIMATED_WIDTH = 220;
27
- const ESTIMATED_HEIGHT = 160;
28
- const GAP = 8;
29
- /** Roughly a notch inset + the header band, used until measured. */
30
- const DEFAULT_TOP = 104;
31
- const EDGE = 12;
32
-
33
- /**
34
- * The "…" overflow menu shared by the chat and user profile screens.
35
- *
36
- * The shared `DropdownMenu` pins its card at a hard-coded `top: 95`, which
37
- * on this screen landed it over the host's own tab bar, unanchored to the
38
- * button. This one measures the button and grows the card out of it: the
39
- * card scales up from its top-right corner (translate → scale → translate
40
- * back, which is how you fake a transform-origin in React Native) so the
41
- * menu visibly unfolds from the three dots.
42
- */
43
- const ProfileMenu: React.FC<{
44
- items: ProfileMenuItem[];
45
- testIDPrefix?: string;
46
- }> = ({ items, testIDPrefix = 'chat-profile' }) => {
47
- const buttonRef = useRef<View>(null);
48
- const [open, setOpen] = useState(false);
49
- const [anchor, setAnchor] = useState({ top: DEFAULT_TOP, right: EDGE });
50
- const [size, setSize] = useState({
51
- width: ESTIMATED_WIDTH,
52
- height: ESTIMATED_HEIGHT,
53
- });
54
- const progress = useRef(new Animated.Value(0)).current;
55
-
56
- const animate = (to: number, done?: () => void) =>
57
- Animated.timing(progress, {
58
- toValue: to,
59
- duration: to ? 180 : 140,
60
- easing: to ? Easing.out(Easing.back(1.3)) : Easing.in(Easing.quad),
61
- useNativeDriver: true,
62
- }).start(({ finished }) => finished && done?.());
63
-
64
- // Anchor to the button's window frame — that is the same coordinate
65
- // space the <Modal> lays out in, so no insets to subtract. Measured on
66
- // layout (and again on open) rather than *before* opening: on some hosts
67
- // the measure callback never fires, and gating the open on it would mean
68
- // a menu that simply doesn't appear.
69
- const measure = () =>
70
- buttonRef.current?.measureInWindow?.((x, y, width, height) => {
71
- if (typeof y !== 'number' || typeof x !== 'number') {return;}
72
- const screenWidth = Dimensions.get('window').width;
73
- setAnchor({
74
- top: y + height + GAP,
75
- right: Math.max(screenWidth - (x + width), EDGE),
76
- });
77
- });
78
-
79
- const openMenu = () => {
80
- measure();
81
- progress.setValue(0);
82
- setOpen(true);
83
- animate(1);
84
- };
85
-
86
- const closeMenu = (then?: () => void) =>
87
- animate(0, () => {
88
- setOpen(false);
89
- then?.();
90
- });
91
-
92
- const scale = progress.interpolate({
93
- inputRange: [0, 1],
94
- outputRange: [0.2, 1],
95
- });
96
-
97
- if (items.length === 0) {
98
- return null;
99
- }
100
-
101
- return (
102
- <>
103
- <View ref={buttonRef} collapsable={false} onLayout={measure}>
104
- <TouchableOpacity
105
- testID={`${testIDPrefix}-menu`}
106
- activeOpacity={0.7}
107
- onPress={openMenu}
108
- style={styles.button}
109
- >
110
- <MoreIcon color="#FFFFFF" />
111
- </TouchableOpacity>
112
- </View>
113
-
114
- <Modal
115
- transparent
116
- visible={open}
117
- animationType="none"
118
- onRequestClose={() => closeMenu()}
119
- >
120
- <Pressable
121
- testID={`${testIDPrefix}-menu-backdrop`}
122
- style={StyleSheet.absoluteFill}
123
- onPress={() => closeMenu()}
124
- />
125
- <Animated.View
126
- testID={`${testIDPrefix}-menu-card`}
127
- onLayout={(e) => {
128
- const { width, height } = e.nativeEvent.layout;
129
- if (width && height) {setSize({ width, height });}
130
- }}
131
- style={[
132
- styles.card,
133
- {
134
- top: anchor.top,
135
- right: anchor.right,
136
- opacity: progress,
137
- transform: [
138
- // Move the origin to the card's top-right corner, scale
139
- // there, then move back — RN has no transform-origin.
140
- { translateX: size.width / 2 },
141
- { translateY: -size.height / 2 },
142
- { scale },
143
- { translateX: -size.width / 2 },
144
- { translateY: size.height / 2 },
145
- ],
146
- },
147
- ]}
148
- >
149
- {items.map((item, index) => (
150
- <TouchableOpacity
151
- key={item.key}
152
- testID={`${testIDPrefix}-menu-${item.key}`}
153
- activeOpacity={0.6}
154
- style={[styles.row, index > 0 && styles.rowDivider]}
155
- onPress={() => closeMenu(item.onPress)}
156
- >
157
- <Text
158
- style={[styles.label, item.destructive && styles.destructive]}
159
- >
160
- {item.label}
161
- </Text>
162
- <View style={styles.icon}>{item.icon}</View>
163
- </TouchableOpacity>
164
- ))}
165
- </Animated.View>
166
- </Modal>
167
- </>
168
- );
169
- };
170
-
171
- const styles = StyleSheet.create({
172
- button: {
173
- width: 40,
174
- height: 40,
175
- borderRadius: 20,
176
- backgroundColor: 'rgba(0,0,0,0.28)',
177
- alignItems: 'center',
178
- justifyContent: 'center',
179
- },
180
- card: {
181
- position: 'absolute',
182
- minWidth: 200,
183
- backgroundColor: '#FFFFFF',
184
- borderRadius: 14,
185
- paddingVertical: 4,
186
- shadowColor: '#121219',
187
- shadowOffset: { width: 0, height: 6 },
188
- shadowOpacity: 0.18,
189
- shadowRadius: 16,
190
- elevation: 12,
191
- },
192
- row: {
193
- flexDirection: 'row',
194
- alignItems: 'center',
195
- justifyContent: 'space-between',
196
- gap: 24,
197
- paddingHorizontal: 16,
198
- paddingVertical: 13,
199
- },
200
- rowDivider: {
201
- borderTopWidth: StyleSheet.hairlineWidth,
202
- borderTopColor: '#EFEFF2',
203
- },
204
- label: {
205
- fontSize: 16,
206
- color: '#141414',
207
- },
208
- destructive: {
209
- color: '#E53935',
210
- },
211
- icon: {
212
- width: 22,
213
- alignItems: 'center',
214
- },
215
- });
216
-
217
- export default ProfileMenu;
@@ -1,18 +0,0 @@
1
- /** @format */
2
-
3
- import type { IConfig } from '../types/types';
4
-
5
- /** Ground behind the conversation, and behind the rounded corners of the
6
- * header and the composer that sit over it. */
7
- export const DEFAULT_CHAT_BACKGROUND = '#F3F6FC';
8
-
9
- /**
10
- * One place for the conversation's background colour.
11
- *
12
- * The message list has always painted it; the chat container behind it was
13
- * plain white, which is what made the header's rounded bottom corners and
14
- * the composer's rounded top corners invisible — the corners revealed the
15
- * white parent, not the conversation.
16
- */
17
- export const getChatBackgroundColor = (config?: IConfig): string =>
18
- config?.backgroundChat?.color || DEFAULT_CHAT_BACKGROUND;
@@ -1,25 +0,0 @@
1
- let cached: any | undefined;
2
-
3
- export const getMediaLibrary = (): any | null => {
4
- if (cached !== undefined) {return cached;}
5
- try {
6
- const legacy = require('expo-media-library/legacy');
7
-
8
- if (legacy?.getAssetsAsync) {
9
- cached = legacy;
10
- return cached;
11
- }
12
- } catch {
13
- }
14
-
15
- try {
16
- cached = require('expo-media-library') ?? null;
17
- } catch {
18
- cached = null;
19
- }
20
- return cached;
21
- };
22
-
23
- export const __resetMediaLibraryCache = () => {
24
- cached = undefined;
25
- };
@@ -1,68 +0,0 @@
1
- import { Alert, Linking } from 'react-native';
2
- import * as ImagePicker from 'expo-image-picker';
3
-
4
- /**
5
- * A picked image in the shape React Native's FormData understands.
6
- *
7
- * NOT a web `File`: RN streams a multipart part straight from a `file://`
8
- * uri and has no usable Blob/File/atob path. Screens ported from the web
9
- * client used to carry base64 -> Blob -> File helpers that could never
10
- * have run here.
11
- */
12
- export interface PickedImage {
13
- uri: string;
14
- type: string;
15
- name: string;
16
- }
17
-
18
- /**
19
- * Ask for library permission, open the picker, and normalise the result.
20
- *
21
- * Returns `null` for every non-error outcome — permission refused, user
22
- * cancelled — so call sites can simply keep their current value.
23
- *
24
- * Exists because the avatar pickers are wired to `onPress`, which hands
25
- * the callback a SyntheticEvent. Storing that event as "the image" (what
26
- * two screens used to do) rendered a pooled event as an <Image source>
27
- * and then crashed with "Property is not configurable" when React tried
28
- * to release it — on top of never letting the user pick anything.
29
- */
30
- export const pickImageAsset = async (): Promise<PickedImage | null> => {
31
- try {
32
- // expo-image-picker owns the permission prompt internally and
33
- // returns a `granted` flag.
34
- const perm = await ImagePicker.requestMediaLibraryPermissionsAsync();
35
- if (!perm.granted) {
36
- Alert.alert(
37
- 'Permission required',
38
- 'Photo library permission is needed to select images.',
39
- [
40
- { text: 'Cancel', style: 'cancel' },
41
- { text: 'Open Settings', onPress: () => Linking.openSettings() },
42
- ]
43
- );
44
- return null;
45
- }
46
-
47
- const result = await ImagePicker.launchImageLibraryAsync({
48
- mediaTypes: ['images'],
49
- allowsEditing: true,
50
- aspect: [1, 1],
51
- quality: 0.8,
52
- });
53
- if (result.canceled || !result.assets?.[0]) {
54
- return null;
55
- }
56
-
57
- const asset = result.assets[0];
58
- const originalName = asset.fileName || asset.uri.split('/').pop();
59
- return {
60
- uri: asset.uri,
61
- type: asset.mimeType || 'image/jpeg',
62
- name: originalName || `image_${Date.now()}.jpg`,
63
- };
64
- } catch (error) {
65
- console.error('Failed to pick an image:', error);
66
- return null;
67
- }
68
- };
@@ -1,25 +0,0 @@
1
- /** @format */
2
-
3
- /**
4
- * Shared thresholds for the drag-to-dismiss gesture on bottom sheets (the
5
- * attach sheet, the profile headers, the room-list menu). Kept in one
6
- * place so a pull feels identical wherever the user does it — and so the
7
- * numbers are unit-testable without a touch event.
8
- */
9
-
10
- /** Drag past this many points and letting go dismisses the sheet. */
11
- export const DISMISS_DISTANCE = 90;
12
- /** …or flick faster than this, however short the drag. */
13
- export const DISMISS_VELOCITY = 0.8;
14
-
15
- /**
16
- * Claim a drag only once it is clearly a downward pull, so a tap on a row
17
- * still registers and a horizontal swipe stays with whatever scrolls
18
- * sideways inside the sheet.
19
- */
20
- export const shouldClaimVerticalDrag = (dy: number, dx: number) =>
21
- dy > 6 && Math.abs(dy) > Math.abs(dx) * 1.5;
22
-
23
- /** Far enough / fast enough to let go of the sheet. */
24
- export const shouldDismissOnDrag = (dy: number, vy: number) =>
25
- dy > DISMISS_DISTANCE || vy > DISMISS_VELOCITY;