@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.
Files changed (273) hide show
  1. package/LICENSE +661 -0
  2. package/README.md +148 -0
  3. package/empty-shim.js +15 -0
  4. package/index.js +13 -0
  5. package/metro.js +72 -0
  6. package/package.json +99 -0
  7. package/src/api.config.ts +34 -0
  8. package/src/assets/BG.png +0 -0
  9. package/src/assets/BG.tsx +56 -0
  10. package/src/assets/File.svg +4 -0
  11. package/src/assets/ForzaCare.png +0 -0
  12. package/src/assets/ForzaCare.tsx +27 -0
  13. package/src/assets/icons.tsx +685 -0
  14. package/src/assets/images.tsx +41 -0
  15. package/src/assets/test.xml +243 -0
  16. package/src/components/AuthForms/Login.tsx +295 -0
  17. package/src/components/AuthForms/LoginAnonym.tsx +68 -0
  18. package/src/components/AuthForms/Register.tsx +8 -0
  19. package/src/components/ContextMenu/ContextMenuComponents.tsx +87 -0
  20. package/src/components/DropdownMenu/DropdownMenu.tsx +244 -0
  21. package/src/components/ExampleComponents/CustomMessage.tsx +92 -0
  22. package/src/components/ExampleComponents/CustomTypingIndicatorExamples.tsx +239 -0
  23. package/src/components/Header/HeaderRoomList.tsx +104 -0
  24. package/src/components/InputComponents/AudioInput.tsx +24 -0
  25. package/src/components/InputComponents/AudioRecorder.tsx +100 -0
  26. package/src/components/InputComponents/MediaInput.tsx +114 -0
  27. package/src/components/InputComponents/RecordingIndicator.tsx +77 -0
  28. package/src/components/InputComponents/Search.tsx +135 -0
  29. package/src/components/InputComponents/TextInput.tsx +66 -0
  30. package/src/components/MainComponents/ChatHeader.tsx +163 -0
  31. package/src/components/MainComponents/ChatRoom.tsx +392 -0
  32. package/src/components/MainComponents/ChatWrapper.tsx +318 -0
  33. package/src/components/MainComponents/ChooseChatMessage.tsx +44 -0
  34. package/src/components/MainComponents/ConnectionBanner.tsx +33 -0
  35. package/src/components/MainComponents/EditWrapper.tsx +72 -0
  36. package/src/components/MainComponents/LoginWrapper.tsx +134 -0
  37. package/src/components/MainComponents/MediaMessage.tsx +55 -0
  38. package/src/components/MainComponents/MessageContainer.tsx +122 -0
  39. package/src/components/MainComponents/MessageList.tsx +429 -0
  40. package/src/components/MainComponents/NoMessagesPlaceholder.tsx +49 -0
  41. package/src/components/MainComponents/ProfileImagePlaceholder.tsx +143 -0
  42. package/src/components/MainComponents/RNStyled.tsx +34 -0
  43. package/src/components/MainComponents/ReduxWrapper.tsx +40 -0
  44. package/src/components/MainComponents/RoomList.tsx +246 -0
  45. package/src/components/MainComponents/Select.tsx +165 -0
  46. package/src/components/MainComponents/Switch.tsx +73 -0
  47. package/src/components/MainComponents/SystemMessage.tsx +42 -0
  48. package/src/components/Menu/HeaderRoomListMenu.tsx +169 -0
  49. package/src/components/MenuRoom/MenuRoom.tsx +46 -0
  50. package/src/components/MessageBubble/Avatar.tsx +84 -0
  51. package/src/components/MessageBubble/BottomReplyContainer.tsx +117 -0
  52. package/src/components/MessageBubble/CustomDivider.tsx +10 -0
  53. package/src/components/MessageBubble/DeletedMessage.tsx +36 -0
  54. package/src/components/MessageBubble/Message.tsx +400 -0
  55. package/src/components/MessageBubble/MessageInteractions.tsx +247 -0
  56. package/src/components/MessageBubble/MessageReaction.tsx +149 -0
  57. package/src/components/MessageBubble/MessageReply.tsx +50 -0
  58. package/src/components/MessageBubble/MessageTranslations.tsx +30 -0
  59. package/src/components/Modals/AddMembersModal/AddMembersModal.tsx +142 -0
  60. package/src/components/Modals/ChatProfileModal/ChatProfileModal.tsx +471 -0
  61. package/src/components/Modals/ChatProfileModal/DeleteChatModal.tsx +91 -0
  62. package/src/components/Modals/FilePreviewModal/FilePreviewModal.tsx +298 -0
  63. package/src/components/Modals/Modal/Modal.tsx +52 -0
  64. package/src/components/Modals/ModalHeaderComponent.tsx +41 -0
  65. package/src/components/Modals/ModalSelectMedia/ModalSelectMedia.tsx +285 -0
  66. package/src/components/Modals/ModalWrapper/ModalWrapper.tsx +103 -0
  67. package/src/components/Modals/NewChatModal/ModalContent.tsx +151 -0
  68. package/src/components/Modals/NewChatModal/NewChatModal.tsx +391 -0
  69. package/src/components/Modals/NewChatModal/UpdNewChatModal.tsx +136 -0
  70. package/src/components/Modals/SelectUsersModal/SelectUsersModal.tsx +134 -0
  71. package/src/components/Modals/SettingsModals/BlockedUsers/BlockedUsersModal.tsx +63 -0
  72. package/src/components/Modals/SettingsModals/DocumentShares/DocumentSharesModal.tsx +115 -0
  73. package/src/components/Modals/SettingsModals/ManageDataModal/ManageDataModal.tsx +121 -0
  74. package/src/components/Modals/SettingsModals/ManageDataModal/StyledComponents.ts +0 -0
  75. package/src/components/Modals/SettingsModals/ProfileShares/ProfileShares.tsx +65 -0
  76. package/src/components/Modals/SettingsModals/Referrals/Referrals.tsx +90 -0
  77. package/src/components/Modals/SettingsModals/SharedStyledComponents.ts +74 -0
  78. package/src/components/Modals/SettingsModals/Visibility/RadioInput.tsx +59 -0
  79. package/src/components/Modals/SettingsModals/Visibility/StyledComponents.ts +32 -0
  80. package/src/components/Modals/SettingsModals/Visibility/VisibilityModal.tsx +146 -0
  81. package/src/components/Modals/UserProfileModal/EditUserModal.tsx +163 -0
  82. package/src/components/Modals/UserProfileModal/UserProfileModal.tsx +410 -0
  83. package/src/components/Modals/UserSettingsModal/UserSettingsModal.tsx +85 -0
  84. package/src/components/Modals/styledModalComponents.tsx +181 -0
  85. package/src/components/OperationalModal/OperationalModal.tsx +78 -0
  86. package/src/components/RoomComponents/ChatRoomItem.tsx +219 -0
  87. package/src/components/RoomComponents/LastMessageItem.tsx +47 -0
  88. package/src/components/RoomComponents/styled/LastAudioMessage.tsx +62 -0
  89. package/src/components/RoomComponents/styled/LastMessageEmoji.tsx +26 -0
  90. package/src/components/RoomComponents/styled/LastMessageFile.tsx +54 -0
  91. package/src/components/RoomComponents/styled/LastMessagePhoto.tsx +54 -0
  92. package/src/components/RoomComponents/styled/LastMessageVideo.tsx +70 -0
  93. package/src/components/RoomComponents/styled/LastTextMessage.tsx +65 -0
  94. package/src/components/RoomComponents/styled/StyledRoomComponents.ts +53 -0
  95. package/src/components/SortDropDown/index.tsx +76 -0
  96. package/src/components/Thread/ThreadHeader.tsx +41 -0
  97. package/src/components/Thread/ThreadWrapper.tsx +270 -0
  98. package/src/components/Toast/Toast.tsx +128 -0
  99. package/src/components/Toast/index.ts +13 -0
  100. package/src/components/UsersList/StyledComponents.ts +30 -0
  101. package/src/components/UsersList/UsersList.tsx +112 -0
  102. package/src/components/styled/ActionButton.tsx +40 -0
  103. package/src/components/styled/AudioMessage.tsx +82 -0
  104. package/src/components/styled/Button.tsx +107 -0
  105. package/src/components/styled/ChatWrapperBox.tsx +9 -0
  106. package/src/components/styled/DateLabel.tsx +77 -0
  107. package/src/components/styled/Loader.tsx +65 -0
  108. package/src/components/styled/MediaFilePreview.tsx +42 -0
  109. package/src/components/styled/MediaModal.tsx +54 -0
  110. package/src/components/styled/MessageImage.tsx +54 -0
  111. package/src/components/styled/NewMessageLabel.tsx +50 -0
  112. package/src/components/styled/RoomListComponents/index.tsx +164 -0
  113. package/src/components/styled/SendInput.tsx +297 -0
  114. package/src/components/styled/StyledComponents.ts +320 -0
  115. package/src/components/styled/StyledInput.tsx +101 -0
  116. package/src/components/styled/StyledInputComponents/AudioComponents.tsx +1 -0
  117. package/src/components/styled/StyledInputComponents/Composing.tsx +97 -0
  118. package/src/components/styled/StyledInputComponents/CustomTypingIndicator.tsx +261 -0
  119. package/src/components/styled/StyledInputComponents/MediaComponents.tsx +90 -0
  120. package/src/components/styled/StyledInputComponents/StyledInputComponents.tsx +131 -0
  121. package/src/components/styled/StyledInputComponents/VideoComponents.tsx +49 -0
  122. package/src/components/styled/TreadLabel.tsx +50 -0
  123. package/src/components/styled/UnsupportedType.tsx +95 -0
  124. package/src/components/styled/VideoMessage.tsx +68 -0
  125. package/src/context/MessageNotificationContext.tsx +335 -0
  126. package/src/context/PushNotificationProvider.tsx +78 -0
  127. package/src/context/ToastContext.tsx +63 -0
  128. package/src/context/toastProvider.tsx +0 -0
  129. package/src/context/xmppProvider.tsx +364 -0
  130. package/src/helpers/block_scroll.ts +95 -0
  131. package/src/helpers/chatAutoEnterer.ts +46 -0
  132. package/src/helpers/checkUniqueUsers.tsx +31 -0
  133. package/src/helpers/constants/CHAT_TYPES.ts +6 -0
  134. package/src/helpers/constants/LANGUAGE_OPTIONS.ts +14 -0
  135. package/src/helpers/constants/LOCAL_STORAGE.ts +3 -0
  136. package/src/helpers/constants/MESSAGE_INTERACTIONS.ts +29 -0
  137. package/src/helpers/constants/MODAL_TYPES.ts +57 -0
  138. package/src/helpers/constants/PLATFORM_CONSTANTS.ts +3 -0
  139. package/src/helpers/createMainMessageForThread.ts +23 -0
  140. package/src/helpers/createMessageFromXml.ts +118 -0
  141. package/src/helpers/createRoomFromApi.tsx +27 -0
  142. package/src/helpers/createUserNameFromSetUser.ts +15 -0
  143. package/src/helpers/dateComparison.ts +12 -0
  144. package/src/helpers/debounce.ts +10 -0
  145. package/src/helpers/ensureScopedChatCache.ts +61 -0
  146. package/src/helpers/extractUniqueMembersFromRooms.ts +45 -0
  147. package/src/helpers/formatNumberWithCommas.ts +3 -0
  148. package/src/helpers/getBooleanFromString.ts +7 -0
  149. package/src/helpers/getDataFromXml.ts +80 -0
  150. package/src/helpers/getNumberFromString.ts +5 -0
  151. package/src/helpers/getRoomsWithRetry.ts +45 -0
  152. package/src/helpers/getTintedColor.ts +28 -0
  153. package/src/helpers/getUnnamedUsers.ts +39 -0
  154. package/src/helpers/handleCopyClick.ts +3 -0
  155. package/src/helpers/handleXmppError.ts +14 -0
  156. package/src/helpers/hashcolor.ts +34 -0
  157. package/src/helpers/historyPreloadScheduler.ts +264 -0
  158. package/src/helpers/initRoomsPresence.ts +32 -0
  159. package/src/helpers/initXmppRooms.tsx +71 -0
  160. package/src/helpers/insertMessageWithDelimiter.ts +96 -0
  161. package/src/helpers/isChatIdPresentInArray.ts +54 -0
  162. package/src/helpers/localStorageUser.ts +9 -0
  163. package/src/helpers/markdownParser.tsx +295 -0
  164. package/src/helpers/nanoToMs.ts +3 -0
  165. package/src/helpers/parseMessageBody.tsx +516 -0
  166. package/src/helpers/parseUrls.tsx +42 -0
  167. package/src/helpers/resolveInitBeforeLoadUser.ts +240 -0
  168. package/src/helpers/storeConsole.ts +26 -0
  169. package/src/helpers/transformTranslatations.ts +16 -0
  170. package/src/helpers/updateMessagesTillLast.tsx +104 -0
  171. package/src/helpers/updatedChatLastTimestamps.ts +29 -0
  172. package/src/helpers/validator.ts +20 -0
  173. package/src/helpers/walletUsername.ts +12 -0
  174. package/src/hooks/hooks.ts +6 -0
  175. package/src/hooks/useChatSettingState.tsx +38 -0
  176. package/src/hooks/useChatWrapperInit.ts +266 -0
  177. package/src/hooks/useComposing.tsx +59 -0
  178. package/src/hooks/useCustomTypingIndicator.tsx +193 -0
  179. package/src/hooks/useEventHandlers.tsx +81 -0
  180. package/src/hooks/useGetNewArchRoom.tsx +57 -0
  181. package/src/hooks/useHeapSender.tsx +88 -0
  182. package/src/hooks/useLocalStorage.tsx +53 -0
  183. package/src/hooks/useLogout.tsx +31 -0
  184. package/src/hooks/useMessageHeapState.tsx +11 -0
  185. package/src/hooks/useMessageLoaderQueue.tsx +90 -0
  186. package/src/hooks/useMessageQueue.ts +146 -0
  187. package/src/hooks/usePendingNotification.ts +49 -0
  188. package/src/hooks/usePrevious.tsx +15 -0
  189. package/src/hooks/usePushNotifications.ts +106 -0
  190. package/src/hooks/useQRCodeChatHandler.ts +58 -0
  191. package/src/hooks/useRoomInitialization.tsx +160 -0
  192. package/src/hooks/useRoomState.tsx +47 -0
  193. package/src/hooks/useRoomUrl.tsx +41 -0
  194. package/src/hooks/useSendMessage.tsx +306 -0
  195. package/src/hooks/useUnreadMessagesCounter.ts +55 -0
  196. package/src/hooks/useXmppInitialization.ts +148 -0
  197. package/src/main.ts +45 -0
  198. package/src/networking/api-requests/auth.api.ts +140 -0
  199. package/src/networking/api-requests/push.api.ts +55 -0
  200. package/src/networking/api-requests/roomMembers.api.ts +20 -0
  201. package/src/networking/api-requests/rooms.api.ts +142 -0
  202. package/src/networking/api-requests/user.api.ts +65 -0
  203. package/src/networking/apiClient.ts +149 -0
  204. package/src/networking/helpers/refreshChecker.ts +13 -0
  205. package/src/networking/stanzaHandlers.ts +418 -0
  206. package/src/networking/xmpp/actionSetTimestampToPrivateStore.xmpp.ts +37 -0
  207. package/src/networking/xmpp/allRoomPresences.xmpp.ts +10 -0
  208. package/src/networking/xmpp/createPrivateRoom.xmpp.ts +26 -0
  209. package/src/networking/xmpp/createRoom.xmpp.ts +35 -0
  210. package/src/networking/xmpp/createRoomPresence.xmpp.ts +74 -0
  211. package/src/networking/xmpp/createTimeoutPromise.xmpp.ts +15 -0
  212. package/src/networking/xmpp/deleteMessage.xmpp.ts +19 -0
  213. package/src/networking/xmpp/editMessage.xmpp.ts +46 -0
  214. package/src/networking/xmpp/getChatsPrivateStoreRequest.xmpp.ts +57 -0
  215. package/src/networking/xmpp/getHistory.xmpp.ts +140 -0
  216. package/src/networking/xmpp/getLastMessageArchive.xmpp.ts +24 -0
  217. package/src/networking/xmpp/getRoomInfo.xmpp.ts +15 -0
  218. package/src/networking/xmpp/getRoomMembers.xmpp.ts +13 -0
  219. package/src/networking/xmpp/getRooms.xmpp.ts +43 -0
  220. package/src/networking/xmpp/getRoomsPaged.xmpp.ts +59 -0
  221. package/src/networking/xmpp/handlePong.xmpp.ts +7 -0
  222. package/src/networking/xmpp/handleStanzas.xmpp.ts +55 -0
  223. package/src/networking/xmpp/inviteRoomRequest.xmpp.ts +25 -0
  224. package/src/networking/xmpp/leaveTheRoom.xmpp.ts +15 -0
  225. package/src/networking/xmpp/listenerManager.ts +116 -0
  226. package/src/networking/xmpp/presenceInRoom.xmpp.ts +57 -0
  227. package/src/networking/xmpp/roomConfig.xmpp.ts +71 -0
  228. package/src/networking/xmpp/sendMediaMessage.xmpp.ts +97 -0
  229. package/src/networking/xmpp/sendMessageReaction.xmpp.ts +41 -0
  230. package/src/networking/xmpp/sendPing.xmpp.ts +21 -0
  231. package/src/networking/xmpp/sendTextMessage.xmpp.ts +99 -0
  232. package/src/networking/xmpp/sendTextMessageWithTranslateTag.xmpp.ts +44 -0
  233. package/src/networking/xmpp/sendTypingRequest.xmpp.ts +26 -0
  234. package/src/networking/xmpp/setChatsPrivateStoreRequest.xmpp.ts +48 -0
  235. package/src/networking/xmpp/setMeAsOwner.xmpp.ts +52 -0
  236. package/src/networking/xmpp/setRoomImage.xmpp.ts +26 -0
  237. package/src/networking/xmpp/setVCard.xmpp.ts +19 -0
  238. package/src/networking/xmpp/subscribeToRoomMessages.xmpp.ts +75 -0
  239. package/src/networking/xmppClient.ts +603 -0
  240. package/src/roomStore/Middleware/logoutMiddleware.tsx +24 -0
  241. package/src/roomStore/Middleware/newMessageMidlleware.tsx +87 -0
  242. package/src/roomStore/Middleware/reactionsMiddleware.tsx +77 -0
  243. package/src/roomStore/Middleware/testMiddleware.tsx +20 -0
  244. package/src/roomStore/Middleware/unreadMidlleware.tsx +58 -0
  245. package/src/roomStore/chatSettingsSlice.ts +178 -0
  246. package/src/roomStore/index.ts +68 -0
  247. package/src/roomStore/persistence.ts +152 -0
  248. package/src/roomStore/roomHeapSlice.ts +37 -0
  249. package/src/roomStore/roomsSlice.ts +353 -0
  250. package/src/services/pushNotifications.ts +170 -0
  251. package/src/services/pushSubscriptionService.ts +145 -0
  252. package/src/types/messages.ts +61 -0
  253. package/src/types/models/action.model.ts +30 -0
  254. package/src/types/models/config.model.ts +16 -0
  255. package/src/types/models/customComponents.model.ts +53 -0
  256. package/src/types/models/language.model.ts +11 -0
  257. package/src/types/models/media.model.ts +5 -0
  258. package/src/types/models/message.model.ts +69 -0
  259. package/src/types/models/modal.model.ts +9 -0
  260. package/src/types/models/room.model.ts +120 -0
  261. package/src/types/models/user.model.ts +90 -0
  262. package/src/types/models/xmpp.model.ts +155 -0
  263. package/src/types/types.ts +505 -0
  264. package/src/utils/PriorityQueue.ts +47 -0
  265. package/src/utils/actionHelpers.ts +40 -0
  266. package/src/utils/actionLogger.ts +64 -0
  267. package/src/utils/clientRegistry.ts +80 -0
  268. package/src/utils/devLogger.ts +197 -0
  269. package/src/utils/messageNotificationManager.ts +108 -0
  270. package/src/utils/resendMessage.ts +87 -0
  271. package/src/utils/toastEmitter.ts +27 -0
  272. package/src/utils/xmppMemoryMonitor.ts +63 -0
  273. package/src/version.ts +1 -0
