@ethora/chat-component-rn 26.7.3 → 26.7.4
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 +45 -0
- package/README.md +9 -8
- package/lib/commonjs/assets/icons.js +7 -2
- package/lib/commonjs/assets/icons.js.map +1 -1
- package/lib/commonjs/components/Header/HeaderRoomList.js +20 -6
- package/lib/commonjs/components/Header/HeaderRoomList.js.map +1 -1
- package/lib/commonjs/components/MainComponents/ChatRoom.js +26 -4
- package/lib/commonjs/components/MainComponents/ChatRoom.js.map +1 -1
- package/lib/commonjs/components/MainComponents/MessageList.js +2 -1
- package/lib/commonjs/components/MainComponents/MessageList.js.map +1 -1
- package/lib/commonjs/components/MainComponents/ProfileImagePlaceholder.js +5 -5
- package/lib/commonjs/components/MainComponents/ProfileImagePlaceholder.js.map +1 -1
- package/lib/commonjs/components/MainComponents/RoomList.js +62 -32
- package/lib/commonjs/components/MainComponents/RoomList.js.map +1 -1
- package/lib/commonjs/components/Menu/HeaderRoomListMenu.js +208 -70
- package/lib/commonjs/components/Menu/HeaderRoomListMenu.js.map +1 -1
- package/lib/commonjs/components/Modals/AttachSheet/AttachSheet.js +307 -99
- package/lib/commonjs/components/Modals/AttachSheet/AttachSheet.js.map +1 -1
- package/lib/commonjs/components/Modals/ChatProfileModal/ChatProfileModal.js +552 -213
- package/lib/commonjs/components/Modals/ChatProfileModal/ChatProfileModal.js.map +1 -1
- package/lib/commonjs/components/Modals/ChatProfileModal/ReportChatModal.js +226 -0
- package/lib/commonjs/components/Modals/ChatProfileModal/ReportChatModal.js.map +1 -0
- package/lib/commonjs/components/Modals/FilePreviewModal/FilePreviewModal.js +6 -2
- package/lib/commonjs/components/Modals/FilePreviewModal/FilePreviewModal.js.map +1 -1
- package/lib/commonjs/components/Modals/Modal/Modal.js +8 -0
- package/lib/commonjs/components/Modals/Modal/Modal.js.map +1 -1
- package/lib/commonjs/components/Modals/NewChatModal/NewChatModal.js +202 -104
- package/lib/commonjs/components/Modals/NewChatModal/NewChatModal.js.map +1 -1
- package/lib/commonjs/components/Modals/ProfileHeader/ProfileHeader.js +556 -0
- package/lib/commonjs/components/Modals/ProfileHeader/ProfileHeader.js.map +1 -0
- package/lib/commonjs/components/Modals/ProfileHeader/ProfileMenu.js +210 -0
- package/lib/commonjs/components/Modals/ProfileHeader/ProfileMenu.js.map +1 -0
- package/lib/commonjs/components/Modals/SelectUsersModal/SelectUsersModal.js +4 -2
- package/lib/commonjs/components/Modals/SelectUsersModal/SelectUsersModal.js.map +1 -1
- package/lib/commonjs/components/Modals/UserProfileModal/UserProfileModal.js +507 -244
- package/lib/commonjs/components/Modals/UserProfileModal/UserProfileModal.js.map +1 -1
- package/lib/commonjs/components/Modals/UserSettingsModal/UserSettingsModal.js +74 -46
- package/lib/commonjs/components/Modals/UserSettingsModal/UserSettingsModal.js.map +1 -1
- package/lib/commonjs/components/Modals/styledModalComponents.js +9 -2
- package/lib/commonjs/components/Modals/styledModalComponents.js.map +1 -1
- package/lib/commonjs/components/RoomComponents/ChatRoomItem.js +17 -7
- package/lib/commonjs/components/RoomComponents/ChatRoomItem.js.map +1 -1
- package/lib/commonjs/components/styled/SendInput.js +80 -1
- package/lib/commonjs/components/styled/SendInput.js.map +1 -1
- package/lib/commonjs/components/styled/StyledComponents.js +9 -3
- package/lib/commonjs/components/styled/StyledComponents.js.map +1 -1
- package/lib/commonjs/components/styled/StyledInputComponents/StyledInputComponents.js +11 -4
- package/lib/commonjs/components/styled/StyledInputComponents/StyledInputComponents.js.map +1 -1
- package/lib/commonjs/helpers/getChatBackground.js +23 -0
- package/lib/commonjs/helpers/getChatBackground.js.map +1 -0
- package/lib/commonjs/helpers/mediaLibraryRuntime.js +31 -0
- package/lib/commonjs/helpers/mediaLibraryRuntime.js.map +1 -0
- package/lib/commonjs/helpers/sheetGestures.js +32 -0
- package/lib/commonjs/helpers/sheetGestures.js.map +1 -0
- package/lib/commonjs/i18n/strings.js +121 -1
- package/lib/commonjs/i18n/strings.js.map +1 -1
- package/lib/commonjs/networking/api-requests/user.api.js +59 -0
- package/lib/commonjs/networking/api-requests/user.api.js.map +1 -1
- package/lib/commonjs/roomStore/chatSettingsSlice.js +3 -1
- package/lib/commonjs/roomStore/chatSettingsSlice.js.map +1 -1
- package/lib/module/assets/icons.js +6 -1
- package/lib/module/assets/icons.js.map +1 -1
- package/lib/module/components/Header/HeaderRoomList.js +20 -6
- package/lib/module/components/Header/HeaderRoomList.js.map +1 -1
- package/lib/module/components/MainComponents/ChatRoom.js +26 -4
- package/lib/module/components/MainComponents/ChatRoom.js.map +1 -1
- package/lib/module/components/MainComponents/MessageList.js +2 -1
- package/lib/module/components/MainComponents/MessageList.js.map +1 -1
- package/lib/module/components/MainComponents/ProfileImagePlaceholder.js +5 -5
- package/lib/module/components/MainComponents/ProfileImagePlaceholder.js.map +1 -1
- package/lib/module/components/MainComponents/RoomList.js +62 -32
- package/lib/module/components/MainComponents/RoomList.js.map +1 -1
- package/lib/module/components/Menu/HeaderRoomListMenu.js +211 -73
- package/lib/module/components/Menu/HeaderRoomListMenu.js.map +1 -1
- package/lib/module/components/Modals/AttachSheet/AttachSheet.js +298 -102
- package/lib/module/components/Modals/AttachSheet/AttachSheet.js.map +1 -1
- package/lib/module/components/Modals/ChatProfileModal/ChatProfileModal.js +555 -217
- package/lib/module/components/Modals/ChatProfileModal/ChatProfileModal.js.map +1 -1
- package/lib/module/components/Modals/ChatProfileModal/ReportChatModal.js +223 -0
- package/lib/module/components/Modals/ChatProfileModal/ReportChatModal.js.map +1 -0
- package/lib/module/components/Modals/FilePreviewModal/FilePreviewModal.js +6 -2
- package/lib/module/components/Modals/FilePreviewModal/FilePreviewModal.js.map +1 -1
- package/lib/module/components/Modals/Modal/Modal.js +9 -1
- package/lib/module/components/Modals/Modal/Modal.js.map +1 -1
- package/lib/module/components/Modals/NewChatModal/NewChatModal.js +205 -106
- package/lib/module/components/Modals/NewChatModal/NewChatModal.js.map +1 -1
- package/lib/module/components/Modals/ProfileHeader/ProfileHeader.js +548 -0
- package/lib/module/components/Modals/ProfileHeader/ProfileHeader.js.map +1 -0
- package/lib/module/components/Modals/ProfileHeader/ProfileMenu.js +205 -0
- package/lib/module/components/Modals/ProfileHeader/ProfileMenu.js.map +1 -0
- package/lib/module/components/Modals/SelectUsersModal/SelectUsersModal.js +4 -2
- package/lib/module/components/Modals/SelectUsersModal/SelectUsersModal.js.map +1 -1
- package/lib/module/components/Modals/UserProfileModal/UserProfileModal.js +509 -248
- package/lib/module/components/Modals/UserProfileModal/UserProfileModal.js.map +1 -1
- package/lib/module/components/Modals/UserSettingsModal/UserSettingsModal.js +76 -48
- package/lib/module/components/Modals/UserSettingsModal/UserSettingsModal.js.map +1 -1
- package/lib/module/components/Modals/styledModalComponents.js +9 -2
- package/lib/module/components/Modals/styledModalComponents.js.map +1 -1
- package/lib/module/components/RoomComponents/ChatRoomItem.js +17 -7
- package/lib/module/components/RoomComponents/ChatRoomItem.js.map +1 -1
- package/lib/module/components/styled/SendInput.js +80 -1
- package/lib/module/components/styled/SendInput.js.map +1 -1
- package/lib/module/components/styled/StyledComponents.js +9 -3
- package/lib/module/components/styled/StyledComponents.js.map +1 -1
- package/lib/module/components/styled/StyledInputComponents/StyledInputComponents.js +11 -4
- package/lib/module/components/styled/StyledInputComponents/StyledInputComponents.js.map +1 -1
- package/lib/module/helpers/getChatBackground.js +18 -0
- package/lib/module/helpers/getChatBackground.js.map +1 -0
- package/lib/module/helpers/mediaLibraryRuntime.js +25 -0
- package/lib/module/helpers/mediaLibraryRuntime.js.map +1 -0
- package/lib/module/helpers/sheetGestures.js +26 -0
- package/lib/module/helpers/sheetGestures.js.map +1 -0
- package/lib/module/i18n/strings.js +121 -1
- package/lib/module/i18n/strings.js.map +1 -1
- package/lib/module/networking/api-requests/user.api.js +56 -0
- package/lib/module/networking/api-requests/user.api.js.map +1 -1
- package/lib/module/roomStore/chatSettingsSlice.js +3 -1
- package/lib/module/roomStore/chatSettingsSlice.js.map +1 -1
- package/lib/typescript/assets/icons.d.ts +12 -0
- 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/RoomList.d.ts.map +1 -1
- package/lib/typescript/components/Menu/HeaderRoomListMenu.d.ts.map +1 -1
- package/lib/typescript/components/Modals/AttachSheet/AttachSheet.d.ts +9 -0
- package/lib/typescript/components/Modals/AttachSheet/AttachSheet.d.ts.map +1 -1
- package/lib/typescript/components/Modals/ChatProfileModal/ChatProfileModal.d.ts +10 -0
- package/lib/typescript/components/Modals/ChatProfileModal/ChatProfileModal.d.ts.map +1 -1
- package/lib/typescript/components/Modals/ChatProfileModal/ReportChatModal.d.ts +9 -0
- package/lib/typescript/components/Modals/ChatProfileModal/ReportChatModal.d.ts.map +1 -0
- 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/NewChatModal.d.ts +1 -1
- package/lib/typescript/components/Modals/NewChatModal/NewChatModal.d.ts.map +1 -1
- package/lib/typescript/components/Modals/ProfileHeader/ProfileHeader.d.ts +75 -0
- package/lib/typescript/components/Modals/ProfileHeader/ProfileHeader.d.ts.map +1 -0
- package/lib/typescript/components/Modals/ProfileHeader/ProfileMenu.d.ts +25 -0
- package/lib/typescript/components/Modals/ProfileHeader/ProfileMenu.d.ts.map +1 -0
- package/lib/typescript/components/Modals/SelectUsersModal/SelectUsersModal.d.ts +6 -1
- package/lib/typescript/components/Modals/SelectUsersModal/SelectUsersModal.d.ts.map +1 -1
- package/lib/typescript/components/Modals/UserProfileModal/UserProfileModal.d.ts +16 -0
- package/lib/typescript/components/Modals/UserProfileModal/UserProfileModal.d.ts.map +1 -1
- package/lib/typescript/components/Modals/UserSettingsModal/UserSettingsModal.d.ts +1 -0
- 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/helpers/getChatBackground.d.ts +15 -0
- package/lib/typescript/helpers/getChatBackground.d.ts.map +1 -0
- package/lib/typescript/helpers/mediaLibraryRuntime.d.ts +3 -0
- package/lib/typescript/helpers/mediaLibraryRuntime.d.ts.map +1 -0
- package/lib/typescript/helpers/sheetGestures.d.ts +20 -0
- package/lib/typescript/helpers/sheetGestures.d.ts.map +1 -0
- package/lib/typescript/i18n/strings.d.ts.map +1 -1
- package/lib/typescript/networking/api-requests/user.api.d.ts +27 -0
- package/lib/typescript/networking/api-requests/user.api.d.ts.map +1 -1
- package/lib/typescript/roomStore/chatSettingsSlice.d.ts.map +1 -1
- package/lib/typescript/types/types.d.ts +8 -5
- package/lib/typescript/types/types.d.ts.map +1 -1
- package/package.json +6 -1
- package/src/assets/icons.tsx +29 -9
- package/src/components/Header/HeaderRoomList.tsx +20 -5
- package/src/components/MainComponents/ChatRoom.tsx +29 -7
- package/src/components/MainComponents/MessageList.tsx +2 -1
- package/src/components/MainComponents/ProfileImagePlaceholder.tsx +5 -5
- package/src/components/MainComponents/RoomList.tsx +65 -34
- package/src/components/Menu/HeaderRoomListMenu.tsx +209 -64
- package/src/components/Modals/AttachSheet/AttachSheet.tsx +318 -86
- package/src/components/Modals/ChatProfileModal/ChatProfileModal.tsx +598 -279
- package/src/components/Modals/ChatProfileModal/ReportChatModal.tsx +244 -0
- package/src/components/Modals/FilePreviewModal/FilePreviewModal.tsx +4 -2
- package/src/components/Modals/Modal/Modal.tsx +7 -0
- package/src/components/Modals/NewChatModal/NewChatModal.tsx +219 -117
- package/src/components/Modals/ProfileHeader/ProfileHeader.tsx +615 -0
- package/src/components/Modals/ProfileHeader/ProfileMenu.tsx +217 -0
- package/src/components/Modals/SelectUsersModal/SelectUsersModal.tsx +14 -4
- package/src/components/Modals/UserProfileModal/UserProfileModal.tsx +617 -307
- package/src/components/Modals/UserSettingsModal/UserSettingsModal.tsx +75 -58
- package/src/components/Modals/styledModalComponents.tsx +9 -2
- package/src/components/RoomComponents/ChatRoomItem.tsx +14 -7
- package/src/components/styled/SendInput.tsx +83 -2
- package/src/components/styled/StyledComponents.ts +9 -3
- package/src/components/styled/StyledInputComponents/StyledInputComponents.tsx +11 -4
- package/src/helpers/getChatBackground.ts +18 -0
- package/src/helpers/mediaLibraryRuntime.ts +25 -0
- package/src/helpers/sheetGestures.ts +25 -0
- package/src/i18n/strings.ts +121 -1
- package/src/networking/api-requests/user.api.ts +71 -0
- package/src/roomStore/chatSettingsSlice.ts +3 -1
- package/src/types/types.ts +8 -5
|
@@ -0,0 +1,217 @@
|
|
|
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;
|
|
@@ -17,7 +17,13 @@ import { useToast } from '../../../context/ToastContext';
|
|
|
17
17
|
import { updateRoom } from '../../../roomStore/roomsSlice';
|
|
18
18
|
import { Text } from 'react-native';
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
interface SelectUsersModalProps {
|
|
21
|
+
/** Render the opener yourself (the chat profile uses an "Add Members"
|
|
22
|
+
* row). Falls back to the plain "Add more Users" button. */
|
|
23
|
+
trigger?: (open: () => void) => React.ReactNode;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const SelectUsersModal: React.FC<SelectUsersModalProps> = ({ trigger }) => {
|
|
21
27
|
const { showToast } = useToast();
|
|
22
28
|
const dispatch = useDispatch();
|
|
23
29
|
|
|
@@ -74,9 +80,13 @@ const SelectUsersModal: React.FC = () => {
|
|
|
74
80
|
|
|
75
81
|
return (
|
|
76
82
|
<>
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
83
|
+
{trigger ? (
|
|
84
|
+
trigger(handleOpenModal)
|
|
85
|
+
) : (
|
|
86
|
+
<ActionButton variant="filled" unstyled onPress={handleOpenModal}>
|
|
87
|
+
Add more Users
|
|
88
|
+
</ActionButton>
|
|
89
|
+
)}
|
|
80
90
|
|
|
81
91
|
{isModalOpen && (
|
|
82
92
|
<ModalBackground>
|