@ethora/chat-component-rn 26.4.1
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/LICENSE +661 -0
- package/README.md +148 -0
- package/empty-shim.js +15 -0
- package/index.js +13 -0
- package/metro.js +72 -0
- package/package.json +99 -0
- package/src/api.config.ts +34 -0
- package/src/assets/BG.png +0 -0
- package/src/assets/BG.tsx +56 -0
- package/src/assets/File.svg +4 -0
- package/src/assets/ForzaCare.png +0 -0
- package/src/assets/ForzaCare.tsx +27 -0
- package/src/assets/icons.tsx +685 -0
- package/src/assets/images.tsx +41 -0
- package/src/assets/test.xml +243 -0
- package/src/components/AuthForms/Login.tsx +295 -0
- package/src/components/AuthForms/LoginAnonym.tsx +68 -0
- package/src/components/AuthForms/Register.tsx +8 -0
- package/src/components/ContextMenu/ContextMenuComponents.tsx +87 -0
- package/src/components/DropdownMenu/DropdownMenu.tsx +244 -0
- package/src/components/ExampleComponents/CustomMessage.tsx +92 -0
- package/src/components/ExampleComponents/CustomTypingIndicatorExamples.tsx +239 -0
- package/src/components/Header/HeaderRoomList.tsx +104 -0
- package/src/components/InputComponents/AudioInput.tsx +24 -0
- package/src/components/InputComponents/AudioRecorder.tsx +100 -0
- package/src/components/InputComponents/MediaInput.tsx +114 -0
- package/src/components/InputComponents/RecordingIndicator.tsx +77 -0
- package/src/components/InputComponents/Search.tsx +135 -0
- package/src/components/InputComponents/TextInput.tsx +66 -0
- package/src/components/MainComponents/ChatHeader.tsx +163 -0
- package/src/components/MainComponents/ChatRoom.tsx +392 -0
- package/src/components/MainComponents/ChatWrapper.tsx +318 -0
- package/src/components/MainComponents/ChooseChatMessage.tsx +44 -0
- package/src/components/MainComponents/ConnectionBanner.tsx +33 -0
- package/src/components/MainComponents/EditWrapper.tsx +72 -0
- package/src/components/MainComponents/LoginWrapper.tsx +134 -0
- package/src/components/MainComponents/MediaMessage.tsx +55 -0
- package/src/components/MainComponents/MessageContainer.tsx +122 -0
- package/src/components/MainComponents/MessageList.tsx +429 -0
- package/src/components/MainComponents/NoMessagesPlaceholder.tsx +49 -0
- package/src/components/MainComponents/ProfileImagePlaceholder.tsx +143 -0
- package/src/components/MainComponents/RNStyled.tsx +34 -0
- package/src/components/MainComponents/ReduxWrapper.tsx +40 -0
- package/src/components/MainComponents/RoomList.tsx +246 -0
- package/src/components/MainComponents/Select.tsx +165 -0
- package/src/components/MainComponents/Switch.tsx +73 -0
- package/src/components/MainComponents/SystemMessage.tsx +42 -0
- package/src/components/Menu/HeaderRoomListMenu.tsx +169 -0
- package/src/components/MenuRoom/MenuRoom.tsx +46 -0
- package/src/components/MessageBubble/Avatar.tsx +84 -0
- package/src/components/MessageBubble/BottomReplyContainer.tsx +117 -0
- package/src/components/MessageBubble/CustomDivider.tsx +10 -0
- package/src/components/MessageBubble/DeletedMessage.tsx +36 -0
- package/src/components/MessageBubble/Message.tsx +400 -0
- package/src/components/MessageBubble/MessageInteractions.tsx +247 -0
- package/src/components/MessageBubble/MessageReaction.tsx +149 -0
- package/src/components/MessageBubble/MessageReply.tsx +50 -0
- package/src/components/MessageBubble/MessageTranslations.tsx +30 -0
- package/src/components/Modals/AddMembersModal/AddMembersModal.tsx +142 -0
- package/src/components/Modals/ChatProfileModal/ChatProfileModal.tsx +471 -0
- package/src/components/Modals/ChatProfileModal/DeleteChatModal.tsx +91 -0
- package/src/components/Modals/FilePreviewModal/FilePreviewModal.tsx +298 -0
- package/src/components/Modals/Modal/Modal.tsx +52 -0
- package/src/components/Modals/ModalHeaderComponent.tsx +41 -0
- package/src/components/Modals/ModalSelectMedia/ModalSelectMedia.tsx +285 -0
- package/src/components/Modals/ModalWrapper/ModalWrapper.tsx +103 -0
- package/src/components/Modals/NewChatModal/ModalContent.tsx +151 -0
- package/src/components/Modals/NewChatModal/NewChatModal.tsx +391 -0
- package/src/components/Modals/NewChatModal/UpdNewChatModal.tsx +136 -0
- package/src/components/Modals/SelectUsersModal/SelectUsersModal.tsx +134 -0
- package/src/components/Modals/SettingsModals/BlockedUsers/BlockedUsersModal.tsx +63 -0
- package/src/components/Modals/SettingsModals/DocumentShares/DocumentSharesModal.tsx +115 -0
- package/src/components/Modals/SettingsModals/ManageDataModal/ManageDataModal.tsx +121 -0
- package/src/components/Modals/SettingsModals/ManageDataModal/StyledComponents.ts +0 -0
- package/src/components/Modals/SettingsModals/ProfileShares/ProfileShares.tsx +65 -0
- package/src/components/Modals/SettingsModals/Referrals/Referrals.tsx +90 -0
- package/src/components/Modals/SettingsModals/SharedStyledComponents.ts +74 -0
- package/src/components/Modals/SettingsModals/Visibility/RadioInput.tsx +59 -0
- package/src/components/Modals/SettingsModals/Visibility/StyledComponents.ts +32 -0
- package/src/components/Modals/SettingsModals/Visibility/VisibilityModal.tsx +146 -0
- package/src/components/Modals/UserProfileModal/EditUserModal.tsx +163 -0
- package/src/components/Modals/UserProfileModal/UserProfileModal.tsx +410 -0
- package/src/components/Modals/UserSettingsModal/UserSettingsModal.tsx +85 -0
- package/src/components/Modals/styledModalComponents.tsx +181 -0
- package/src/components/OperationalModal/OperationalModal.tsx +78 -0
- package/src/components/RoomComponents/ChatRoomItem.tsx +219 -0
- package/src/components/RoomComponents/LastMessageItem.tsx +47 -0
- package/src/components/RoomComponents/styled/LastAudioMessage.tsx +62 -0
- package/src/components/RoomComponents/styled/LastMessageEmoji.tsx +26 -0
- package/src/components/RoomComponents/styled/LastMessageFile.tsx +54 -0
- package/src/components/RoomComponents/styled/LastMessagePhoto.tsx +54 -0
- package/src/components/RoomComponents/styled/LastMessageVideo.tsx +70 -0
- package/src/components/RoomComponents/styled/LastTextMessage.tsx +65 -0
- package/src/components/RoomComponents/styled/StyledRoomComponents.ts +53 -0
- package/src/components/SortDropDown/index.tsx +76 -0
- package/src/components/Thread/ThreadHeader.tsx +41 -0
- package/src/components/Thread/ThreadWrapper.tsx +270 -0
- package/src/components/Toast/Toast.tsx +128 -0
- package/src/components/Toast/index.ts +13 -0
- package/src/components/UsersList/StyledComponents.ts +30 -0
- package/src/components/UsersList/UsersList.tsx +112 -0
- package/src/components/styled/ActionButton.tsx +40 -0
- package/src/components/styled/AudioMessage.tsx +82 -0
- package/src/components/styled/Button.tsx +107 -0
- package/src/components/styled/ChatWrapperBox.tsx +9 -0
- package/src/components/styled/DateLabel.tsx +77 -0
- package/src/components/styled/Loader.tsx +65 -0
- package/src/components/styled/MediaFilePreview.tsx +42 -0
- package/src/components/styled/MediaModal.tsx +54 -0
- package/src/components/styled/MessageImage.tsx +54 -0
- package/src/components/styled/NewMessageLabel.tsx +50 -0
- package/src/components/styled/RoomListComponents/index.tsx +164 -0
- package/src/components/styled/SendInput.tsx +297 -0
- package/src/components/styled/StyledComponents.ts +320 -0
- package/src/components/styled/StyledInput.tsx +101 -0
- package/src/components/styled/StyledInputComponents/AudioComponents.tsx +1 -0
- package/src/components/styled/StyledInputComponents/Composing.tsx +97 -0
- package/src/components/styled/StyledInputComponents/CustomTypingIndicator.tsx +261 -0
- package/src/components/styled/StyledInputComponents/MediaComponents.tsx +90 -0
- package/src/components/styled/StyledInputComponents/StyledInputComponents.tsx +131 -0
- package/src/components/styled/StyledInputComponents/VideoComponents.tsx +49 -0
- package/src/components/styled/TreadLabel.tsx +50 -0
- package/src/components/styled/UnsupportedType.tsx +95 -0
- package/src/components/styled/VideoMessage.tsx +68 -0
- package/src/context/MessageNotificationContext.tsx +335 -0
- package/src/context/PushNotificationProvider.tsx +78 -0
- package/src/context/ToastContext.tsx +63 -0
- package/src/context/toastProvider.tsx +0 -0
- package/src/context/xmppProvider.tsx +364 -0
- package/src/helpers/block_scroll.ts +95 -0
- package/src/helpers/chatAutoEnterer.ts +46 -0
- package/src/helpers/checkUniqueUsers.tsx +31 -0
- package/src/helpers/constants/CHAT_TYPES.ts +6 -0
- package/src/helpers/constants/LANGUAGE_OPTIONS.ts +14 -0
- package/src/helpers/constants/LOCAL_STORAGE.ts +3 -0
- package/src/helpers/constants/MESSAGE_INTERACTIONS.ts +29 -0
- package/src/helpers/constants/MODAL_TYPES.ts +57 -0
- package/src/helpers/constants/PLATFORM_CONSTANTS.ts +3 -0
- package/src/helpers/createMainMessageForThread.ts +23 -0
- package/src/helpers/createMessageFromXml.ts +118 -0
- package/src/helpers/createRoomFromApi.tsx +27 -0
- package/src/helpers/createUserNameFromSetUser.ts +15 -0
- package/src/helpers/dateComparison.ts +12 -0
- package/src/helpers/debounce.ts +10 -0
- package/src/helpers/ensureScopedChatCache.ts +61 -0
- package/src/helpers/extractUniqueMembersFromRooms.ts +45 -0
- package/src/helpers/formatNumberWithCommas.ts +3 -0
- package/src/helpers/getBooleanFromString.ts +7 -0
- package/src/helpers/getDataFromXml.ts +80 -0
- package/src/helpers/getNumberFromString.ts +5 -0
- package/src/helpers/getRoomsWithRetry.ts +45 -0
- package/src/helpers/getTintedColor.ts +28 -0
- package/src/helpers/getUnnamedUsers.ts +39 -0
- package/src/helpers/handleCopyClick.ts +3 -0
- package/src/helpers/handleXmppError.ts +14 -0
- package/src/helpers/hashcolor.ts +34 -0
- package/src/helpers/historyPreloadScheduler.ts +264 -0
- package/src/helpers/initRoomsPresence.ts +32 -0
- package/src/helpers/initXmppRooms.tsx +71 -0
- package/src/helpers/insertMessageWithDelimiter.ts +96 -0
- package/src/helpers/isChatIdPresentInArray.ts +54 -0
- package/src/helpers/localStorageUser.ts +9 -0
- package/src/helpers/markdownParser.tsx +295 -0
- package/src/helpers/nanoToMs.ts +3 -0
- package/src/helpers/parseMessageBody.tsx +516 -0
- package/src/helpers/parseUrls.tsx +42 -0
- package/src/helpers/resolveInitBeforeLoadUser.ts +240 -0
- package/src/helpers/storeConsole.ts +26 -0
- package/src/helpers/transformTranslatations.ts +16 -0
- package/src/helpers/updateMessagesTillLast.tsx +104 -0
- package/src/helpers/updatedChatLastTimestamps.ts +29 -0
- package/src/helpers/validator.ts +20 -0
- package/src/helpers/walletUsername.ts +12 -0
- package/src/hooks/hooks.ts +6 -0
- package/src/hooks/useChatSettingState.tsx +38 -0
- package/src/hooks/useChatWrapperInit.ts +266 -0
- package/src/hooks/useComposing.tsx +59 -0
- package/src/hooks/useCustomTypingIndicator.tsx +193 -0
- package/src/hooks/useEventHandlers.tsx +81 -0
- package/src/hooks/useGetNewArchRoom.tsx +57 -0
- package/src/hooks/useHeapSender.tsx +88 -0
- package/src/hooks/useLocalStorage.tsx +53 -0
- package/src/hooks/useLogout.tsx +31 -0
- package/src/hooks/useMessageHeapState.tsx +11 -0
- package/src/hooks/useMessageLoaderQueue.tsx +90 -0
- package/src/hooks/useMessageQueue.ts +146 -0
- package/src/hooks/usePendingNotification.ts +49 -0
- package/src/hooks/usePrevious.tsx +15 -0
- package/src/hooks/usePushNotifications.ts +106 -0
- package/src/hooks/useQRCodeChatHandler.ts +58 -0
- package/src/hooks/useRoomInitialization.tsx +160 -0
- package/src/hooks/useRoomState.tsx +47 -0
- package/src/hooks/useRoomUrl.tsx +41 -0
- package/src/hooks/useSendMessage.tsx +306 -0
- package/src/hooks/useUnreadMessagesCounter.ts +55 -0
- package/src/hooks/useXmppInitialization.ts +148 -0
- package/src/main.ts +45 -0
- package/src/networking/api-requests/auth.api.ts +140 -0
- package/src/networking/api-requests/push.api.ts +55 -0
- package/src/networking/api-requests/roomMembers.api.ts +20 -0
- package/src/networking/api-requests/rooms.api.ts +142 -0
- package/src/networking/api-requests/user.api.ts +65 -0
- package/src/networking/apiClient.ts +149 -0
- package/src/networking/helpers/refreshChecker.ts +13 -0
- package/src/networking/stanzaHandlers.ts +418 -0
- package/src/networking/xmpp/actionSetTimestampToPrivateStore.xmpp.ts +37 -0
- package/src/networking/xmpp/allRoomPresences.xmpp.ts +10 -0
- package/src/networking/xmpp/createPrivateRoom.xmpp.ts +26 -0
- package/src/networking/xmpp/createRoom.xmpp.ts +35 -0
- package/src/networking/xmpp/createRoomPresence.xmpp.ts +74 -0
- package/src/networking/xmpp/createTimeoutPromise.xmpp.ts +15 -0
- package/src/networking/xmpp/deleteMessage.xmpp.ts +19 -0
- package/src/networking/xmpp/editMessage.xmpp.ts +46 -0
- package/src/networking/xmpp/getChatsPrivateStoreRequest.xmpp.ts +57 -0
- package/src/networking/xmpp/getHistory.xmpp.ts +140 -0
- package/src/networking/xmpp/getLastMessageArchive.xmpp.ts +24 -0
- package/src/networking/xmpp/getRoomInfo.xmpp.ts +15 -0
- package/src/networking/xmpp/getRoomMembers.xmpp.ts +13 -0
- package/src/networking/xmpp/getRooms.xmpp.ts +43 -0
- package/src/networking/xmpp/getRoomsPaged.xmpp.ts +59 -0
- package/src/networking/xmpp/handlePong.xmpp.ts +7 -0
- package/src/networking/xmpp/handleStanzas.xmpp.ts +55 -0
- package/src/networking/xmpp/inviteRoomRequest.xmpp.ts +25 -0
- package/src/networking/xmpp/leaveTheRoom.xmpp.ts +15 -0
- package/src/networking/xmpp/listenerManager.ts +116 -0
- package/src/networking/xmpp/presenceInRoom.xmpp.ts +57 -0
- package/src/networking/xmpp/roomConfig.xmpp.ts +71 -0
- package/src/networking/xmpp/sendMediaMessage.xmpp.ts +97 -0
- package/src/networking/xmpp/sendMessageReaction.xmpp.ts +41 -0
- package/src/networking/xmpp/sendPing.xmpp.ts +21 -0
- package/src/networking/xmpp/sendTextMessage.xmpp.ts +99 -0
- package/src/networking/xmpp/sendTextMessageWithTranslateTag.xmpp.ts +44 -0
- package/src/networking/xmpp/sendTypingRequest.xmpp.ts +26 -0
- package/src/networking/xmpp/setChatsPrivateStoreRequest.xmpp.ts +48 -0
- package/src/networking/xmpp/setMeAsOwner.xmpp.ts +52 -0
- package/src/networking/xmpp/setRoomImage.xmpp.ts +26 -0
- package/src/networking/xmpp/setVCard.xmpp.ts +19 -0
- package/src/networking/xmpp/subscribeToRoomMessages.xmpp.ts +75 -0
- package/src/networking/xmppClient.ts +603 -0
- package/src/roomStore/Middleware/logoutMiddleware.tsx +24 -0
- package/src/roomStore/Middleware/newMessageMidlleware.tsx +87 -0
- package/src/roomStore/Middleware/reactionsMiddleware.tsx +77 -0
- package/src/roomStore/Middleware/testMiddleware.tsx +20 -0
- package/src/roomStore/Middleware/unreadMidlleware.tsx +58 -0
- package/src/roomStore/chatSettingsSlice.ts +178 -0
- package/src/roomStore/index.ts +68 -0
- package/src/roomStore/persistence.ts +152 -0
- package/src/roomStore/roomHeapSlice.ts +37 -0
- package/src/roomStore/roomsSlice.ts +353 -0
- package/src/services/pushNotifications.ts +170 -0
- package/src/services/pushSubscriptionService.ts +145 -0
- package/src/types/messages.ts +61 -0
- package/src/types/models/action.model.ts +30 -0
- package/src/types/models/config.model.ts +16 -0
- package/src/types/models/customComponents.model.ts +53 -0
- package/src/types/models/language.model.ts +11 -0
- package/src/types/models/media.model.ts +5 -0
- package/src/types/models/message.model.ts +69 -0
- package/src/types/models/modal.model.ts +9 -0
- package/src/types/models/room.model.ts +120 -0
- package/src/types/models/user.model.ts +90 -0
- package/src/types/models/xmpp.model.ts +155 -0
- package/src/types/types.ts +505 -0
- package/src/utils/PriorityQueue.ts +47 -0
- package/src/utils/actionHelpers.ts +40 -0
- package/src/utils/actionLogger.ts +64 -0
- package/src/utils/clientRegistry.ts +80 -0
- package/src/utils/devLogger.ts +197 -0
- package/src/utils/messageNotificationManager.ts +108 -0
- package/src/utils/resendMessage.ts +87 -0
- package/src/utils/toastEmitter.ts +27 -0
- package/src/utils/xmppMemoryMonitor.ts +63 -0
- package/src/version.ts +1 -0
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import React, {
|
|
2
|
+
Dispatch,
|
|
3
|
+
SetStateAction,
|
|
4
|
+
useState,
|
|
5
|
+
useMemo,
|
|
6
|
+
useEffect,
|
|
7
|
+
} from 'react';
|
|
8
|
+
import { ModalTitle, LabelData } from '../Modals/styledModalComponents';
|
|
9
|
+
import {
|
|
10
|
+
ScrollableContainer,
|
|
11
|
+
UserItem,
|
|
12
|
+
Checkbox,
|
|
13
|
+
Label,
|
|
14
|
+
} from './StyledComponents';
|
|
15
|
+
import { useSelector } from 'react-redux';
|
|
16
|
+
import { RootState } from '../../roomStore';
|
|
17
|
+
import { RoomMember } from '../../types/types';
|
|
18
|
+
import { debounce } from '../../helpers/debounce';
|
|
19
|
+
import { StyledInput } from '../styled/StyledInputComponents/StyledInputComponents';
|
|
20
|
+
import { useRoomState } from '../../hooks/useRoomState';
|
|
21
|
+
import { Text, View } from 'react-native';
|
|
22
|
+
|
|
23
|
+
interface UsersListProps {
|
|
24
|
+
selectedUsers: RoomMember[];
|
|
25
|
+
setSelectedUsers: Dispatch<SetStateAction<RoomMember[]>>;
|
|
26
|
+
headerElement?: boolean;
|
|
27
|
+
style?: any;
|
|
28
|
+
filter?: RoomMember[];
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const UsersList: React.FC<UsersListProps> = ({
|
|
32
|
+
style,
|
|
33
|
+
selectedUsers,
|
|
34
|
+
setSelectedUsers,
|
|
35
|
+
headerElement,
|
|
36
|
+
filter,
|
|
37
|
+
}) => {
|
|
38
|
+
const { usersSet } = useRoomState();
|
|
39
|
+
const [searchTerm, setSearchTerm] = useState('');
|
|
40
|
+
const [filteredUsers, setFilteredUsers] = useState<RoomMember[]>([]);
|
|
41
|
+
|
|
42
|
+
const handleUserSelect = (user: RoomMember) => {
|
|
43
|
+
setSelectedUsers((prev) => {
|
|
44
|
+
const isSelected = prev.some((u) => u._id === user._id);
|
|
45
|
+
return isSelected
|
|
46
|
+
? prev.filter((u) => u._id !== user._id)
|
|
47
|
+
: [...prev, user];
|
|
48
|
+
});
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
const debouncedFilter = useMemo(
|
|
52
|
+
() =>
|
|
53
|
+
debounce((term: string) => {
|
|
54
|
+
const lower = term.toLowerCase();
|
|
55
|
+
const users = (Object.values(usersSet) as RoomMember[]).filter(
|
|
56
|
+
(user: RoomMember) =>
|
|
57
|
+
`${user.firstName} ${user.lastName}`.toLowerCase().includes(lower)
|
|
58
|
+
);
|
|
59
|
+
setFilteredUsers(users);
|
|
60
|
+
}, 100),
|
|
61
|
+
[usersSet]
|
|
62
|
+
);
|
|
63
|
+
|
|
64
|
+
useEffect(() => {
|
|
65
|
+
debouncedFilter(searchTerm);
|
|
66
|
+
}, [searchTerm, debouncedFilter]);
|
|
67
|
+
|
|
68
|
+
useEffect(() => {
|
|
69
|
+
setFilteredUsers(Object.values(usersSet) as RoomMember[]);
|
|
70
|
+
}, [usersSet]);
|
|
71
|
+
|
|
72
|
+
return (
|
|
73
|
+
<View style={{ maxHeight: '100px', ...style }}>
|
|
74
|
+
{headerElement ? (
|
|
75
|
+
<ModalTitle>Select Users (max 20)</ModalTitle>
|
|
76
|
+
) : (
|
|
77
|
+
<Text style={{ fontSize: 14, fontWeight: '600' }}>
|
|
78
|
+
Select Users (max 20)
|
|
79
|
+
</Text>
|
|
80
|
+
)}
|
|
81
|
+
|
|
82
|
+
<StyledInput
|
|
83
|
+
placeholder="Search users..."
|
|
84
|
+
value={searchTerm}
|
|
85
|
+
onChangeText={setSearchTerm}
|
|
86
|
+
style={{ width: '100%' }}
|
|
87
|
+
/>
|
|
88
|
+
|
|
89
|
+
<ScrollableContainer style={{ ...style }}>
|
|
90
|
+
{filteredUsers.map((user) => (
|
|
91
|
+
<UserItem
|
|
92
|
+
key={user._id}
|
|
93
|
+
onPress={() => handleUserSelect(user)}
|
|
94
|
+
style={{ cursor: 'pointer' }}
|
|
95
|
+
>
|
|
96
|
+
<Checkbox
|
|
97
|
+
value={selectedUsers.some((u) => u._id === user._id)}
|
|
98
|
+
onValueChange={() => handleUserSelect(user)}
|
|
99
|
+
disabled={selectedUsers.length === 20}
|
|
100
|
+
/>
|
|
101
|
+
<View>
|
|
102
|
+
<Label>{`${user.firstName} ${user.lastName}`}</Label>
|
|
103
|
+
{/* <LabelData>{user.xmppUsername}</LabelData> */}
|
|
104
|
+
</View>
|
|
105
|
+
</UserItem>
|
|
106
|
+
))}
|
|
107
|
+
</ScrollableContainer>
|
|
108
|
+
</View>
|
|
109
|
+
);
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
export default UsersList;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import React, { FC } from 'react';
|
|
2
|
+
import { IconButton } from './StyledComponents';
|
|
3
|
+
import { DownloadIcon } from '../../assets/icons';
|
|
4
|
+
import { RootState } from '../../roomStore';
|
|
5
|
+
import { useSelector } from 'react-redux';
|
|
6
|
+
|
|
7
|
+
interface ActionButtonProps
|
|
8
|
+
extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
9
|
+
icon?: React.ReactNode;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const ActionButton: FC<ActionButtonProps> = ({ icon, ...props }) => {
|
|
13
|
+
const config = useSelector(
|
|
14
|
+
(state: RootState) => state.chatSettingStore.config
|
|
15
|
+
);
|
|
16
|
+
|
|
17
|
+
return (
|
|
18
|
+
<IconButton
|
|
19
|
+
style={{
|
|
20
|
+
height: 40,
|
|
21
|
+
width: 40,
|
|
22
|
+
borderRadius: 8,
|
|
23
|
+
backgroundColor: '#fff',
|
|
24
|
+
border: `1px solid ${config?.colors?.primary || '#0052CD'}`,
|
|
25
|
+
...props.style,
|
|
26
|
+
}}
|
|
27
|
+
{...props}
|
|
28
|
+
>
|
|
29
|
+
{icon ? (
|
|
30
|
+
React.cloneElement(icon as React.ReactElement, {
|
|
31
|
+
style: { width: 40, height: 40 },
|
|
32
|
+
})
|
|
33
|
+
) : (
|
|
34
|
+
<DownloadIcon style={{ width: 40, height: 40 }} />
|
|
35
|
+
)}
|
|
36
|
+
</IconButton>
|
|
37
|
+
);
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export { ActionButton };
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
|
2
|
+
import {
|
|
3
|
+
View,
|
|
4
|
+
TouchableOpacity,
|
|
5
|
+
Text,
|
|
6
|
+
StyleSheet,
|
|
7
|
+
ScrollView,
|
|
8
|
+
} from 'react-native';
|
|
9
|
+
import RNFetchBlob from 'rn-fetch-blob';
|
|
10
|
+
|
|
11
|
+
const AudioMessage = ({ src }: { src: string }) => {
|
|
12
|
+
const [amplitudes, setAmplitudes] = useState<number[]>([]);
|
|
13
|
+
|
|
14
|
+
const fetchAndConvertAudio = async (url: string) => {
|
|
15
|
+
// try {
|
|
16
|
+
// const res = await RNFetchBlob.config({ fileCache: true }).fetch(
|
|
17
|
+
// "GET",
|
|
18
|
+
// url
|
|
19
|
+
// );
|
|
20
|
+
|
|
21
|
+
// console.log("res---!!!", res);
|
|
22
|
+
// const audioPath = res.path();
|
|
23
|
+
// console.log("Audio file downloaded to:", audioPath);
|
|
24
|
+
|
|
25
|
+
// const pcmPath = `${RNFetchBlob.fs.dirs.CacheDir}/audio.pcm`;
|
|
26
|
+
|
|
27
|
+
// await FFmpegKit.executeAsync(
|
|
28
|
+
// `-i ${audioPath} -f s16le -ar 44100 -ac 1 ${pcmPath}`,
|
|
29
|
+
// async (session) => {
|
|
30
|
+
// const returnCode = await session.getReturnCode();
|
|
31
|
+
// if (ReturnCode.isSuccess(returnCode)) {
|
|
32
|
+
// const pcmData = await RNFetchBlob.fs.readFile(pcmPath, "ascii");
|
|
33
|
+
// const amplitudes = pcmData
|
|
34
|
+
// .split("")
|
|
35
|
+
// .map((char) => char.charCodeAt(0));
|
|
36
|
+
// setAmplitudes(amplitudes.slice(0, 100)); // Ограничиваем количество баров
|
|
37
|
+
// } else {
|
|
38
|
+
// console.error("FFmpeg execution failed.");
|
|
39
|
+
// }
|
|
40
|
+
// }
|
|
41
|
+
// );
|
|
42
|
+
// } catch (error) {
|
|
43
|
+
// console.error("Error processing audio file:", error);
|
|
44
|
+
// }
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
useEffect(() => {
|
|
48
|
+
fetchAndConvertAudio(src);
|
|
49
|
+
}, [src]);
|
|
50
|
+
|
|
51
|
+
return (
|
|
52
|
+
<ScrollView horizontal contentContainerStyle={styles.waveformContainer}>
|
|
53
|
+
{amplitudes.map((amplitude, index) => (
|
|
54
|
+
<View
|
|
55
|
+
key={index}
|
|
56
|
+
style={[
|
|
57
|
+
styles.waveBar,
|
|
58
|
+
{
|
|
59
|
+
height: Math.max(amplitude, 1) * 2,
|
|
60
|
+
},
|
|
61
|
+
]}
|
|
62
|
+
/>
|
|
63
|
+
))}
|
|
64
|
+
</ScrollView>
|
|
65
|
+
);
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
export default AudioMessage;
|
|
69
|
+
|
|
70
|
+
const styles = StyleSheet.create({
|
|
71
|
+
waveformContainer: {
|
|
72
|
+
flexDirection: 'row',
|
|
73
|
+
alignItems: 'center',
|
|
74
|
+
paddingHorizontal: 5,
|
|
75
|
+
},
|
|
76
|
+
waveBar: {
|
|
77
|
+
width: 4,
|
|
78
|
+
backgroundColor: '#007AFF',
|
|
79
|
+
marginHorizontal: 1,
|
|
80
|
+
borderRadius: 2,
|
|
81
|
+
},
|
|
82
|
+
});
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import React, { ReactElement, ReactNode } from 'react';
|
|
2
|
+
import styled from 'styled-components/native';
|
|
3
|
+
import {
|
|
4
|
+
TouchableOpacity,
|
|
5
|
+
View,
|
|
6
|
+
Text,
|
|
7
|
+
StyleSheet,
|
|
8
|
+
ActivityIndicator,
|
|
9
|
+
ViewStyle,
|
|
10
|
+
PixelRatio,
|
|
11
|
+
} from 'react-native';
|
|
12
|
+
import Loader from './Loader';
|
|
13
|
+
import { getTintedColor } from '../../helpers/getTintedColor';
|
|
14
|
+
|
|
15
|
+
const CustomButton = styled(TouchableOpacity)<{
|
|
16
|
+
disabled: boolean;
|
|
17
|
+
backgroundColor?: string;
|
|
18
|
+
unstyled?: boolean;
|
|
19
|
+
variant?: 'default' | 'filled' | 'outlined';
|
|
20
|
+
}>`
|
|
21
|
+
border-width: ${({ variant }) => (variant === 'outlined' ? 1 : 0)}px;
|
|
22
|
+
border-color: ${({ backgroundColor }) => backgroundColor || '#0052CD'};
|
|
23
|
+
border-radius: 20px;
|
|
24
|
+
background-color: ${({ variant, backgroundColor }) =>
|
|
25
|
+
variant === 'filled' ? backgroundColor || '#0052CD' : 'transparent'};
|
|
26
|
+
flex-direction: row;
|
|
27
|
+
justify-content: center;
|
|
28
|
+
align-items: center;
|
|
29
|
+
height: 40px;
|
|
30
|
+
width: 40px;
|
|
31
|
+
margin: 0 10px;
|
|
32
|
+
padding-horizontal: 8px;
|
|
33
|
+
opacity: ${({ disabled }) => (disabled ? 0.6 : 1)};
|
|
34
|
+
`;
|
|
35
|
+
|
|
36
|
+
const ButtonText = styled.Text<{
|
|
37
|
+
variant?: 'default' | 'filled' | 'outlined';
|
|
38
|
+
backgroundColor?: string;
|
|
39
|
+
}>`
|
|
40
|
+
color: ${({ variant, backgroundColor }) =>
|
|
41
|
+
variant === 'filled' ? '#FFFFFF' : backgroundColor || '#0052CD'};
|
|
42
|
+
font-size: ${PixelRatio.getFontScale() * 14}px;
|
|
43
|
+
font-weight: bold;
|
|
44
|
+
`;
|
|
45
|
+
|
|
46
|
+
interface ButtonProps {
|
|
47
|
+
text?: string | ReactElement;
|
|
48
|
+
EndIcon?: ReactNode;
|
|
49
|
+
StartIcon?: ReactNode;
|
|
50
|
+
loading?: boolean;
|
|
51
|
+
disabled?: boolean;
|
|
52
|
+
unstyled?: boolean;
|
|
53
|
+
variant?: 'default' | 'filled' | 'outlined';
|
|
54
|
+
backgroundColor?: string;
|
|
55
|
+
color?: string;
|
|
56
|
+
style?: ViewStyle;
|
|
57
|
+
onPress?: () => void;
|
|
58
|
+
children?: React.ReactNode;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const Button: React.FC<ButtonProps> = ({
|
|
62
|
+
text,
|
|
63
|
+
EndIcon,
|
|
64
|
+
loading = false,
|
|
65
|
+
disabled = false,
|
|
66
|
+
unstyled = false,
|
|
67
|
+
variant = 'default',
|
|
68
|
+
backgroundColor,
|
|
69
|
+
onPress,
|
|
70
|
+
StartIcon,
|
|
71
|
+
style: containerStyle,
|
|
72
|
+
color,
|
|
73
|
+
children,
|
|
74
|
+
}) => {
|
|
75
|
+
return (
|
|
76
|
+
<CustomButton
|
|
77
|
+
style={[containerStyle]}
|
|
78
|
+
disabled={disabled || loading}
|
|
79
|
+
onPress={onPress}
|
|
80
|
+
variant={variant}
|
|
81
|
+
backgroundColor={backgroundColor}
|
|
82
|
+
>
|
|
83
|
+
{loading && <Loader size={24} />}
|
|
84
|
+
{!loading && StartIcon && <View style={styles.icon}>{StartIcon}</View>}
|
|
85
|
+
{!loading &&
|
|
86
|
+
(children || (
|
|
87
|
+
<ButtonText
|
|
88
|
+
style={[{ color: color || 'black' }]}
|
|
89
|
+
variant={variant}
|
|
90
|
+
backgroundColor={backgroundColor}
|
|
91
|
+
>
|
|
92
|
+
{text}
|
|
93
|
+
</ButtonText>
|
|
94
|
+
))}
|
|
95
|
+
{!loading && EndIcon && <View style={styles.icon}>{EndIcon}</View>}
|
|
96
|
+
</CustomButton>
|
|
97
|
+
);
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
const styles = StyleSheet.create({
|
|
101
|
+
icon: {
|
|
102
|
+
marginHorizontal: 4,
|
|
103
|
+
// maxWidth: '20%',
|
|
104
|
+
},
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
export default Button;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import styled from 'styled-components/native';
|
|
3
|
+
import { Line } from './StyledComponents';
|
|
4
|
+
import { Text } from 'react-native';
|
|
5
|
+
|
|
6
|
+
interface DateLabelProps {
|
|
7
|
+
date: Date;
|
|
8
|
+
colors?: { primary?: string; secondary?: string };
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const Container = styled.View`
|
|
12
|
+
flex-direction: row;
|
|
13
|
+
align-items: center;
|
|
14
|
+
justify-content: center;
|
|
15
|
+
width: 100%;
|
|
16
|
+
background-color: transparent;
|
|
17
|
+
gap: 16px;
|
|
18
|
+
margin: 16px 0;
|
|
19
|
+
`;
|
|
20
|
+
|
|
21
|
+
export const StyledDateLabel = styled.View<{
|
|
22
|
+
secondary?: string;
|
|
23
|
+
}>`
|
|
24
|
+
margin: 0;
|
|
25
|
+
border-radius: 118px;
|
|
26
|
+
padding: 5px 8px;
|
|
27
|
+
flex-direction: row;
|
|
28
|
+
align-items: center;
|
|
29
|
+
justify-content: center;
|
|
30
|
+
background-color: ${(props) => '#e7edf9'};
|
|
31
|
+
`;
|
|
32
|
+
|
|
33
|
+
export const StyledDateText = styled.Text<{ primary?: string }>`
|
|
34
|
+
color: ${(props) => '#0052cd'};
|
|
35
|
+
font-size: 12px;
|
|
36
|
+
font-weight: 400;
|
|
37
|
+
line-height: 14px;
|
|
38
|
+
white-space: nowrap;
|
|
39
|
+
`;
|
|
40
|
+
|
|
41
|
+
const DateLabel: React.FC<DateLabelProps> = ({ date, colors }) => {
|
|
42
|
+
const today = new Date();
|
|
43
|
+
const yesterday = new Date(today);
|
|
44
|
+
yesterday.setDate(today.getDate() - 1);
|
|
45
|
+
|
|
46
|
+
const sameDay = (d1: Date, d2: Date) =>
|
|
47
|
+
d1.getFullYear() === d2.getFullYear() &&
|
|
48
|
+
d1.getMonth() === d2.getMonth() &&
|
|
49
|
+
d1.getDate() === d2.getDate();
|
|
50
|
+
|
|
51
|
+
const sameYear = (d1: Date, d2: Date) =>
|
|
52
|
+
d1.getFullYear() === d2.getFullYear();
|
|
53
|
+
|
|
54
|
+
let label: string;
|
|
55
|
+
if (sameDay(date, today)) {
|
|
56
|
+
label = 'Today';
|
|
57
|
+
} else if (sameDay(date, yesterday)) {
|
|
58
|
+
label = 'Yesterday';
|
|
59
|
+
} else {
|
|
60
|
+
const options: Intl.DateTimeFormatOptions = sameYear(date, today)
|
|
61
|
+
? { month: 'long', day: 'numeric' }
|
|
62
|
+
: { month: 'long', day: 'numeric', year: 'numeric' };
|
|
63
|
+
label = date.toLocaleDateString('en-US', options);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
return (
|
|
67
|
+
<Container>
|
|
68
|
+
<Line />
|
|
69
|
+
<StyledDateLabel secondary={colors?.secondary}>
|
|
70
|
+
<StyledDateText primary={colors?.primary}>{label}</StyledDateText>
|
|
71
|
+
</StyledDateLabel>
|
|
72
|
+
<Line />
|
|
73
|
+
</Container>
|
|
74
|
+
);
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
export default DateLabel;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/** @format */
|
|
2
|
+
|
|
3
|
+
import React, { useEffect, useRef } from 'react';
|
|
4
|
+
import { Animated, Easing, View, StyleSheet } from 'react-native';
|
|
5
|
+
|
|
6
|
+
interface LoaderProps {
|
|
7
|
+
size?: number;
|
|
8
|
+
color?: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export default function Loader({ size = 32, color = '#3498db' }: LoaderProps) {
|
|
12
|
+
const spinValue = useRef(new Animated.Value(0)).current;
|
|
13
|
+
|
|
14
|
+
useEffect(() => {
|
|
15
|
+
const spinAnimation = Animated.loop(
|
|
16
|
+
Animated.timing(spinValue, {
|
|
17
|
+
toValue: 1,
|
|
18
|
+
duration: 1000,
|
|
19
|
+
easing: Easing.linear,
|
|
20
|
+
useNativeDriver: true,
|
|
21
|
+
})
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
spinAnimation.start();
|
|
25
|
+
|
|
26
|
+
return () => {
|
|
27
|
+
spinAnimation.stop();
|
|
28
|
+
};
|
|
29
|
+
}, [spinValue]);
|
|
30
|
+
|
|
31
|
+
const spin = spinValue.interpolate({
|
|
32
|
+
inputRange: [0, 1],
|
|
33
|
+
outputRange: ['0deg', '360deg'],
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
const borderWidth = size ? size / 8 : 4;
|
|
37
|
+
|
|
38
|
+
return (
|
|
39
|
+
<View style={styles.container}>
|
|
40
|
+
<Animated.View
|
|
41
|
+
style={[
|
|
42
|
+
{
|
|
43
|
+
width: size,
|
|
44
|
+
height: size,
|
|
45
|
+
borderRadius: size / 2,
|
|
46
|
+
borderWidth: borderWidth,
|
|
47
|
+
borderTopColor: color,
|
|
48
|
+
borderRightColor: 'transparent',
|
|
49
|
+
borderBottomColor: 'transparent',
|
|
50
|
+
borderLeftColor: 'transparent',
|
|
51
|
+
transform: [{ rotate: spin }],
|
|
52
|
+
},
|
|
53
|
+
]}
|
|
54
|
+
/>
|
|
55
|
+
</View>
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const styles = StyleSheet.create({
|
|
60
|
+
container: {
|
|
61
|
+
justifyContent: 'center',
|
|
62
|
+
alignItems: 'center',
|
|
63
|
+
padding: 8,
|
|
64
|
+
},
|
|
65
|
+
});
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { View } from 'react-native';
|
|
2
|
+
import {
|
|
3
|
+
MediaContainer,
|
|
4
|
+
MediaImage,
|
|
5
|
+
} from './StyledInputComponents/StyledInputComponents';
|
|
6
|
+
import { FileIcon } from '../../assets/icons';
|
|
7
|
+
import { RemoveButton, RemoveButtonText } from './StyledComponents';
|
|
8
|
+
import { FC } from 'react';
|
|
9
|
+
import { MediaFile } from '../../types/types';
|
|
10
|
+
|
|
11
|
+
interface MediaFilePreviewProps {
|
|
12
|
+
filePreviews: MediaFile[];
|
|
13
|
+
handleRemoveImage: (index: number) => void;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export const MediaFilePreview: FC<MediaFilePreviewProps> = ({
|
|
17
|
+
filePreviews,
|
|
18
|
+
handleRemoveImage,
|
|
19
|
+
}) => {
|
|
20
|
+
return (
|
|
21
|
+
<MediaContainer>
|
|
22
|
+
{filePreviews.map((file, index) => {
|
|
23
|
+
const isImageOrVideo =
|
|
24
|
+
file.type?.startsWith('image') || file.type?.startsWith('video');
|
|
25
|
+
return (
|
|
26
|
+
<View key={`${file.name}_${index}`}>
|
|
27
|
+
{isImageOrVideo ? (
|
|
28
|
+
<MediaImage source={{ uri: file.uri }} />
|
|
29
|
+
) : (
|
|
30
|
+
<View style={{ width: 70, height: 70, borderRadius: 8 }}>
|
|
31
|
+
<FileIcon width={70} height={70} />
|
|
32
|
+
</View>
|
|
33
|
+
)}
|
|
34
|
+
<RemoveButton onPress={() => handleRemoveImage(index)}>
|
|
35
|
+
<RemoveButtonText>×</RemoveButtonText>
|
|
36
|
+
</RemoveButton>
|
|
37
|
+
</View>
|
|
38
|
+
);
|
|
39
|
+
})}
|
|
40
|
+
</MediaContainer>
|
|
41
|
+
);
|
|
42
|
+
};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/** @format */
|
|
2
|
+
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { View, Modal, StyleSheet, ViewStyle, Text } from 'react-native';
|
|
5
|
+
|
|
6
|
+
interface OverlayProps {
|
|
7
|
+
children?: React.ReactNode;
|
|
8
|
+
visible?: boolean;
|
|
9
|
+
style?: ViewStyle;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export const Overlay = ({ children, visible, style }: OverlayProps) => (
|
|
13
|
+
<Modal
|
|
14
|
+
transparent={true}
|
|
15
|
+
animationType="fade"
|
|
16
|
+
visible={visible}
|
|
17
|
+
onRequestClose={() => {
|
|
18
|
+
// Implement logic to close the modal if needed
|
|
19
|
+
}}
|
|
20
|
+
>
|
|
21
|
+
<View style={[styles.modal, style]}>{children}</View>;
|
|
22
|
+
</Modal>
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
export const StyledModal = ({
|
|
26
|
+
children,
|
|
27
|
+
style,
|
|
28
|
+
}: {
|
|
29
|
+
children: React.ReactNode;
|
|
30
|
+
style?: ViewStyle;
|
|
31
|
+
}) => {
|
|
32
|
+
return <Text style={[style]}>{children}</Text>;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
const styles = StyleSheet.create({
|
|
36
|
+
overlay: {
|
|
37
|
+
backgroundColor: 'rgba(0, 0, 0, 0.75)',
|
|
38
|
+
flex: 1,
|
|
39
|
+
justifyContent: 'center',
|
|
40
|
+
alignItems: 'center',
|
|
41
|
+
zIndex: 999, // Use zIndex for stacking, although this won't work in all cases, Android uses elevation.
|
|
42
|
+
elevation: 999, // Added to give the overlay layer a higher stacking context on Android.
|
|
43
|
+
},
|
|
44
|
+
modal: {
|
|
45
|
+
flex: 1,
|
|
46
|
+
width: '100%',
|
|
47
|
+
height: '100%',
|
|
48
|
+
backgroundColor: 'white',
|
|
49
|
+
padding: 0,
|
|
50
|
+
display: 'flex',
|
|
51
|
+
justifyContent: 'center',
|
|
52
|
+
alignItems: 'center',
|
|
53
|
+
},
|
|
54
|
+
});
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { Container } from './StyledInputComponents/MediaComponents';
|
|
3
|
+
import { useDispatch } from 'react-redux';
|
|
4
|
+
import {
|
|
5
|
+
setActiveFile,
|
|
6
|
+
setActiveModal,
|
|
7
|
+
} from '../../roomStore/chatSettingsSlice';
|
|
8
|
+
import { MODAL_TYPES } from '../../helpers/constants/MODAL_TYPES';
|
|
9
|
+
import { ActivityIndicator, Image, TouchableOpacity } from 'react-native';
|
|
10
|
+
interface CustomMessageImageProps {
|
|
11
|
+
fileURL: string;
|
|
12
|
+
fileName: string;
|
|
13
|
+
mimetype: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const CustomMessageImage: React.FC<CustomMessageImageProps> = ({
|
|
17
|
+
fileURL,
|
|
18
|
+
fileName,
|
|
19
|
+
mimetype,
|
|
20
|
+
}) => {
|
|
21
|
+
const [error, setError] = useState(false);
|
|
22
|
+
const [loading, setLoading] = useState(true);
|
|
23
|
+
|
|
24
|
+
const dispatch = useDispatch();
|
|
25
|
+
|
|
26
|
+
const handleOpen = () => {
|
|
27
|
+
dispatch(setActiveFile({ fileName, fileURL, mimetype }));
|
|
28
|
+
dispatch(setActiveModal(MODAL_TYPES.FILE_PREVIEW));
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
return (
|
|
32
|
+
<Container>
|
|
33
|
+
<TouchableOpacity onPress={handleOpen}>
|
|
34
|
+
{loading && <ActivityIndicator size="small" color="#0052CD" />}
|
|
35
|
+
<Image
|
|
36
|
+
src={
|
|
37
|
+
fileURL ||
|
|
38
|
+
'https://as2.ftcdn.net/v2/jpg/02/51/95/53/1000_F_251955356_FAQH0U1y1TZw3ZcdPGybwUkH90a3VAhb.jpg'
|
|
39
|
+
}
|
|
40
|
+
style={{
|
|
41
|
+
borderRadius: 16,
|
|
42
|
+
width: 150,
|
|
43
|
+
height: 200,
|
|
44
|
+
}}
|
|
45
|
+
onError={() => setError(true)}
|
|
46
|
+
onLoadEnd={() => setLoading(false)}
|
|
47
|
+
resizeMode="cover"
|
|
48
|
+
/>
|
|
49
|
+
</TouchableOpacity>
|
|
50
|
+
</Container>
|
|
51
|
+
);
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export default CustomMessageImage;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import styled from 'styled-components/native';
|
|
3
|
+
import { Line } from './StyledComponents';
|
|
4
|
+
|
|
5
|
+
const Container = styled.View`
|
|
6
|
+
flex-direction: row;
|
|
7
|
+
align-items: center;
|
|
8
|
+
justify-content: center;
|
|
9
|
+
width: 100%;
|
|
10
|
+
background-color: transparent;
|
|
11
|
+
gap: 16px;
|
|
12
|
+
`;
|
|
13
|
+
|
|
14
|
+
export const StyledLabel = styled.View`
|
|
15
|
+
margin: 0;
|
|
16
|
+
border-radius: 118px;
|
|
17
|
+
padding: 5px 8px;
|
|
18
|
+
flex-direction: row;
|
|
19
|
+
align-items: center;
|
|
20
|
+
justify-content: center;
|
|
21
|
+
background-color: #3f3f3f;
|
|
22
|
+
height: 24px;
|
|
23
|
+
white-space: nowrap;
|
|
24
|
+
margin: 10px 0px;
|
|
25
|
+
`;
|
|
26
|
+
|
|
27
|
+
export const StyledLabelText = styled.Text<{ color?: string }>`
|
|
28
|
+
color: ${(props) => (props?.color ? props?.color : '#0052CD')};
|
|
29
|
+
font-size: 12px;
|
|
30
|
+
line-height: 14px;
|
|
31
|
+
font-weight: 400;
|
|
32
|
+
`;
|
|
33
|
+
|
|
34
|
+
interface NewMessageLabelProps {
|
|
35
|
+
color?: string;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const NewMessageLabel: React.FC<NewMessageLabelProps> = ({ color }) => {
|
|
39
|
+
return (
|
|
40
|
+
<Container>
|
|
41
|
+
<Line />
|
|
42
|
+
<StyledLabel>
|
|
43
|
+
<StyledLabelText color={color}>New messages</StyledLabelText>
|
|
44
|
+
</StyledLabel>
|
|
45
|
+
<Line />
|
|
46
|
+
</Container>
|
|
47
|
+
);
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export default NewMessageLabel;
|