@@ -0,0 +1,320 @@
1
+ /** @format */
2
+
3
+ import styled from 'styled-components/native';
4
+ import { Dimensions } from 'react-native';
5
+
6
+ const { width, height } = Dimensions.get('window');
7
+
8
+ // General Containers
9
+ export const ChatContainer = styled.View`
10
+ position: relative;
11
+ flex-direction: column;
12
+ flex: 1;
13
+ width: 100%;
14
+ background-color: #ffffff;
15
+ `;
16
+
17
+ export const ThreadContainer = styled.View`
18
+ flex-direction: col;
19
+ justify-content: space-between;
20
+ flex: 1;
21
+ width: 100%;
22
+ background-color: #ffffff;
23
+ `;
24
+
25
+ export const ChatContainerHeader = styled.View`
26
+ flex-direction: row;
27
+ padding: 12px 16px;
28
+ background-color: #ffffff;
29
+ align-items: center;
30
+ justify-content: space-between;
31
+ border-bottom-width: 1px;
32
+ border-bottom-color: #e5e7eb;
33
+ border-style: solid;
34
+ z-index: 1000;
35
+ `;
36
+
37
+ export const CenterContainer = styled.View<{
38
+ rightSpace?: boolean;
39
+ leftSpace?: boolean;
40
+ }>`
41
+ align-items: center;
42
+ justify-content: center;
43
+ width: ${({ rightSpace, leftSpace }) =>
44
+ rightSpace && !leftSpace
45
+ ? '100%'
46
+ : rightSpace || !leftSpace
47
+ ? '90%'
48
+ : '70%'};
49
+ padding-right: ${({ rightSpace }) => (rightSpace ? '16' : '0')}px;
50
+ padding-left: ${({ leftSpace }) => (leftSpace ? '16' : '0')}px;
51
+ `;
52
+
53
+ export const ChatContainerHeaderBoxInfo = styled.TouchableOpacity`
54
+ flex: 1;
55
+ flex-direction: row;
56
+ align-items: center;
57
+ justify-content: center;
58
+ overflow: hidden;
59
+ max-width: 90%;
60
+ gap: 16px;
61
+ flex: 1;
62
+ `;
63
+
64
+ export const ChatContainerHeaderInfo = styled.View`
65
+ flex: 1;
66
+ gap: 2px;
67
+ align-items: left;
68
+ justify-content: center;
69
+ overflow: hidden;
70
+ text-align: left;
71
+ flex-direction: column;
72
+ gap: 2px;
73
+ `;
74
+
75
+ export const ChatContainerHeaderLabel = styled.Text`
76
+ color: #141414;
77
+ font-weight: 600;
78
+ font-size: 16px;
79
+ text-align: left;
80
+ overflow: hidden;
81
+ max-width: 100%;
82
+ `;
83
+
84
+ // Messages
85
+ export const NonRoomChat = styled.View`
86
+ flex: 1;
87
+ width: 100%;
88
+ align-items: center;
89
+ justify-content: center;
90
+ background-color: #fff;
91
+ flex-direction: column;
92
+ gap: 16px;
93
+ `;
94
+
95
+ export const MessagesScroll = styled.ScrollView`
96
+ flex: 1;
97
+ background-color: #f3f6fc;
98
+ padding: 0px 16px;
99
+ `;
100
+
101
+ export const MessagesList = styled.View`
102
+ width: 100%;
103
+ min-height: 20px;
104
+ position: relative;
105
+ `;
106
+
107
+ export const MessageTimestamp = styled.Text`
108
+ font-size: 12px;
109
+ color: #999;
110
+ margin-bottom: 5px;
111
+ `;
112
+
113
+ export const Message = styled.View<{ isUser: boolean }>`
114
+ background-color: ${(props) => (props.isUser ? '#e8eafd' : '#f3f6fc')};
115
+ padding: 10px;
116
+ margin: 10px 0;
117
+ border-radius: 8px;
118
+ max-width: 60%;
119
+ flex-direction: row;
120
+ align-self: ${(props) => (props.isUser ? 'flex-end' : 'flex-start')};
121
+ `;
122
+
123
+ export const MessageText = styled.Text`
124
+ margin: 0;
125
+ color: #141414;
126
+ `;
127
+
128
+ export const UserName = styled.Text`
129
+ font-weight: bold;
130
+ color: #141414;
131
+ `;
132
+
133
+ // Input Components
134
+ export const InputContainer = styled.View`
135
+ background-color: #ffffff;
136
+ flex-direction: row;
137
+ gap: 5px;
138
+ padding: 8px;
139
+ border-top-left-radius: 15px;
140
+ border-top-right-radius: 15px;
141
+ `;
142
+
143
+ export const MessageInput = styled.TextInput`
144
+ padding: 10px;
145
+ border-radius: 8px;
146
+ border: 1px solid #e5e7eb;
147
+ background-color: #f5f7f9;
148
+ color: #141414;
149
+ `;
150
+
151
+ export const SendButton = styled.TouchableOpacity`
152
+ padding: 10px 20px;
153
+ border-radius: 8px;
154
+ background-color: #007bff;
155
+ box-shadow: 1px -1px 10px rgba(0, 0, 0, 0.25);
156
+ justify-content: center;
157
+ align-items: center;
158
+ `;
159
+
160
+ export const SendButtonText = styled.Text`
161
+ color: white;
162
+ `;
163
+
164
+ // Avatar and Utility Components
165
+ export const AvatarCircle = styled.TouchableOpacity<{
166
+ bgColor?: string;
167
+ size?: number;
168
+ isClickable: boolean;
169
+ }>`
170
+ width: ${({ size }) => `${size}px` || '64px'};
171
+ height: ${({ size }) => `${size}px` || '64px'};
172
+ border-radius: 60px;
173
+ background-color: ${({ bgColor }) => bgColor};
174
+ display: flex;
175
+ align-items: center;
176
+ justify-content: center;
177
+ overflow: hidden;
178
+ `;
179
+
180
+ export const AvatarImage = styled.Image<{ size?: number }>`
181
+ width: 100%;
182
+ height: 100%;
183
+ border-radius: 50px;
184
+ object-fit: cover;
185
+ `;
186
+
187
+ export const RemoveButton = styled.TouchableOpacity`
188
+ position: absolute;
189
+ top: -4px;
190
+ right: -4px;
191
+ width: 20px;
192
+ height: 20px;
193
+ background-color: rgba(0, 0, 0, 0.5);
194
+ border-radius: 50px;
195
+ justify-content: center;
196
+ align-items: center;
197
+ `;
198
+
199
+ export const RemoveButtonText = styled.Text`
200
+ color: #fff;
201
+ font-size: 12px;
202
+ font-weight: bold;
203
+ `;
204
+
205
+ export const InitialsText = styled.Text<{ size?: number; color?: string }>`
206
+ font-size: ${({ size }) => (size && size >= 64 ? '24px' : '18px')};
207
+ color: ${({ color }) => (color ? color : '#fff')};
208
+ font-weight: bold;
209
+ `;
210
+
211
+ export const Overlay = styled.View`
212
+ position: absolute;
213
+ top: 0;
214
+ left: 0;
215
+ width: 100%;
216
+ height: 100%;
217
+ background-color: rgba(0, 0, 0, 0.3);
218
+ display: flex;
219
+ align-items: center;
220
+ justify-content: center;
221
+ border-radius: 50%;
222
+ `;
223
+
224
+ export const CustomMessageText = styled.Text<{
225
+ isUser?: boolean;
226
+ color?: string;
227
+ colorUser: string;
228
+ }>`
229
+ margin: 0px;
230
+ color: ${({ color, isUser, colorUser }) =>
231
+ isUser ? colorUser || '#000' : color || '#000'};
232
+ `;
233
+
234
+ export const FileInput = styled.TextInput`
235
+ display: none;
236
+ `;
237
+
238
+ export const StyledLoaderWrapper = styled.View`
239
+ width: ${width}px;
240
+ height: ${height}px;
241
+ justify-content: center;
242
+ align-items: center;
243
+ `;
244
+
245
+ export const OrDelimiter = styled.Text`
246
+ width: 100%;
247
+ align-items: center;
248
+ justify-content: center;
249
+ position: relative;
250
+ `;
251
+
252
+ export const OrDelimiterText = styled.Text`
253
+ font-size: 14px;
254
+ color: #999;
255
+ `;
256
+
257
+ export const Line = styled.View`
258
+ width: 100%;
259
+ height: 1px;
260
+ background-color: #0052cd0d;
261
+ `;
262
+
263
+ export const AlsoCheckbox = styled.View<{ accentColor: string }>`
264
+ width: 16px;
265
+ height: 16px;
266
+ background-color: ${(props) => props.accentColor};
267
+ border-radius: 4px;
268
+ `;
269
+
270
+ export const AlsoContainer = styled.TouchableOpacity`
271
+ align-items: center;
272
+ flex-direction: row;
273
+ gap: 8px;
274
+ background-color: #0052cd0d;
275
+ font-size: 14px;
276
+ padding: 10px 28px;
277
+ text-align: start;
278
+ `;
279
+
280
+ export const Wrapper = styled.View<{
281
+ bgColor?: string;
282
+ size?: number;
283
+ isClickable: boolean;
284
+ }>`
285
+ width: ${({ size }) => `${size}px` || '64px'};
286
+ height: ${({ size }) => `${size}px` || '64px'};
287
+ margin: 8px 0 8px 8px;
288
+ border-radius: 60px;
289
+ background-color: ${({ bgColor }) => bgColor};
290
+ display: flex;
291
+ align-items: center;
292
+ justify-content: center;
293
+ position: relative;
294
+ `;
295
+
296
+ export const CustomSystemMessage = styled.View`
297
+ text-align: center;
298
+ display: flex;
299
+ align-items: center;
300
+ justify-content: center;
301
+ width: 100%;
302
+ background-color: transparent;
303
+ gap: 16px;
304
+ margin: 8px;
305
+ `;
306
+
307
+ export const MessageFooter = styled.View<{ isUser: boolean }>`
308
+ flex-direction: row;
309
+ justify-content: flex-start;
310
+ position: absolute;
311
+ gap: 6px;
312
+ bottom: -25px;
313
+ left: ${(props) => (!props.isUser ? '10px' : 'auto')};
314
+ right: ${(props) => (props.isUser ? '10px' : 'auto')};
315
+
316
+ @media (max-width: 675px) {
317
+ font-size: 12px;
318
+ bottom: -24px;
319
+ }
320
+ `;
@@ -0,0 +1,101 @@
1
+ import React from 'react';
2
+ import { View, Text, TextInput, StyleSheet } from 'react-native';
3
+
4
+ interface StyledInputProps {
5
+ label?: string;
6
+ color?: string;
7
+ helperText?: string;
8
+ error?: boolean;
9
+ [key: string]: any;
10
+ }
11
+
12
+ const InputWrapper = ({ children }: { children: React.ReactNode }) => {
13
+ return <View style={styles.inputWrapper}>{children}</View>;
14
+ };
15
+
16
+ const Label = ({ children }: { children: React.ReactNode }) => (
17
+ <Text style={styles.label}>{children}</Text>
18
+ );
19
+
20
+ const StyledInput = ({
21
+ color,
22
+ error,
23
+ ...props
24
+ }: { color?: string; error?: boolean } & React.ComponentProps<
25
+ typeof TextInput
26
+ >) => (
27
+ <TextInput
28
+ style={[
29
+ styles.input,
30
+ {
31
+ borderColor: error ? 'red' : color || '#0052CD',
32
+ backgroundColor: '#F5F7F9',
33
+ },
34
+ ]}
35
+ {...props}
36
+ />
37
+ );
38
+
39
+ const HelperText = ({
40
+ children,
41
+ error,
42
+ }: {
43
+ children: React.ReactNode;
44
+ error?: boolean;
45
+ }) => (
46
+ <Text style={[styles.helperText, { color: error ? 'red' : '#8c8c8c' }]}>
47
+ {children}
48
+ </Text>
49
+ );
50
+
51
+ const InputWithLabel: React.FC<StyledInputProps> = ({
52
+ label,
53
+ color,
54
+ helperText,
55
+ error,
56
+ ...rest
57
+ }) => {
58
+ return (
59
+ <InputWrapper>
60
+ {label && <Label>{label}</Label>}
61
+ <StyledInput color={color} error={error} {...rest} />
62
+ {helperText && <HelperText error={error}>{helperText}</HelperText>}
63
+ </InputWrapper>
64
+ );
65
+ };
66
+
67
+ const styles = StyleSheet.create({
68
+ inputWrapper: {
69
+ flexDirection: 'column',
70
+ width: '100%',
71
+ justifyContent: 'flex-start',
72
+ alignItems: 'flex-start',
73
+ position: 'relative',
74
+ height: 48,
75
+ borderRadius: 15,
76
+ paddingHorizontal: 16,
77
+ },
78
+ label: {
79
+ fontSize: 14,
80
+ color: '#8c8c8c',
81
+ marginBottom: 4,
82
+ marginLeft: 8,
83
+ },
84
+ input: {
85
+ width: '100%',
86
+ padding: 12,
87
+ paddingHorizontal: 16,
88
+ borderRadius: 12,
89
+ fontSize: 16,
90
+ borderWidth: 1,
91
+ },
92
+ helperText: {
93
+ fontSize: 12,
94
+ marginTop: 4,
95
+ marginLeft: 8,
96
+ position: 'absolute',
97
+ top: 42,
98
+ },
99
+ });
100
+
101
+ export default InputWithLabel;
@@ -0,0 +1,97 @@
1
+ import React, { FC, useEffect, useRef } from 'react';
2
+ import { View, Text, StyleSheet, Animated } from 'react-native';
3
+
4
+ // Define props
5
+ interface ComposingProps {
6
+ usersTyping?: string[];
7
+ style?: any;
8
+ }
9
+
10
+ // Composing component
11
+ const Composing: FC<ComposingProps> = ({ usersTyping = ['User'], style }) => {
12
+ const fadeAnim1 = useRef(new Animated.Value(0.2)).current;
13
+ const fadeAnim2 = useRef(new Animated.Value(0.2)).current;
14
+ const fadeAnim3 = useRef(new Animated.Value(0.2)).current;
15
+
16
+ const animateDot = (animatedValue: Animated.Value, delay: number) => {
17
+ Animated.loop(
18
+ Animated.sequence([
19
+ Animated.timing(animatedValue, {
20
+ toValue: 1,
21
+ duration: 300,
22
+ useNativeDriver: true,
23
+ delay,
24
+ }),
25
+ Animated.timing(animatedValue, {
26
+ toValue: 0.2,
27
+ duration: 300,
28
+ useNativeDriver: true,
29
+ }),
30
+ ])
31
+ ).start();
32
+ };
33
+
34
+ useEffect(() => {
35
+ animateDot(fadeAnim1, 0);
36
+ animateDot(fadeAnim2, 200);
37
+ animateDot(fadeAnim3, 400);
38
+ }, []);
39
+
40
+ let typingText: string;
41
+ if (usersTyping.length === 1) {
42
+ typingText = `${usersTyping[0]} is typing`;
43
+ } else if (usersTyping.length === 2) {
44
+ typingText = `${usersTyping[0]} and ${usersTyping[1]} are typing`;
45
+ } else if (usersTyping.length > 2) {
46
+ typingText = `${usersTyping.length} people are typing`;
47
+ } else {
48
+ typingText = '';
49
+ }
50
+
51
+ return (
52
+ <View style={[styles.wrapper, style]}>
53
+ {typingText ? (
54
+ <Text style={styles.typingText}>{typingText}</Text>
55
+ ) : (
56
+ <View />
57
+ )}
58
+ <View style={styles.dotsContainer}>
59
+ <Animated.Text style={[styles.dot, { opacity: fadeAnim1 }]}>
60
+ .
61
+ </Animated.Text>
62
+ <Animated.Text style={[styles.dot, { opacity: fadeAnim2 }]}>
63
+ .
64
+ </Animated.Text>
65
+ <Animated.Text style={[styles.dot, { opacity: fadeAnim3 }]}>
66
+ .
67
+ </Animated.Text>
68
+ </View>
69
+ </View>
70
+ );
71
+ };
72
+
73
+ const styles = StyleSheet.create({
74
+ wrapper: {
75
+ flexDirection: 'row',
76
+ alignItems: 'center',
77
+ paddingHorizontal: 4,
78
+ },
79
+ typingText: {
80
+ marginRight: 4,
81
+ fontSize: 12,
82
+ color: '#71717A',
83
+ fontStyle: 'italic',
84
+ },
85
+ dotsContainer: {
86
+ flexDirection: 'row',
87
+ alignItems: 'center',
88
+ },
89
+ dot: {
90
+ fontSize: 18,
91
+ lineHeight: 18,
92
+ marginHorizontal: 1,
93
+ color: '#71717A',
94
+ },
95
+ });
96
+
97
+ export default Composing;