@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,87 @@
|
|
|
1
|
+
import { Picker } from 'emoji-mart';
|
|
2
|
+
import styled from 'styled-components/native';
|
|
3
|
+
|
|
4
|
+
export const ContainerInteractions = styled.View`
|
|
5
|
+
position: absolute;
|
|
6
|
+
z-index: 1000;
|
|
7
|
+
`;
|
|
8
|
+
|
|
9
|
+
export const ReactionContainer = styled.View`
|
|
10
|
+
max-width: 245px;
|
|
11
|
+
display: flex;
|
|
12
|
+
margin-bottom: 16px;
|
|
13
|
+
gap: 8px;
|
|
14
|
+
padding: 8px;
|
|
15
|
+
justify-content: space-around;
|
|
16
|
+
background-color: #ffffff;
|
|
17
|
+
border-radius: 12px;
|
|
18
|
+
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
|
19
|
+
`;
|
|
20
|
+
|
|
21
|
+
export const ReactionBadge = styled.Text`
|
|
22
|
+
font-size: 22px;
|
|
23
|
+
cursor: pointer;
|
|
24
|
+
transition: transform 0.2s ease;
|
|
25
|
+
|
|
26
|
+
&:hover {
|
|
27
|
+
transform: scale(1.2);
|
|
28
|
+
}
|
|
29
|
+
`;
|
|
30
|
+
|
|
31
|
+
export const ArrowButton = styled.View<{ isRotated: boolean }>`
|
|
32
|
+
display: flex;
|
|
33
|
+
align-items: center;
|
|
34
|
+
justify-content: center;
|
|
35
|
+
cursor: pointer;
|
|
36
|
+
transition: transform 0.3s ease;
|
|
37
|
+
|
|
38
|
+
transform: ${({ isRotated }) =>
|
|
39
|
+
isRotated ? 'rotate(180deg)' : 'rotate(0deg)'};
|
|
40
|
+
`;
|
|
41
|
+
|
|
42
|
+
export const StyledPicker = styled(Picker)`
|
|
43
|
+
.emoji-mart-preview {
|
|
44
|
+
display: none;
|
|
45
|
+
}
|
|
46
|
+
`;
|
|
47
|
+
|
|
48
|
+
export const ContextMenu = styled.View`
|
|
49
|
+
position: absolute;
|
|
50
|
+
z-index: 1000;
|
|
51
|
+
background-color: white;
|
|
52
|
+
border-radius: 8px;
|
|
53
|
+
elevation: 4;
|
|
54
|
+
shadow-color: #121219;
|
|
55
|
+
shadow-offset: 0px 4px;
|
|
56
|
+
shadow-opacity: 0.1;
|
|
57
|
+
shadow-radius: 6px;
|
|
58
|
+
padding: 8px 16px;
|
|
59
|
+
display: flex;
|
|
60
|
+
flex-direction: column;
|
|
61
|
+
`;
|
|
62
|
+
|
|
63
|
+
export const MenuItem = styled.Pressable`
|
|
64
|
+
padding: 8px 8px;
|
|
65
|
+
min-width: 150px;
|
|
66
|
+
flex-direction: row;
|
|
67
|
+
justify-content: space-between;
|
|
68
|
+
align-items: center;
|
|
69
|
+
`;
|
|
70
|
+
|
|
71
|
+
export const Overlay = styled.Pressable`
|
|
72
|
+
position: absolute;
|
|
73
|
+
top: 0;
|
|
74
|
+
left: 0;
|
|
75
|
+
right: 0;
|
|
76
|
+
bottom: 0;
|
|
77
|
+
z-index: 999;
|
|
78
|
+
background: transparent;
|
|
79
|
+
`;
|
|
80
|
+
|
|
81
|
+
export const Delimeter = styled.View`
|
|
82
|
+
border: 1px solid #0052cd0d;
|
|
83
|
+
`;
|
|
84
|
+
|
|
85
|
+
// export const Delimeter = styled.View`
|
|
86
|
+
// border: 1px solid var(--colors-background-bg-prymary-5, #0052cd0d);
|
|
87
|
+
// `;
|
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
import React, { useState, useEffect, ReactElement, useRef } from 'react';
|
|
2
|
+
import {
|
|
3
|
+
View,
|
|
4
|
+
TouchableOpacity,
|
|
5
|
+
Text,
|
|
6
|
+
StyleSheet,
|
|
7
|
+
Animated,
|
|
8
|
+
TextStyle,
|
|
9
|
+
TouchableWithoutFeedback,
|
|
10
|
+
Modal,
|
|
11
|
+
} from 'react-native';
|
|
12
|
+
import { BurgerMenuIcon } from '../../assets/icons';
|
|
13
|
+
import { IConfig } from '../../types/types';
|
|
14
|
+
import Button from '../styled/Button';
|
|
15
|
+
|
|
16
|
+
const positionMenu = {
|
|
17
|
+
right: { top: 95, right: 10 },
|
|
18
|
+
left: { top: 95, left: 0 },
|
|
19
|
+
rightBottom: { bottom: 95, right: 10 },
|
|
20
|
+
leftBottom: { bottom: 95, left: 10 },
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export interface MenuOption {
|
|
24
|
+
label: string;
|
|
25
|
+
icon: React.ReactNode;
|
|
26
|
+
onClick: () => void;
|
|
27
|
+
styles?: TextStyle;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
interface DropdownMenuProps {
|
|
31
|
+
options: MenuOption[];
|
|
32
|
+
onClose?: any;
|
|
33
|
+
openButton?: ReactElement | ((onPress: () => void) => ReactElement);
|
|
34
|
+
position?: 'left' | 'right' | 'rightBottom' | 'leftBottom';
|
|
35
|
+
config?: IConfig;
|
|
36
|
+
menuIcon?: React.ReactNode;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const DropdownMenu: React.FC<DropdownMenuProps> = ({
|
|
40
|
+
options,
|
|
41
|
+
openButton,
|
|
42
|
+
position = 'right',
|
|
43
|
+
menuIcon,
|
|
44
|
+
config,
|
|
45
|
+
onClose,
|
|
46
|
+
}) => {
|
|
47
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
48
|
+
const menuRef = useRef<View>(null);
|
|
49
|
+
|
|
50
|
+
const fadeAnim = useRef(new Animated.Value(0)).current;
|
|
51
|
+
const translateYAnim = useRef(new Animated.Value(-10)).current;
|
|
52
|
+
|
|
53
|
+
const toggleMenu = () => {
|
|
54
|
+
setIsOpen((prev) => {
|
|
55
|
+
return !prev;
|
|
56
|
+
});
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
useEffect(() => {
|
|
60
|
+
if (isOpen) {
|
|
61
|
+
fadeAnim.setValue(1);
|
|
62
|
+
translateYAnim.setValue(0);
|
|
63
|
+
Animated.parallel([
|
|
64
|
+
Animated.timing(fadeAnim, {
|
|
65
|
+
toValue: 1,
|
|
66
|
+
duration: 200,
|
|
67
|
+
useNativeDriver: true,
|
|
68
|
+
}),
|
|
69
|
+
Animated.timing(translateYAnim, {
|
|
70
|
+
toValue: 0,
|
|
71
|
+
duration: 200,
|
|
72
|
+
useNativeDriver: true,
|
|
73
|
+
}),
|
|
74
|
+
]).start();
|
|
75
|
+
} else {
|
|
76
|
+
Animated.timing(fadeAnim, {
|
|
77
|
+
toValue: 0,
|
|
78
|
+
duration: 200,
|
|
79
|
+
useNativeDriver: true,
|
|
80
|
+
}).start();
|
|
81
|
+
}
|
|
82
|
+
}, [isOpen]);
|
|
83
|
+
|
|
84
|
+
return (
|
|
85
|
+
<View style={styles.container}>
|
|
86
|
+
{openButton ? (
|
|
87
|
+
typeof openButton === 'function' ? (
|
|
88
|
+
openButton(toggleMenu)
|
|
89
|
+
) : (
|
|
90
|
+
React.cloneElement(openButton as React.ReactElement<any>, {
|
|
91
|
+
onPress: toggleMenu,
|
|
92
|
+
key: 'dropdown-button',
|
|
93
|
+
})
|
|
94
|
+
)
|
|
95
|
+
) : (
|
|
96
|
+
// <TouchableOpacity onPress={toggleMenu} style={styles.button}>
|
|
97
|
+
// {menuIcon ?? <Text style={styles.icon}>☰</Text>}
|
|
98
|
+
// </TouchableOpacity>
|
|
99
|
+
<Button
|
|
100
|
+
style={{
|
|
101
|
+
padding: 8,
|
|
102
|
+
borderRadius: 16,
|
|
103
|
+
backgroundColor: 'transparent',
|
|
104
|
+
}}
|
|
105
|
+
color="black"
|
|
106
|
+
unstyled
|
|
107
|
+
EndIcon={<BurgerMenuIcon color={config?.colors?.primary} />}
|
|
108
|
+
onPress={toggleMenu}
|
|
109
|
+
/>
|
|
110
|
+
)}
|
|
111
|
+
{isOpen && (
|
|
112
|
+
<Modal
|
|
113
|
+
transparent
|
|
114
|
+
visible={isOpen}
|
|
115
|
+
animationType="fade"
|
|
116
|
+
onRequestClose={() => {
|
|
117
|
+
setIsOpen(false);
|
|
118
|
+
}}
|
|
119
|
+
>
|
|
120
|
+
<TouchableOpacity
|
|
121
|
+
style={styles.overlay}
|
|
122
|
+
activeOpacity={1}
|
|
123
|
+
onPress={() => {
|
|
124
|
+
setIsOpen(false);
|
|
125
|
+
onClose && onClose();
|
|
126
|
+
}}
|
|
127
|
+
>
|
|
128
|
+
<View style={styles.menuContainer} pointerEvents="box-none">
|
|
129
|
+
<TouchableWithoutFeedback onPress={() => {}}>
|
|
130
|
+
<Animated.View
|
|
131
|
+
ref={menuRef}
|
|
132
|
+
style={[
|
|
133
|
+
styles.menu,
|
|
134
|
+
positionMenu[position],
|
|
135
|
+
{
|
|
136
|
+
opacity: fadeAnim,
|
|
137
|
+
transform: [{ translateY: translateYAnim }],
|
|
138
|
+
},
|
|
139
|
+
]}
|
|
140
|
+
>
|
|
141
|
+
{options.map((option, index) => (
|
|
142
|
+
<View key={`${option.label}-${index}`} style={styles.menuItemWrapper}>
|
|
143
|
+
<TouchableOpacity
|
|
144
|
+
style={styles.menuItem}
|
|
145
|
+
onPress={async () => {
|
|
146
|
+
setIsOpen(false);
|
|
147
|
+
onClose && onClose();
|
|
148
|
+
setTimeout(() => {
|
|
149
|
+
try {
|
|
150
|
+
option.onClick();
|
|
151
|
+
} catch (error) {
|
|
152
|
+
console.error('Error in option.onClick:', error);
|
|
153
|
+
}
|
|
154
|
+
}, 200);
|
|
155
|
+
}}
|
|
156
|
+
>
|
|
157
|
+
<View
|
|
158
|
+
style={{
|
|
159
|
+
width: 22,
|
|
160
|
+
alignItems: 'center',
|
|
161
|
+
}}
|
|
162
|
+
>
|
|
163
|
+
{option.icon}
|
|
164
|
+
</View>
|
|
165
|
+
<Text style={[styles.label, option?.styles]}>
|
|
166
|
+
{option.label}
|
|
167
|
+
</Text>
|
|
168
|
+
</TouchableOpacity>
|
|
169
|
+
{index < options.length - 1 && (
|
|
170
|
+
<View style={styles.divider} />
|
|
171
|
+
)}
|
|
172
|
+
</View>
|
|
173
|
+
))}
|
|
174
|
+
</Animated.View>
|
|
175
|
+
</TouchableWithoutFeedback>
|
|
176
|
+
</View>
|
|
177
|
+
</TouchableOpacity>
|
|
178
|
+
</Modal>
|
|
179
|
+
)}
|
|
180
|
+
</View>
|
|
181
|
+
);
|
|
182
|
+
};
|
|
183
|
+
|
|
184
|
+
export default DropdownMenu;
|
|
185
|
+
|
|
186
|
+
const styles = StyleSheet.create({
|
|
187
|
+
container: {
|
|
188
|
+
position: 'relative',
|
|
189
|
+
zIndex: 100,
|
|
190
|
+
},
|
|
191
|
+
overlay: {
|
|
192
|
+
flex: 1,
|
|
193
|
+
width: '100%',
|
|
194
|
+
height: '100%',
|
|
195
|
+
backgroundColor: 'rgba(0, 0, 0, 0.3)',
|
|
196
|
+
},
|
|
197
|
+
menuContainer: {
|
|
198
|
+
flex: 1,
|
|
199
|
+
width: '100%',
|
|
200
|
+
height: '100%',
|
|
201
|
+
position: 'relative',
|
|
202
|
+
},
|
|
203
|
+
button: {
|
|
204
|
+
padding: 10,
|
|
205
|
+
backgroundColor: '#0052CD',
|
|
206
|
+
borderRadius: 8,
|
|
207
|
+
},
|
|
208
|
+
icon: {
|
|
209
|
+
color: '#fff',
|
|
210
|
+
fontSize: 24,
|
|
211
|
+
},
|
|
212
|
+
menu: {
|
|
213
|
+
position: 'absolute',
|
|
214
|
+
backgroundColor: '#fcfcfc',
|
|
215
|
+
borderRadius: 8,
|
|
216
|
+
paddingHorizontal: 16,
|
|
217
|
+
paddingVertical: 8,
|
|
218
|
+
minWidth: 150,
|
|
219
|
+
zIndex: 1000,
|
|
220
|
+
elevation: 10, // Android
|
|
221
|
+
shadowColor: '#121219', // iOS
|
|
222
|
+
shadowOffset: { width: 0, height: 4 },
|
|
223
|
+
shadowOpacity: 0.3,
|
|
224
|
+
shadowRadius: 6,
|
|
225
|
+
},
|
|
226
|
+
menuItemWrapper: {
|
|
227
|
+
display: 'flex',
|
|
228
|
+
flexDirection: 'column',
|
|
229
|
+
},
|
|
230
|
+
menuItem: {
|
|
231
|
+
flexDirection: 'row',
|
|
232
|
+
alignItems: 'center',
|
|
233
|
+
padding: 8,
|
|
234
|
+
},
|
|
235
|
+
label: {
|
|
236
|
+
fontSize: 16,
|
|
237
|
+
marginLeft: 10,
|
|
238
|
+
},
|
|
239
|
+
divider: {
|
|
240
|
+
height: 1,
|
|
241
|
+
width: '100%',
|
|
242
|
+
backgroundColor: '#0052cd0d',
|
|
243
|
+
},
|
|
244
|
+
});
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import React, { forwardRef } from 'react';
|
|
2
|
+
|
|
3
|
+
import styled from 'styled-components/native';
|
|
4
|
+
import { MessageProps } from '../../types/types';
|
|
5
|
+
import { View } from 'react-native';
|
|
6
|
+
|
|
7
|
+
export const MessageContainer = styled.View<{ isUser: boolean }>`
|
|
8
|
+
display: flex;
|
|
9
|
+
flex-direction: ${(props) => (!props.isUser ? 'row' : 'row-reverse')};
|
|
10
|
+
align-items: center;
|
|
11
|
+
margin: 10px 0;
|
|
12
|
+
width: 100%;
|
|
13
|
+
`;
|
|
14
|
+
|
|
15
|
+
export const MessageBubble = styled.View<{ isUser: boolean }>`
|
|
16
|
+
background-color: ${(props) => (!props.isUser ? '#f1f0f0' : '#0052CD')};
|
|
17
|
+
color: ${(props) => (!props.isUser ? '#000' : '#fff')};
|
|
18
|
+
border-radius: 12px;
|
|
19
|
+
padding: 10px;
|
|
20
|
+
max-width: 60%;
|
|
21
|
+
`;
|
|
22
|
+
|
|
23
|
+
export const MessageText = styled.View`
|
|
24
|
+
margin: 0;
|
|
25
|
+
flex-wrap: wrap;
|
|
26
|
+
`;
|
|
27
|
+
|
|
28
|
+
export const UserName = styled.Text<{ isUser: boolean; color?: string }>`
|
|
29
|
+
font-weight: bold;
|
|
30
|
+
color: ${(props) =>
|
|
31
|
+
props.color ? props.color : props.isUser ? '#0052CD' : '#333'};
|
|
32
|
+
margin-right: 8px;
|
|
33
|
+
`;
|
|
34
|
+
|
|
35
|
+
export const MessageTimestamp = styled.Text`
|
|
36
|
+
font-size: 13px;
|
|
37
|
+
color: #999;
|
|
38
|
+
margin-left: 8px;
|
|
39
|
+
`;
|
|
40
|
+
|
|
41
|
+
export const MessagePhoto = styled.Image`
|
|
42
|
+
max-width: 100%;
|
|
43
|
+
border-radius: 8px;
|
|
44
|
+
margin-top: 8px;
|
|
45
|
+
`;
|
|
46
|
+
|
|
47
|
+
export const MessagePhotoContainer = styled.Text`
|
|
48
|
+
max-width: 100px;
|
|
49
|
+
margin: 0;
|
|
50
|
+
`;
|
|
51
|
+
|
|
52
|
+
export const SystemMessage = styled.Text`
|
|
53
|
+
background-color: #e0e0e0;
|
|
54
|
+
color: #555;
|
|
55
|
+
text-align: center;
|
|
56
|
+
padding: 8px;
|
|
57
|
+
border-radius: 8px;
|
|
58
|
+
margin: 10px 0;
|
|
59
|
+
max-width: 60%;
|
|
60
|
+
`;
|
|
61
|
+
|
|
62
|
+
export const SystemMessageText = styled.Text`
|
|
63
|
+
margin: 0;
|
|
64
|
+
font-size: 14px;
|
|
65
|
+
color: #333;
|
|
66
|
+
`;
|
|
67
|
+
|
|
68
|
+
const CustomMessageExample = forwardRef<View, MessageProps>(
|
|
69
|
+
({ message, isUser }, ref) => {
|
|
70
|
+
return (
|
|
71
|
+
<View
|
|
72
|
+
ref={ref}
|
|
73
|
+
style={[
|
|
74
|
+
{
|
|
75
|
+
flexDirection: isUser ? 'row-reverse' : 'row',
|
|
76
|
+
alignItems: 'center',
|
|
77
|
+
marginVertical: 10,
|
|
78
|
+
width: '100%',
|
|
79
|
+
},
|
|
80
|
+
]}
|
|
81
|
+
>
|
|
82
|
+
<MessageBubble isUser={isUser}>
|
|
83
|
+
<UserName isUser={isUser}>{message.user.name}</UserName>
|
|
84
|
+
<MessageText>{message.body}</MessageText>
|
|
85
|
+
<MessageTimestamp>{message.timestamp}</MessageTimestamp>
|
|
86
|
+
</MessageBubble>
|
|
87
|
+
</View>
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
);
|
|
91
|
+
|
|
92
|
+
export default CustomMessageExample;
|
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
/* eslint-disable react-hooks/rules-of-hooks -- pre-existing port artifacts; hooks called conditionally / inside helpers. TODO: refactor */
|
|
2
|
+
import React, { useEffect, useRef } from 'react';
|
|
3
|
+
import { Animated, Easing } from 'react-native';
|
|
4
|
+
import styled from 'styled-components/native';
|
|
5
|
+
|
|
6
|
+
type Props = {
|
|
7
|
+
usersTyping?: string[];
|
|
8
|
+
text: string;
|
|
9
|
+
isVisible: boolean;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const AIWrapper = styled.View`
|
|
13
|
+
flex-direction: row;
|
|
14
|
+
align-items: center;
|
|
15
|
+
background-color: #667eea; /* можно заменить на градиент через rn-linear-gradient */
|
|
16
|
+
padding: 12px 20px;
|
|
17
|
+
border-radius: 25px;
|
|
18
|
+
|
|
19
|
+
/* тень iOS */
|
|
20
|
+
shadow-color: #667eea;
|
|
21
|
+
shadow-opacity: 0.3;
|
|
22
|
+
shadow-offset: 0px 4px;
|
|
23
|
+
shadow-radius: 10px;
|
|
24
|
+
|
|
25
|
+
/* тень Android */
|
|
26
|
+
elevation: 3;
|
|
27
|
+
`;
|
|
28
|
+
|
|
29
|
+
const AIAvatar = styled.View`
|
|
30
|
+
width: 24px;
|
|
31
|
+
height: 24px;
|
|
32
|
+
border-radius: 12px;
|
|
33
|
+
background-color: rgba(255, 255, 255, 0.2);
|
|
34
|
+
align-items: center;
|
|
35
|
+
justify-content: center;
|
|
36
|
+
margin-right: 8px;
|
|
37
|
+
`;
|
|
38
|
+
|
|
39
|
+
const AIAvatarText = styled.Text`
|
|
40
|
+
color: #fff;
|
|
41
|
+
font-size: 12px;
|
|
42
|
+
font-weight: 600;
|
|
43
|
+
`;
|
|
44
|
+
|
|
45
|
+
const AIText = styled.Text`
|
|
46
|
+
color: #fff;
|
|
47
|
+
font-size: 14px;
|
|
48
|
+
font-weight: 500;
|
|
49
|
+
`;
|
|
50
|
+
|
|
51
|
+
const AnimatedAIWrapper = styled(Animated.View)``;
|
|
52
|
+
|
|
53
|
+
export const AIProcessingIndicator: React.FC<Props> = ({ text, isVisible }) => {
|
|
54
|
+
if (!isVisible) {return null;}
|
|
55
|
+
|
|
56
|
+
const scale = useRef(new Animated.Value(1)).current;
|
|
57
|
+
const opacity = useRef(new Animated.Value(0.6)).current;
|
|
58
|
+
|
|
59
|
+
useEffect(() => {
|
|
60
|
+
const loop = Animated.loop(
|
|
61
|
+
Animated.parallel([
|
|
62
|
+
Animated.sequence([
|
|
63
|
+
Animated.timing(scale, { toValue: 1.05, duration: 1000, easing: Easing.inOut(Easing.ease), useNativeDriver: true }),
|
|
64
|
+
Animated.timing(scale, { toValue: 1, duration: 1000, easing: Easing.inOut(Easing.ease), useNativeDriver: true }),
|
|
65
|
+
]),
|
|
66
|
+
Animated.sequence([
|
|
67
|
+
Animated.timing(opacity, { toValue: 1, duration: 1000, easing: Easing.inOut(Easing.ease), useNativeDriver: true }),
|
|
68
|
+
Animated.timing(opacity, { toValue: 0.6, duration: 1000, easing: Easing.inOut(Easing.ease), useNativeDriver: true }),
|
|
69
|
+
]),
|
|
70
|
+
])
|
|
71
|
+
);
|
|
72
|
+
loop.start();
|
|
73
|
+
return () => loop.stop();
|
|
74
|
+
}, [opacity, scale]);
|
|
75
|
+
|
|
76
|
+
return (
|
|
77
|
+
<AnimatedAIWrapper style={{ transform: [{ scale }], opacity }}>
|
|
78
|
+
<AIWrapper>
|
|
79
|
+
<AIAvatar>
|
|
80
|
+
<AIAvatarText>AI</AIAvatarText>
|
|
81
|
+
</AIAvatar>
|
|
82
|
+
<AIText>{text}</AIText>
|
|
83
|
+
</AIWrapper>
|
|
84
|
+
</AnimatedAIWrapper>
|
|
85
|
+
);
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
const MinWrapper = styled.View`
|
|
89
|
+
flex-direction: row;
|
|
90
|
+
align-items: center;
|
|
91
|
+
justify-content: center;
|
|
92
|
+
padding: 8px;
|
|
93
|
+
`;
|
|
94
|
+
|
|
95
|
+
const Dot = styled(Animated.View)`
|
|
96
|
+
width: 6px;
|
|
97
|
+
height: 6px;
|
|
98
|
+
border-radius: 3px;
|
|
99
|
+
background-color: #666;
|
|
100
|
+
margin: 0 2px;
|
|
101
|
+
`;
|
|
102
|
+
|
|
103
|
+
export const MinimalTypingIndicator: React.FC<Props> = ({ isVisible }) => {
|
|
104
|
+
if (!isVisible) {return null;}
|
|
105
|
+
|
|
106
|
+
const makeOpacity = (delay: number) => {
|
|
107
|
+
const o = new Animated.Value(0.2);
|
|
108
|
+
useEffect(() => {
|
|
109
|
+
const loop = Animated.loop(
|
|
110
|
+
Animated.sequence([
|
|
111
|
+
Animated.timing(o, { toValue: 1, duration: 350, delay, useNativeDriver: true }),
|
|
112
|
+
Animated.timing(o, { toValue: 0.2, duration: 700, useNativeDriver: true }),
|
|
113
|
+
])
|
|
114
|
+
);
|
|
115
|
+
loop.start();
|
|
116
|
+
return () => loop.stop();
|
|
117
|
+
}, []);
|
|
118
|
+
return o;
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
const o1 = makeOpacity(0);
|
|
122
|
+
const o2 = makeOpacity(200);
|
|
123
|
+
const o3 = makeOpacity(400);
|
|
124
|
+
|
|
125
|
+
return (
|
|
126
|
+
<MinWrapper>
|
|
127
|
+
<Dot style={{ opacity: o1 }} />
|
|
128
|
+
<Dot style={{ opacity: o2 }} />
|
|
129
|
+
<Dot style={{ opacity: o3 }} />
|
|
130
|
+
</MinWrapper>
|
|
131
|
+
);
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
const Bubble = styled.View`
|
|
135
|
+
background-color: #f0f0f0;
|
|
136
|
+
border-radius: 18px;
|
|
137
|
+
padding: 8px 16px;
|
|
138
|
+
margin: 4px 0;
|
|
139
|
+
align-self: flex-start;
|
|
140
|
+
max-width: 240px;
|
|
141
|
+
`;
|
|
142
|
+
|
|
143
|
+
const BubbleText = styled.Text`
|
|
144
|
+
font-size: 14px;
|
|
145
|
+
color: #666;
|
|
146
|
+
`;
|
|
147
|
+
|
|
148
|
+
const BubbleTail = styled.View`
|
|
149
|
+
position: absolute;
|
|
150
|
+
bottom: -6px;
|
|
151
|
+
left: 20px;
|
|
152
|
+
width: 0px;
|
|
153
|
+
height: 0px;
|
|
154
|
+
border-left-width: 6px;
|
|
155
|
+
border-right-width: 6px;
|
|
156
|
+
border-top-width: 6px;
|
|
157
|
+
border-left-color: transparent;
|
|
158
|
+
border-right-color: transparent;
|
|
159
|
+
border-top-color: #f0f0f0;
|
|
160
|
+
`;
|
|
161
|
+
|
|
162
|
+
const BubbleWrapper = styled.View`
|
|
163
|
+
position: relative;
|
|
164
|
+
align-self: flex-start;
|
|
165
|
+
`;
|
|
166
|
+
|
|
167
|
+
export const ChatBubbleTypingIndicator: React.FC<Props> = ({ text, isVisible }) => {
|
|
168
|
+
if (!isVisible) {return null;}
|
|
169
|
+
|
|
170
|
+
return (
|
|
171
|
+
<BubbleWrapper>
|
|
172
|
+
<Bubble>
|
|
173
|
+
<BubbleText>{text}</BubbleText>
|
|
174
|
+
</Bubble>
|
|
175
|
+
<BubbleTail />
|
|
176
|
+
</BubbleWrapper>
|
|
177
|
+
);
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
const ProgressWrap = styled.View`
|
|
181
|
+
background-color: rgba(0, 0, 0, 0.1);
|
|
182
|
+
border-radius: 10px;
|
|
183
|
+
padding: 8px 16px;
|
|
184
|
+
flex-direction: row;
|
|
185
|
+
align-items: center;
|
|
186
|
+
`;
|
|
187
|
+
|
|
188
|
+
const ProgressLabel = styled.Text`
|
|
189
|
+
font-size: 12px;
|
|
190
|
+
color: #666;
|
|
191
|
+
margin-right: 8px;
|
|
192
|
+
`;
|
|
193
|
+
|
|
194
|
+
const Bar = styled.View`
|
|
195
|
+
width: 60px;
|
|
196
|
+
height: 4px;
|
|
197
|
+
background-color: rgba(0, 0, 0, 0.1);
|
|
198
|
+
border-radius: 2px;
|
|
199
|
+
overflow: hidden;
|
|
200
|
+
`;
|
|
201
|
+
|
|
202
|
+
const Runner = styled(Animated.View)`
|
|
203
|
+
width: 60px;
|
|
204
|
+
height: 4px;
|
|
205
|
+
background-color: #007bff;
|
|
206
|
+
`;
|
|
207
|
+
|
|
208
|
+
export const ProgressTypingIndicator: React.FC<Props> = ({ text, isVisible }) => {
|
|
209
|
+
if (!isVisible) {return null;}
|
|
210
|
+
|
|
211
|
+
const tx = useRef(new Animated.Value(-60)).current;
|
|
212
|
+
|
|
213
|
+
useEffect(() => {
|
|
214
|
+
const loop = Animated.loop(
|
|
215
|
+
Animated.sequence([
|
|
216
|
+
Animated.timing(tx, { toValue: 60, duration: 1500, easing: Easing.linear, useNativeDriver: true }),
|
|
217
|
+
Animated.timing(tx, { toValue: -60, duration: 0, useNativeDriver: true }),
|
|
218
|
+
])
|
|
219
|
+
);
|
|
220
|
+
loop.start();
|
|
221
|
+
return () => loop.stop();
|
|
222
|
+
}, [tx]);
|
|
223
|
+
|
|
224
|
+
return (
|
|
225
|
+
<ProgressWrap>
|
|
226
|
+
<ProgressLabel>{text}</ProgressLabel>
|
|
227
|
+
<Bar>
|
|
228
|
+
<Runner style={{ transform: [{ translateX: tx }] }} />
|
|
229
|
+
</Bar>
|
|
230
|
+
</ProgressWrap>
|
|
231
|
+
);
|
|
232
|
+
};
|
|
233
|
+
|
|
234
|
+
export const CustomTypingIndicatorExamples = {
|
|
235
|
+
AIProcessingIndicator,
|
|
236
|
+
MinimalTypingIndicator,
|
|
237
|
+
ChatBubbleTypingIndicator,
|
|
238
|
+
ProgressTypingIndicator,
|
|
239
|
+
};
|