@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.
- package/CHANGELOG.md +0 -54
- package/README.md +8 -31
- package/lib/commonjs/assets/icons.js +2 -7
- package/lib/commonjs/assets/icons.js.map +1 -1
- package/lib/commonjs/components/Header/HeaderRoomList.js +6 -20
- package/lib/commonjs/components/Header/HeaderRoomList.js.map +1 -1
- package/lib/commonjs/components/MainComponents/ChatRoom.js +14 -36
- package/lib/commonjs/components/MainComponents/ChatRoom.js.map +1 -1
- package/lib/commonjs/components/MainComponents/MessageList.js +23 -7
- package/lib/commonjs/components/MainComponents/MessageList.js.map +1 -1
- package/lib/commonjs/components/MainComponents/ProfileImagePlaceholder.js +13 -14
- package/lib/commonjs/components/MainComponents/ProfileImagePlaceholder.js.map +1 -1
- package/lib/commonjs/components/MainComponents/RoomList.js +32 -62
- package/lib/commonjs/components/MainComponents/RoomList.js.map +1 -1
- package/lib/commonjs/components/Menu/HeaderRoomListMenu.js +98 -309
- package/lib/commonjs/components/Menu/HeaderRoomListMenu.js.map +1 -1
- package/lib/commonjs/components/Modals/AttachSheet/AttachSheet.js +110 -320
- package/lib/commonjs/components/Modals/AttachSheet/AttachSheet.js.map +1 -1
- package/lib/commonjs/components/Modals/ChatProfileModal/ChatProfileModal.js +213 -552
- package/lib/commonjs/components/Modals/ChatProfileModal/ChatProfileModal.js.map +1 -1
- package/lib/commonjs/components/Modals/FilePreviewModal/FilePreviewModal.js +2 -6
- package/lib/commonjs/components/Modals/FilePreviewModal/FilePreviewModal.js.map +1 -1
- package/lib/commonjs/components/Modals/Modal/Modal.js +0 -8
- package/lib/commonjs/components/Modals/Modal/Modal.js.map +1 -1
- package/lib/commonjs/components/Modals/NewChatModal/ModalContent.js +1 -2
- package/lib/commonjs/components/Modals/NewChatModal/ModalContent.js.map +1 -1
- package/lib/commonjs/components/Modals/NewChatModal/NewChatModal.js +104 -202
- package/lib/commonjs/components/Modals/NewChatModal/NewChatModal.js.map +1 -1
- package/lib/commonjs/components/Modals/NewChatModal/UpdNewChatModal.js +0 -8
- package/lib/commonjs/components/Modals/NewChatModal/UpdNewChatModal.js.map +1 -1
- package/lib/commonjs/components/Modals/SelectUsersModal/SelectUsersModal.js +2 -4
- package/lib/commonjs/components/Modals/SelectUsersModal/SelectUsersModal.js.map +1 -1
- package/lib/commonjs/components/Modals/UserProfileModal/EditUserModal.js +21 -7
- package/lib/commonjs/components/Modals/UserProfileModal/EditUserModal.js.map +1 -1
- package/lib/commonjs/components/Modals/UserProfileModal/UserProfileModal.js +244 -507
- package/lib/commonjs/components/Modals/UserProfileModal/UserProfileModal.js.map +1 -1
- package/lib/commonjs/components/Modals/UserSettingsModal/UserSettingsModal.js +46 -74
- package/lib/commonjs/components/Modals/UserSettingsModal/UserSettingsModal.js.map +1 -1
- package/lib/commonjs/components/Modals/styledModalComponents.js +2 -9
- package/lib/commonjs/components/Modals/styledModalComponents.js.map +1 -1
- package/lib/commonjs/components/RoomComponents/ChatRoomItem.js +7 -17
- package/lib/commonjs/components/RoomComponents/ChatRoomItem.js.map +1 -1
- package/lib/commonjs/components/styled/SendInput.js +11 -80
- package/lib/commonjs/components/styled/SendInput.js.map +1 -1
- package/lib/commonjs/components/styled/StyledComponents.js +3 -9
- package/lib/commonjs/components/styled/StyledComponents.js.map +1 -1
- package/lib/commonjs/components/styled/StyledInputComponents/StyledInputComponents.js +4 -11
- package/lib/commonjs/components/styled/StyledInputComponents/StyledInputComponents.js.map +1 -1
- package/lib/commonjs/context/xmppProvider.js +35 -6
- package/lib/commonjs/context/xmppProvider.js.map +1 -1
- package/lib/commonjs/helpers/updateMessagesTillLast.js +40 -12
- package/lib/commonjs/helpers/updateMessagesTillLast.js.map +1 -1
- package/lib/commonjs/hooks/useChatRoomFocus.js +9 -3
- package/lib/commonjs/hooks/useChatRoomFocus.js.map +1 -1
- package/lib/commonjs/hooks/useLogout.js +5 -0
- package/lib/commonjs/hooks/useLogout.js.map +1 -1
- package/lib/commonjs/hooks/useSendMessage.js +50 -23
- package/lib/commonjs/hooks/useSendMessage.js.map +1 -1
- package/lib/commonjs/i18n/strings.js +1 -121
- package/lib/commonjs/i18n/strings.js.map +1 -1
- package/lib/commonjs/main.js +0 -6
- package/lib/commonjs/main.js.map +1 -1
- package/lib/commonjs/networking/api-requests/user.api.js +0 -59
- package/lib/commonjs/networking/api-requests/user.api.js.map +1 -1
- package/lib/commonjs/networking/outboundQueue.js +18 -0
- package/lib/commonjs/networking/outboundQueue.js.map +1 -1
- package/lib/commonjs/networking/stanzaHandlers.js +10 -1
- package/lib/commonjs/networking/stanzaHandlers.js.map +1 -1
- package/lib/commonjs/networking/xmppClient.js +107 -7
- package/lib/commonjs/networking/xmppClient.js.map +1 -1
- package/lib/commonjs/roomStore/chatSettingsSlice.js +1 -3
- package/lib/commonjs/roomStore/chatSettingsSlice.js.map +1 -1
- package/lib/commonjs/roomStore/roomsSlice.js +22 -3
- package/lib/commonjs/roomStore/roomsSlice.js.map +1 -1
- package/lib/module/assets/icons.js +1 -6
- package/lib/module/assets/icons.js.map +1 -1
- package/lib/module/components/Header/HeaderRoomList.js +6 -20
- package/lib/module/components/Header/HeaderRoomList.js.map +1 -1
- package/lib/module/components/MainComponents/ChatRoom.js +14 -36
- package/lib/module/components/MainComponents/ChatRoom.js.map +1 -1
- package/lib/module/components/MainComponents/MessageList.js +24 -8
- package/lib/module/components/MainComponents/MessageList.js.map +1 -1
- package/lib/module/components/MainComponents/ProfileImagePlaceholder.js +13 -14
- package/lib/module/components/MainComponents/ProfileImagePlaceholder.js.map +1 -1
- package/lib/module/components/MainComponents/RoomList.js +32 -62
- package/lib/module/components/MainComponents/RoomList.js.map +1 -1
- package/lib/module/components/Menu/HeaderRoomListMenu.js +101 -311
- package/lib/module/components/Menu/HeaderRoomListMenu.js.map +1 -1
- package/lib/module/components/Modals/AttachSheet/AttachSheet.js +113 -311
- package/lib/module/components/Modals/AttachSheet/AttachSheet.js.map +1 -1
- package/lib/module/components/Modals/ChatProfileModal/ChatProfileModal.js +217 -555
- package/lib/module/components/Modals/ChatProfileModal/ChatProfileModal.js.map +1 -1
- package/lib/module/components/Modals/FilePreviewModal/FilePreviewModal.js +2 -6
- package/lib/module/components/Modals/FilePreviewModal/FilePreviewModal.js.map +1 -1
- package/lib/module/components/Modals/Modal/Modal.js +1 -9
- package/lib/module/components/Modals/Modal/Modal.js.map +1 -1
- package/lib/module/components/Modals/NewChatModal/ModalContent.js +1 -2
- package/lib/module/components/Modals/NewChatModal/ModalContent.js.map +1 -1
- package/lib/module/components/Modals/NewChatModal/NewChatModal.js +106 -205
- package/lib/module/components/Modals/NewChatModal/NewChatModal.js.map +1 -1
- package/lib/module/components/Modals/NewChatModal/UpdNewChatModal.js +0 -8
- package/lib/module/components/Modals/NewChatModal/UpdNewChatModal.js.map +1 -1
- package/lib/module/components/Modals/SelectUsersModal/SelectUsersModal.js +2 -4
- package/lib/module/components/Modals/SelectUsersModal/SelectUsersModal.js.map +1 -1
- package/lib/module/components/Modals/UserProfileModal/EditUserModal.js +23 -9
- package/lib/module/components/Modals/UserProfileModal/EditUserModal.js.map +1 -1
- package/lib/module/components/Modals/UserProfileModal/UserProfileModal.js +248 -509
- package/lib/module/components/Modals/UserProfileModal/UserProfileModal.js.map +1 -1
- package/lib/module/components/Modals/UserSettingsModal/UserSettingsModal.js +48 -76
- package/lib/module/components/Modals/UserSettingsModal/UserSettingsModal.js.map +1 -1
- package/lib/module/components/Modals/styledModalComponents.js +2 -9
- package/lib/module/components/Modals/styledModalComponents.js.map +1 -1
- package/lib/module/components/RoomComponents/ChatRoomItem.js +7 -17
- package/lib/module/components/RoomComponents/ChatRoomItem.js.map +1 -1
- package/lib/module/components/styled/SendInput.js +12 -81
- package/lib/module/components/styled/SendInput.js.map +1 -1
- package/lib/module/components/styled/StyledComponents.js +3 -9
- package/lib/module/components/styled/StyledComponents.js.map +1 -1
- package/lib/module/components/styled/StyledInputComponents/StyledInputComponents.js +4 -11
- package/lib/module/components/styled/StyledInputComponents/StyledInputComponents.js.map +1 -1
- package/lib/module/context/xmppProvider.js +35 -6
- package/lib/module/context/xmppProvider.js.map +1 -1
- package/lib/module/helpers/updateMessagesTillLast.js +41 -13
- package/lib/module/helpers/updateMessagesTillLast.js.map +1 -1
- package/lib/module/hooks/useChatRoomFocus.js +9 -3
- package/lib/module/hooks/useChatRoomFocus.js.map +1 -1
- package/lib/module/hooks/useLogout.js +5 -0
- package/lib/module/hooks/useLogout.js.map +1 -1
- package/lib/module/hooks/useSendMessage.js +51 -24
- package/lib/module/hooks/useSendMessage.js.map +1 -1
- package/lib/module/i18n/strings.js +1 -121
- package/lib/module/i18n/strings.js.map +1 -1
- package/lib/module/main.js +1 -1
- package/lib/module/main.js.map +1 -1
- package/lib/module/networking/api-requests/user.api.js +0 -56
- package/lib/module/networking/api-requests/user.api.js.map +1 -1
- package/lib/module/networking/outboundQueue.js +17 -0
- package/lib/module/networking/outboundQueue.js.map +1 -1
- package/lib/module/networking/stanzaHandlers.js +10 -1
- package/lib/module/networking/stanzaHandlers.js.map +1 -1
- package/lib/module/networking/xmppClient.js +107 -7
- package/lib/module/networking/xmppClient.js.map +1 -1
- package/lib/module/roomStore/chatSettingsSlice.js +1 -3
- package/lib/module/roomStore/chatSettingsSlice.js.map +1 -1
- package/lib/module/roomStore/roomsSlice.js +20 -2
- package/lib/module/roomStore/roomsSlice.js.map +1 -1
- package/lib/typescript/assets/icons.d.ts +0 -16
- package/lib/typescript/assets/icons.d.ts.map +1 -1
- package/lib/typescript/components/Header/HeaderRoomList.d.ts.map +1 -1
- package/lib/typescript/components/MainComponents/ChatRoom.d.ts.map +1 -1
- package/lib/typescript/components/MainComponents/MessageList.d.ts.map +1 -1
- package/lib/typescript/components/MainComponents/ProfileImagePlaceholder.d.ts.map +1 -1
- package/lib/typescript/components/MainComponents/RoomList.d.ts.map +1 -1
- package/lib/typescript/components/Menu/HeaderRoomListMenu.d.ts +0 -3
- package/lib/typescript/components/Menu/HeaderRoomListMenu.d.ts.map +1 -1
- package/lib/typescript/components/Modals/AttachSheet/AttachSheet.d.ts +0 -9
- package/lib/typescript/components/Modals/AttachSheet/AttachSheet.d.ts.map +1 -1
- package/lib/typescript/components/Modals/ChatProfileModal/ChatProfileModal.d.ts +0 -10
- package/lib/typescript/components/Modals/ChatProfileModal/ChatProfileModal.d.ts.map +1 -1
- package/lib/typescript/components/Modals/FilePreviewModal/FilePreviewModal.d.ts.map +1 -1
- package/lib/typescript/components/Modals/Modal/Modal.d.ts.map +1 -1
- package/lib/typescript/components/Modals/NewChatModal/ModalContent.d.ts +2 -4
- package/lib/typescript/components/Modals/NewChatModal/ModalContent.d.ts.map +1 -1
- package/lib/typescript/components/Modals/NewChatModal/NewChatModal.d.ts +1 -1
- package/lib/typescript/components/Modals/NewChatModal/NewChatModal.d.ts.map +1 -1
- package/lib/typescript/components/Modals/NewChatModal/UpdNewChatModal.d.ts.map +1 -1
- package/lib/typescript/components/Modals/SelectUsersModal/SelectUsersModal.d.ts +1 -6
- package/lib/typescript/components/Modals/SelectUsersModal/SelectUsersModal.d.ts.map +1 -1
- package/lib/typescript/components/Modals/UserProfileModal/EditUserModal.d.ts.map +1 -1
- package/lib/typescript/components/Modals/UserProfileModal/UserProfileModal.d.ts +0 -16
- package/lib/typescript/components/Modals/UserProfileModal/UserProfileModal.d.ts.map +1 -1
- package/lib/typescript/components/Modals/UserSettingsModal/UserSettingsModal.d.ts +0 -1
- package/lib/typescript/components/Modals/UserSettingsModal/UserSettingsModal.d.ts.map +1 -1
- package/lib/typescript/components/Modals/styledModalComponents.d.ts.map +1 -1
- package/lib/typescript/components/RoomComponents/ChatRoomItem.d.ts.map +1 -1
- package/lib/typescript/components/styled/SendInput.d.ts.map +1 -1
- package/lib/typescript/components/styled/StyledComponents.d.ts.map +1 -1
- package/lib/typescript/components/styled/StyledInputComponents/StyledInputComponents.d.ts.map +1 -1
- package/lib/typescript/context/xmppProvider.d.ts.map +1 -1
- package/lib/typescript/helpers/updateMessagesTillLast.d.ts.map +1 -1
- package/lib/typescript/hooks/useChatRoomFocus.d.ts.map +1 -1
- package/lib/typescript/hooks/useLogout.d.ts.map +1 -1
- package/lib/typescript/hooks/useSendMessage.d.ts.map +1 -1
- package/lib/typescript/i18n/strings.d.ts.map +1 -1
- package/lib/typescript/main.d.ts +1 -1
- package/lib/typescript/main.d.ts.map +1 -1
- package/lib/typescript/networking/api-requests/user.api.d.ts +0 -27
- package/lib/typescript/networking/api-requests/user.api.d.ts.map +1 -1
- package/lib/typescript/networking/outboundQueue.d.ts +16 -0
- package/lib/typescript/networking/outboundQueue.d.ts.map +1 -1
- package/lib/typescript/networking/stanzaHandlers.d.ts.map +1 -1
- package/lib/typescript/networking/xmppClient.d.ts +33 -1
- package/lib/typescript/networking/xmppClient.d.ts.map +1 -1
- package/lib/typescript/roomStore/chatSettingsSlice.d.ts.map +1 -1
- package/lib/typescript/roomStore/roomsSlice.d.ts +18 -1
- package/lib/typescript/roomStore/roomsSlice.d.ts.map +1 -1
- package/lib/typescript/types/models/room.model.d.ts +15 -0
- package/lib/typescript/types/models/room.model.d.ts.map +1 -1
- package/lib/typescript/types/types.d.ts +20 -20
- package/lib/typescript/types/types.d.ts.map +1 -1
- package/package.json +1 -6
- package/src/assets/icons.tsx +9 -48
- package/src/components/Header/HeaderRoomList.tsx +5 -20
- package/src/components/MainComponents/ChatRoom.tsx +20 -38
- package/src/components/MainComponents/MessageList.tsx +24 -8
- package/src/components/MainComponents/ProfileImagePlaceholder.tsx +14 -21
- package/src/components/MainComponents/RoomList.tsx +34 -65
- package/src/components/Menu/HeaderRoomListMenu.tsx +71 -310
- package/src/components/Modals/AttachSheet/AttachSheet.tsx +97 -331
- package/src/components/Modals/ChatProfileModal/ChatProfileModal.tsx +279 -598
- package/src/components/Modals/FilePreviewModal/FilePreviewModal.tsx +2 -4
- package/src/components/Modals/Modal/Modal.tsx +0 -7
- package/src/components/Modals/NewChatModal/ModalContent.tsx +3 -6
- package/src/components/Modals/NewChatModal/NewChatModal.tsx +117 -219
- package/src/components/Modals/NewChatModal/UpdNewChatModal.tsx +1 -12
- package/src/components/Modals/SelectUsersModal/SelectUsersModal.tsx +4 -14
- package/src/components/Modals/UserProfileModal/EditUserModal.tsx +25 -9
- package/src/components/Modals/UserProfileModal/UserProfileModal.tsx +307 -617
- package/src/components/Modals/UserSettingsModal/UserSettingsModal.tsx +58 -75
- package/src/components/Modals/styledModalComponents.tsx +2 -9
- package/src/components/RoomComponents/ChatRoomItem.tsx +7 -14
- package/src/components/styled/SendInput.tsx +12 -83
- package/src/components/styled/StyledComponents.ts +3 -9
- package/src/components/styled/StyledInputComponents/StyledInputComponents.tsx +4 -11
- package/src/context/xmppProvider.tsx +41 -8
- package/src/helpers/updateMessagesTillLast.tsx +42 -17
- package/src/hooks/useChatRoomFocus.ts +11 -3
- package/src/hooks/useLogout.tsx +7 -0
- package/src/hooks/useSendMessage.tsx +60 -24
- package/src/i18n/strings.ts +1 -121
- package/src/main.ts +1 -1
- package/src/networking/api-requests/user.api.ts +0 -71
- package/src/networking/outboundQueue.ts +29 -0
- package/src/networking/stanzaHandlers.ts +9 -1
- package/src/networking/xmppClient.ts +118 -7
- package/src/roomStore/chatSettingsSlice.ts +1 -3
- package/src/roomStore/roomsSlice.ts +20 -2
- package/src/types/models/room.model.ts +15 -0
- package/src/types/types.ts +20 -22
- package/lib/commonjs/components/Modals/ChatProfileModal/ReportChatModal.js +0 -226
- package/lib/commonjs/components/Modals/ChatProfileModal/ReportChatModal.js.map +0 -1
- package/lib/commonjs/components/Modals/ProfileHeader/ProfileHeader.js +0 -556
- package/lib/commonjs/components/Modals/ProfileHeader/ProfileHeader.js.map +0 -1
- package/lib/commonjs/components/Modals/ProfileHeader/ProfileMenu.js +0 -210
- package/lib/commonjs/components/Modals/ProfileHeader/ProfileMenu.js.map +0 -1
- package/lib/commonjs/helpers/getChatBackground.js +0 -23
- package/lib/commonjs/helpers/getChatBackground.js.map +0 -1
- package/lib/commonjs/helpers/mediaLibraryRuntime.js +0 -31
- package/lib/commonjs/helpers/mediaLibraryRuntime.js.map +0 -1
- package/lib/commonjs/helpers/pickImageAsset.js +0 -68
- package/lib/commonjs/helpers/pickImageAsset.js.map +0 -1
- package/lib/commonjs/helpers/sheetGestures.js +0 -32
- package/lib/commonjs/helpers/sheetGestures.js.map +0 -1
- package/lib/module/components/Modals/ChatProfileModal/ReportChatModal.js +0 -223
- package/lib/module/components/Modals/ChatProfileModal/ReportChatModal.js.map +0 -1
- package/lib/module/components/Modals/ProfileHeader/ProfileHeader.js +0 -548
- package/lib/module/components/Modals/ProfileHeader/ProfileHeader.js.map +0 -1
- package/lib/module/components/Modals/ProfileHeader/ProfileMenu.js +0 -205
- package/lib/module/components/Modals/ProfileHeader/ProfileMenu.js.map +0 -1
- package/lib/module/helpers/getChatBackground.js +0 -18
- package/lib/module/helpers/getChatBackground.js.map +0 -1
- package/lib/module/helpers/mediaLibraryRuntime.js +0 -25
- package/lib/module/helpers/mediaLibraryRuntime.js.map +0 -1
- package/lib/module/helpers/pickImageAsset.js +0 -63
- package/lib/module/helpers/pickImageAsset.js.map +0 -1
- package/lib/module/helpers/sheetGestures.js +0 -26
- package/lib/module/helpers/sheetGestures.js.map +0 -1
- package/lib/typescript/components/Modals/ChatProfileModal/ReportChatModal.d.ts +0 -9
- package/lib/typescript/components/Modals/ChatProfileModal/ReportChatModal.d.ts.map +0 -1
- package/lib/typescript/components/Modals/ProfileHeader/ProfileHeader.d.ts +0 -75
- package/lib/typescript/components/Modals/ProfileHeader/ProfileHeader.d.ts.map +0 -1
- package/lib/typescript/components/Modals/ProfileHeader/ProfileMenu.d.ts +0 -25
- package/lib/typescript/components/Modals/ProfileHeader/ProfileMenu.d.ts.map +0 -1
- package/lib/typescript/helpers/getChatBackground.d.ts +0 -15
- package/lib/typescript/helpers/getChatBackground.d.ts.map +0 -1
- package/lib/typescript/helpers/mediaLibraryRuntime.d.ts +0 -3
- package/lib/typescript/helpers/mediaLibraryRuntime.d.ts.map +0 -1
- package/lib/typescript/helpers/pickImageAsset.d.ts +0 -27
- package/lib/typescript/helpers/pickImageAsset.d.ts.map +0 -1
- package/lib/typescript/helpers/sheetGestures.d.ts +0 -20
- package/lib/typescript/helpers/sheetGestures.d.ts.map +0 -1
- package/src/components/Modals/ChatProfileModal/ReportChatModal.tsx +0 -244
- package/src/components/Modals/ProfileHeader/ProfileHeader.tsx +0 -615
- package/src/components/Modals/ProfileHeader/ProfileMenu.tsx +0 -217
- package/src/helpers/getChatBackground.ts +0 -18
- package/src/helpers/mediaLibraryRuntime.ts +0 -25
- package/src/helpers/pickImageAsset.ts +0 -68
- 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;
|