@droppii-org/chat-mobile 0.2.2 → 0.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/module/assets/images/icon_droppii.png +0 -0
- package/lib/module/assets/images/index.js +2 -1
- package/lib/module/assets/images/index.js.map +1 -1
- package/lib/module/components/Avatar/SingleAvatar.js +26 -6
- package/lib/module/components/Avatar/SingleAvatar.js.map +1 -1
- package/lib/module/components/ThreadCard/NamePrefixIcon.js +20 -4
- package/lib/module/components/ThreadCard/NamePrefixIcon.js.map +1 -1
- package/lib/module/components/ThreadCard/ThreadCard.js +3 -1
- package/lib/module/components/ThreadCard/ThreadCard.js.map +1 -1
- package/lib/module/context/ChatContext.js +31 -0
- package/lib/module/context/ChatContext.js.map +1 -0
- package/lib/module/context/index.js +4 -0
- package/lib/module/context/index.js.map +1 -0
- package/lib/module/core/useChatListener.js +0 -5
- package/lib/module/core/useChatListener.js.map +1 -1
- package/lib/module/hooks/useChatMessages.js +4 -8
- package/lib/module/hooks/useChatMessages.js.map +1 -1
- package/lib/module/index.js +1 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/screens/chat-detail/ChatComposer.js +6 -5
- package/lib/module/screens/chat-detail/ChatComposer.js.map +1 -1
- package/lib/module/screens/chat-detail/ChatDetail.js +11 -1
- package/lib/module/screens/chat-detail/ChatDetail.js.map +1 -1
- package/lib/module/screens/chat-detail/ChatDetailHeader.js +43 -20
- package/lib/module/screens/chat-detail/ChatDetailHeader.js.map +1 -1
- package/lib/module/screens/inbox/MessagesTab.js +13 -0
- package/lib/module/screens/inbox/MessagesTab.js.map +1 -1
- package/lib/module/services/apis.js +2 -0
- package/lib/module/services/apis.js.map +1 -1
- package/lib/module/services/message.js +4 -2
- package/lib/module/services/message.js.map +1 -1
- package/lib/module/store/conversation.js +17 -20
- package/lib/module/store/conversation.js.map +1 -1
- package/lib/module/types/chat.js +5 -0
- package/lib/module/types/chat.js.map +1 -1
- package/lib/module/utils/conversation.js +6 -17
- package/lib/module/utils/conversation.js.map +1 -1
- package/lib/module/utils/message.js +34 -12
- package/lib/module/utils/message.js.map +1 -1
- package/lib/typescript/src/assets/images/index.d.ts +1 -0
- package/lib/typescript/src/assets/images/index.d.ts.map +1 -1
- package/lib/typescript/src/components/Avatar/SingleAvatar.d.ts +7 -6
- package/lib/typescript/src/components/Avatar/SingleAvatar.d.ts.map +1 -1
- package/lib/typescript/src/components/ThreadCard/NamePrefixIcon.d.ts.map +1 -1
- package/lib/typescript/src/context/ChatContext.d.ts +5 -0
- package/lib/typescript/src/context/ChatContext.d.ts.map +1 -0
- package/lib/typescript/src/context/index.d.ts +2 -0
- package/lib/typescript/src/context/index.d.ts.map +1 -0
- package/lib/typescript/src/core/useChatListener.d.ts.map +1 -1
- package/lib/typescript/src/hooks/useChatMessages.d.ts +1 -3
- package/lib/typescript/src/hooks/useChatMessages.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +1 -0
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/screens/chat-detail/ChatComposer.d.ts.map +1 -1
- package/lib/typescript/src/screens/chat-detail/ChatDetail.d.ts +1 -1
- package/lib/typescript/src/screens/chat-detail/ChatDetail.d.ts.map +1 -1
- package/lib/typescript/src/screens/chat-detail/ChatDetailHeader.d.ts +1 -1
- package/lib/typescript/src/screens/chat-detail/ChatDetailHeader.d.ts.map +1 -1
- package/lib/typescript/src/screens/chat-detail/types.d.ts +4 -2
- package/lib/typescript/src/screens/chat-detail/types.d.ts.map +1 -1
- package/lib/typescript/src/screens/inbox/MessagesTab.d.ts.map +1 -1
- package/lib/typescript/src/services/apis.d.ts.map +1 -1
- package/lib/typescript/src/services/message.d.ts +0 -2
- package/lib/typescript/src/services/message.d.ts.map +1 -1
- package/lib/typescript/src/store/conversation.d.ts +1 -0
- package/lib/typescript/src/store/conversation.d.ts.map +1 -1
- package/lib/typescript/src/types/chat.d.ts +14 -2
- package/lib/typescript/src/types/chat.d.ts.map +1 -1
- package/lib/typescript/src/utils/conversation.d.ts +5 -4
- package/lib/typescript/src/utils/conversation.d.ts.map +1 -1
- package/lib/typescript/src/utils/message.d.ts +6 -2
- package/lib/typescript/src/utils/message.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/assets/images/icon_droppii.png +0 -0
- package/src/assets/images/index.ts +1 -0
- package/src/build-ignore.d.ts +3 -0
- package/src/components/Avatar/SingleAvatar.tsx +40 -17
- package/src/components/ThreadCard/NamePrefixIcon.tsx +19 -7
- package/src/components/ThreadCard/ThreadCard.tsx +1 -1
- package/src/context/ChatContext.tsx +23 -0
- package/src/context/index.ts +1 -0
- package/src/core/useChatListener.ts +0 -11
- package/src/hooks/useChatMessages.ts +26 -38
- package/src/index.tsx +1 -0
- package/src/screens/chat-detail/ChatComposer.tsx +9 -9
- package/src/screens/chat-detail/ChatDetail.tsx +11 -1
- package/src/screens/chat-detail/ChatDetailHeader.tsx +58 -26
- package/src/screens/chat-detail/types.ts +4 -2
- package/src/screens/inbox/MessagesTab.tsx +11 -1
- package/src/services/apis.ts +2 -0
- package/src/services/message.ts +8 -7
- package/src/store/conversation.ts +25 -21
- package/src/types/chat.ts +20 -2
- package/src/utils/conversation.ts +6 -29
- package/src/utils/message.ts +36 -30
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { ChatDetailProps } from './types';
|
|
2
|
-
declare const ChatDetail: import("react").MemoExoticComponent<({ title, subtitle, avatarUri, avatarFullName, chatType, showAddMember, onBack, onPressSearch, onPressAddMember, onPressMenu, onPressAvatar, messages, currentUserId, renderChat, onLoadEarlier, isLoading, isLoadingEarlier, hasMoreEarlier, quickActions, inputValue, inputPlaceholder, onChangeInput, onSend, onPressAttach, onPressEmoji, attachmentActions, onQuickActionPress, onAttachmentAction, renderQuickAction, renderAttachmentAction, attachmentColumns, }: ChatDetailProps) => import("react/jsx-runtime").JSX.Element>;
|
|
2
|
+
declare const ChatDetail: import("react").MemoExoticComponent<({ title, subtitle, avatarUri, avatarFullName, chatType, chatCategory, applicationType, showAddMember, onBack, onPressSearch, onPressAddMember, onPressMenu, onPressAvatar, messages, currentUserId, renderChat, onLoadEarlier, isLoading, isLoadingEarlier, hasMoreEarlier, quickActions, inputValue, inputPlaceholder, onChangeInput, onSend, onPressAttach, onPressEmoji, attachmentActions, onQuickActionPress, onAttachmentAction, renderQuickAction, renderAttachmentAction, attachmentColumns, }: ChatDetailProps) => import("react/jsx-runtime").JSX.Element>;
|
|
3
3
|
export default ChatDetail;
|
|
4
4
|
//# sourceMappingURL=ChatDetail.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChatDetail.d.ts","sourceRoot":"","sources":["../../../../../src/screens/chat-detail/ChatDetail.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ChatDetail.d.ts","sourceRoot":"","sources":["../../../../../src/screens/chat-detail/ChatDetail.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE/C,QAAA,MAAM,UAAU,+gBAmCX,eAAe,6CAwEnB,CAAC;AAUF,eAAe,UAAU,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { ChatDetailHeaderProps } from './types';
|
|
2
|
-
declare const ChatDetailHeader: import("react").MemoExoticComponent<({ title, subtitle, avatarUri, avatarFullName, showAddMember, onBack, onPressSearch, onPressAddMember, onPressMenu, onPressAvatar, }: ChatDetailHeaderProps) => import("react/jsx-runtime").JSX.Element>;
|
|
2
|
+
declare const ChatDetailHeader: import("react").MemoExoticComponent<({ title, subtitle, avatarUri, avatarFullName, chatType, chatCategory, applicationType, showAddMember, onBack, onPressSearch, onPressAddMember, onPressMenu, onPressAvatar, }: ChatDetailHeaderProps) => import("react/jsx-runtime").JSX.Element>;
|
|
3
3
|
export default ChatDetailHeader;
|
|
4
4
|
//# sourceMappingURL=ChatDetailHeader.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChatDetailHeader.d.ts","sourceRoot":"","sources":["../../../../../src/screens/chat-detail/ChatDetailHeader.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ChatDetailHeader.d.ts","sourceRoot":"","sources":["../../../../../src/screens/chat-detail/ChatDetailHeader.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAErD,QAAA,MAAM,gBAAgB,qNAejB,qBAAqB,6CAkHzB,CAAC;AAIF,eAAe,gBAAgB,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
|
-
import type { DChatType } from '../../types/chat';
|
|
3
|
-
import type { DMessageItem } from '../../types/chat';
|
|
2
|
+
import type { DChatType, DChatCategory } from '../../types/chat';
|
|
3
|
+
import type { DConversationItem, DMessageItem } from '../../types/chat';
|
|
4
4
|
export type DChatActionIconProvider = 'MaterialCommunityIcons' | 'DroppiiNew';
|
|
5
5
|
export interface DChatActionItem {
|
|
6
6
|
id: string;
|
|
@@ -19,6 +19,8 @@ export interface ChatDetailHeaderProps {
|
|
|
19
19
|
avatarUri?: string | null;
|
|
20
20
|
avatarFullName?: string;
|
|
21
21
|
chatType?: DChatType;
|
|
22
|
+
chatCategory?: DChatCategory;
|
|
23
|
+
applicationType?: DConversationItem['applicationType'];
|
|
22
24
|
showAddMember?: boolean;
|
|
23
25
|
onBack?: () => void;
|
|
24
26
|
onPressSearch?: () => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/screens/chat-detail/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/screens/chat-detail/types.ts"],"names":[],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AAsB,CAAC,EAAE,wBAAwB,CAAC,cAAc,CAAC,CAAC;IAClE,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MessagesTab.d.ts","sourceRoot":"","sources":["../../../../../src/screens/inbox/MessagesTab.tsx"],"names":[],"mappings":"AAOA,UAAU,gBAAgB;IACxB,eAAe,EAAE,MAAM,CAAC;IACxB,aAAa,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CACxC;AAKD,eAAO,MAAM,WAAW,2EACe,gBAAgB,
|
|
1
|
+
{"version":3,"file":"MessagesTab.d.ts","sourceRoot":"","sources":["../../../../../src/screens/inbox/MessagesTab.tsx"],"names":[],"mappings":"AAOA,UAAU,gBAAgB;IACxB,eAAe,EAAE,MAAM,CAAC;IACxB,aAAa,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CACxC;AAKD,eAAO,MAAM,WAAW,2EACe,gBAAgB,6CAqDtD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apis.d.ts","sourceRoot":"","sources":["../../../../src/services/apis.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,KAAK,EACV,iBAAiB,EACjB,wBAAwB,EACzB,MAAM,eAAe,CAAC;AAEvB,OAAO,KAAK,EAAE,YAAY,EAA0B,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"apis.d.ts","sourceRoot":"","sources":["../../../../src/services/apis.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,KAAK,EACV,iBAAiB,EACjB,wBAAwB,EACzB,MAAM,eAAe,CAAC;AAEvB,OAAO,KAAK,EAAE,YAAY,EAA0B,MAAM,eAAe,CAAC;AAM1E,yBAAiB,OAAO,CAAC;IACvB,SAAgB,eAAe,CAAC,GAAG,EAAE,aAAa,GAAG,IAAI,CAExD;IAEM,MAAM,cAAc,GAAU,cAAc,MAAM,qBAExD,CAAC;IAEK,MAAM,KAAK,GAChB,UAAU,aAAa,EACvB,cAAc,MAAM,qBAerB,CAAC;IAEK,MAAM,MAAM,GAAU,cAAc,MAAM,qBAGhD,CAAC;IAEK,MAAM,OAAO,GAAU,cAAc,MAAM,GAAG,SAAS,kEAE7D,CAAC;IAEF,SAAsB,kBAAkB,CAAC,MAAM,EAAE,wBAAwB,8CAWxE;CACF"}
|
|
@@ -11,8 +11,6 @@ export declare namespace ChatMessageAPI {
|
|
|
11
11
|
}): Promise<HistoryMessageResult>;
|
|
12
12
|
function sendTextMessage(params: {
|
|
13
13
|
text: string;
|
|
14
|
-
recvID?: string;
|
|
15
|
-
groupID?: string;
|
|
16
14
|
}): Promise<DMessageItem>;
|
|
17
15
|
function markConversationAsRead(conversationID: string): Promise<unknown>;
|
|
18
16
|
function getCurrentUserId(): Promise<string>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"message.d.ts","sourceRoot":"","sources":["../../../../src/services/message.ts"],"names":[],"mappings":"AAAA,OAAkB,EAEhB,KAAK,wBAAwB,EAC7B,KAAK,WAAW,EACjB,MAAM,+BAA+B,CAAC;AACvC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"message.d.ts","sourceRoot":"","sources":["../../../../src/services/message.ts"],"names":[],"mappings":"AAAA,OAAkB,EAEhB,KAAK,wBAAwB,EAC7B,KAAK,WAAW,EACjB,MAAM,+BAA+B,CAAC;AACvC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAMlD,MAAM,MAAM,oBAAoB,GAAG,wBAAwB,GAAG;IAC5D,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,yBAAiB,cAAc,CAAC;IAC9B,SAAsB,oBAAoB,CACxC,cAAc,EAAE,MAAM,EACtB,OAAO,CAAC,EAAE;QACR,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,gBAAgB,CAAC,EAAE,MAAM,CAAC;QAC1B,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB,GACA,OAAO,CAAC,oBAAoB,CAAC,CAU/B;IAED,SAAsB,eAAe,CAAC,MAAM,EAAE;QAC5C,IAAI,EAAE,MAAM,CAAC;KACd,GAAG,OAAO,CAAC,YAAY,CAAC,CAaxB;IAED,SAAsB,sBAAsB,CAAC,cAAc,EAAE,MAAM,oBAElE;IAED,SAAsB,gBAAgB,oBAErC;CACF;AAED,YAAY,EAAE,WAAW,EAAE,CAAC"}
|
|
@@ -17,6 +17,7 @@ export interface ConversationStore {
|
|
|
17
17
|
mergeOpenIMConversations(conversations: ConversationItem[]): boolean;
|
|
18
18
|
removeConversation(id: ConversationID): void;
|
|
19
19
|
updateLastMessage(id: ConversationID, message: MessageItem): void;
|
|
20
|
+
reset(): void;
|
|
20
21
|
}
|
|
21
22
|
export declare const useConversationStore: import("zustand").UseBoundStore<import("zustand").StoreApi<ConversationStore>>;
|
|
22
23
|
export declare const useConversation: (id: string) => DConversationItem | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conversation.d.ts","sourceRoot":"","sources":["../../../../src/store/conversation.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,KAAK,EACV,gBAAgB,EAChB,WAAW,EACZ,MAAM,+BAA+B,CAAC;AAEvC,KAAK,cAAc,GAAG,MAAM,CAAC;AAE7B,MAAM,WAAW,iBAAiB;IAChC,qBAAqB,CAAC,EAAE,cAAc,CAAC;IACvC,sBAAsB,CAAC,EAAE,EAAE,cAAc,GAAG,IAAI,CAAC;IACjD,sBAAsB,IAAI,iBAAiB,GAAG,SAAS,CAAC;IACxD,IAAI,EAAE,cAAc,EAAE,CAAC;IACvB,GAAG,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;IAClE,KAAK,IAAI,IAAI,CAAC;CACf;AAED,eAAO,MAAM,oBAAoB,gFAmF9B,CAAC;AAEJ,eAAO,MAAM,eAAe,GAAI,IAAI,MAAM,KAAG,iBAAiB,GAAG,SAEhE,CAAC"}
|
|
@@ -1,7 +1,18 @@
|
|
|
1
1
|
import { type MessageItem, type SessionType, type MessageReceiveOptType, type GroupAtType } from '@droppii/openim-rn-client-sdk';
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
import type { PropsWithChildren } from 'react';
|
|
3
|
+
export declare const EventProvider: {
|
|
4
|
+
readonly ga: "ga";
|
|
5
|
+
readonly appsflyer: "appsflyer";
|
|
6
|
+
readonly netcore: "netcore";
|
|
7
|
+
};
|
|
8
|
+
type LogGA = (event: string, params?: any, provider?: `${keyof typeof EventProvider}`) => void;
|
|
9
|
+
export interface ChatContextType {
|
|
10
|
+
logGA?: LogGA;
|
|
4
11
|
}
|
|
12
|
+
export type ChatProviderProps = PropsWithChildren<{
|
|
13
|
+
enabled?: boolean;
|
|
14
|
+
logGA?: LogGA;
|
|
15
|
+
}>;
|
|
5
16
|
export declare enum DChatApplicationType {
|
|
6
17
|
BIZ = "BIZ",
|
|
7
18
|
MALL = "MALL"
|
|
@@ -96,4 +107,5 @@ export interface DMessagePushInfoEx {
|
|
|
96
107
|
title: string;
|
|
97
108
|
desc: string;
|
|
98
109
|
}
|
|
110
|
+
export {};
|
|
99
111
|
//# sourceMappingURL=chat.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat.d.ts","sourceRoot":"","sources":["../../../../src/types/chat.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,WAAW,EAChB,KAAK,WAAW,EAChB,KAAK,qBAAqB,EAC1B,KAAK,WAAW,EACjB,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"chat.d.ts","sourceRoot":"","sources":["../../../../src/types/chat.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,WAAW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AE,cAAc,CAAC;CAC1B;AAED,MAAM,WAAW,cAAc;IAC7B,kBAAkB,EAAE,OAAO,CAAC;IAC5B,WAAW,EAAE,OAAO,CAAC;IACrB,wBAAwB,EAAE,OAAO,CAAC;IAClC,WAAW,EAAE,OAAO,CAAC;CACtB;AAED,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,SAAS,CAAC;IACxB,aAAa,EAAE,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,cAAc,EAAE,MAAM,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;CACd"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { SessionType, type ConversationItem } from '@droppii/openim-rn-client-sdk';
|
|
2
|
-
import { type DConversationItem
|
|
2
|
+
import { type DConversationItem } from '../types/chat';
|
|
3
3
|
export declare const conversationCompare: (a: ConversationItem, b: ConversationItem) => number;
|
|
4
4
|
export declare const dConversationCompare: (a: DConversationItem, b: DConversationItem) => number;
|
|
5
5
|
export declare const mergeOpenIMIntoConversation: (droppii: DConversationItem, openim: ConversationItem) => DConversationItem;
|
|
6
6
|
export declare const getConversationID: (sessionType: SessionType, senderID?: string, receiverID?: string) => string;
|
|
7
|
-
export declare const
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
export declare const sortConversation: (map: Record<string, DConversationItem>) => {
|
|
8
|
+
map: Record<string, DConversationItem>;
|
|
9
|
+
list: string[];
|
|
10
|
+
};
|
|
10
11
|
//# sourceMappingURL=conversation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conversation.d.ts","sourceRoot":"","sources":["../../../../src/utils/conversation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,KAAK,gBAAgB,EACtB,MAAM,+BAA+B,CAAC;AACvC,OAAO,
|
|
1
|
+
{"version":3,"file":"conversation.d.ts","sourceRoot":"","sources":["../../../../src/utils/conversation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,KAAK,gBAAgB,EACtB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,KAAK,iBAAiB,EAAqB,MAAM,eAAe,CAAC;AAE1E,eAAO,MAAM,mBAAmB,GAC9B,GAAG,gBAAgB,EACnB,GAAG,gBAAgB,WAcpB,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAC/B,GAAG,iBAAiB,EACpB,GAAG,iBAAiB,WAWrB,CAAC;AAEF,eAAO,MAAM,2BAA2B,GACtC,SAAS,iBAAiB,EAC1B,QAAQ,gBAAgB,KACvB,iBAkBF,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAC5B,aAAa,WAAW,EACxB,WAAW,MAAM,EACjB,aAAa,MAAM,WAUpB,CAAC;AAEF,eAAO,MAAM,gBAAgB,GAAI,KAAK,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC;;;CAKtE,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type MessageItem } from '@droppii/openim-rn-client-sdk';
|
|
2
|
-
import type
|
|
2
|
+
import { type DConversationItem, type DMessageItem } from '../types/chat';
|
|
3
3
|
export declare const mergeMessages: (current: DMessageItem[], incoming: DMessageItem[]) => DMessageItem[];
|
|
4
4
|
export declare const normalizeCreatedMessage: (message: MessageItem | string) => MessageItem;
|
|
5
5
|
export type HistoryPaginationAnchor = {
|
|
@@ -11,5 +11,9 @@ export declare const resolveHistoryLastMinSeq: (history: {
|
|
|
11
11
|
}, fallbackMessage?: DMessageItem) => number;
|
|
12
12
|
export declare const getHistoryPaginationAnchor: (messages: DMessageItem[]) => HistoryPaginationAnchor | null;
|
|
13
13
|
export declare const hasNewHistoryMessages: (current: DMessageItem[], incoming: DMessageItem[]) => boolean;
|
|
14
|
-
export declare const belongsToConversation: (message: MessageItem, conversationId: string
|
|
14
|
+
export declare const belongsToConversation: (message: MessageItem, conversationId: string) => boolean;
|
|
15
|
+
export declare const getReceiverId: (conversation?: DConversationItem) => {
|
|
16
|
+
groupID: string;
|
|
17
|
+
recvID: string;
|
|
18
|
+
};
|
|
15
19
|
//# sourceMappingURL=message.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"message.d.ts","sourceRoot":"","sources":["../../../../src/utils/message.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,KAAK,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAC9E,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"message.d.ts","sourceRoot":"","sources":["../../../../src/utils/message.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,KAAK,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAC9E,OAAO,EAEL,KAAK,iBAAiB,EACtB,KAAK,YAAY,EAClB,MAAM,eAAe,CAAC;AASvB,eAAO,MAAM,aAAa,GACxB,SAAS,YAAY,EAAE,EACvB,UAAU,YAAY,EAAE,KACvB,YAAY,EAad,CAAC;AAEF,eAAO,MAAM,uBAAuB,GAClC,SAAS,WAAW,GAAG,MAAM,KAC5B,WAYF,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG;IACpC,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,eAAO,MAAM,wBAAwB,GACnC,SAAS;IAAE,UAAU,CAAC,EAAE,MAAM,CAAA;CAAE,EAChC,kBAAkB,YAAY,KAC7B,MAMF,CAAC;AAEF,eAAO,MAAM,0BAA0B,GACrC,UAAU,YAAY,EAAE,KACvB,uBAAuB,GAAG,IAkB5B,CAAC;AAEF,eAAO,MAAM,qBAAqB,GAChC,SAAS,YAAY,EAAE,EACvB,UAAU,YAAY,EAAE,KACvB,OASF,CAAC;AAEF,eAAO,MAAM,qBAAqB,GAChC,SAAS,WAAW,EACpB,gBAAgB,MAAM,KACrB,OAuBF,CAAC;AAEF,eAAO,MAAM,aAAa,GAAI,eAAe,iBAAiB;;;CAa7D,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@droppii-org/chat-mobile",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.4",
|
|
4
4
|
"description": "Droppii chat mobile",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react-native",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"example"
|
|
57
57
|
],
|
|
58
58
|
"scripts": {
|
|
59
|
-
"example": "yarn workspace @droppii/chat-mobile-example",
|
|
59
|
+
"example": "yarn workspace @droppii-org/chat-mobile-example",
|
|
60
60
|
"clean": "del-cli android/build example/android/build example/android/app/build example/ios/build lib",
|
|
61
61
|
"prepare": "bob build",
|
|
62
62
|
"typecheck": "tsc -p tsconfig.build.json 2>&1 | grep -E 'src/.*error' || echo 'Typecheck passed (external dependency warnings ignored)'",
|
|
Binary file
|
package/src/build-ignore.d.ts
CHANGED
|
@@ -1,18 +1,34 @@
|
|
|
1
1
|
import { memo } from 'react';
|
|
2
2
|
import { StyleSheet } from 'react-native';
|
|
3
3
|
import { KContainer, KImage, KLabel, KColors } from '@droppii/libs';
|
|
4
|
-
import {
|
|
4
|
+
import type { KAvatarProps } from '@droppii/libs/uikit/types';
|
|
5
|
+
import { getInitials, TYPO_MAP, SIZE_MAP } from './Avatar.utils';
|
|
5
6
|
|
|
6
|
-
interface SingleAvatarProps {
|
|
7
|
-
source
|
|
7
|
+
interface SingleAvatarProps extends Omit<KAvatarProps, 'size' | 'uri'> {
|
|
8
|
+
source?: string | null;
|
|
8
9
|
size: number;
|
|
9
|
-
borderColor
|
|
10
|
-
borderWidth
|
|
11
|
-
placeholderColor
|
|
12
|
-
backgroundColor
|
|
10
|
+
borderColor?: string;
|
|
11
|
+
borderWidth?: number;
|
|
12
|
+
placeholderColor?: string;
|
|
13
|
+
backgroundColor?: string;
|
|
13
14
|
fullName?: string;
|
|
14
15
|
}
|
|
15
16
|
|
|
17
|
+
const getSizeVariant = (size: number) => {
|
|
18
|
+
switch (size) {
|
|
19
|
+
case SIZE_MAP.sm:
|
|
20
|
+
return 'xs' as const;
|
|
21
|
+
case SIZE_MAP.md:
|
|
22
|
+
return 'lg' as const;
|
|
23
|
+
case SIZE_MAP.lg:
|
|
24
|
+
return '2xlg' as const;
|
|
25
|
+
default:
|
|
26
|
+
if (size < SIZE_MAP.md) return 'xs' as const;
|
|
27
|
+
if (size < SIZE_MAP.lg) return 'lg' as const;
|
|
28
|
+
return '2xlg' as const;
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
|
|
16
32
|
export const SingleAvatar = memo(
|
|
17
33
|
({
|
|
18
34
|
source,
|
|
@@ -25,16 +41,20 @@ export const SingleAvatar = memo(
|
|
|
25
41
|
}: SingleAvatarProps) => {
|
|
26
42
|
if (source) {
|
|
27
43
|
return (
|
|
28
|
-
<
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
44
|
+
<KContainer.View
|
|
45
|
+
style={[
|
|
46
|
+
styles.avatarContainer,
|
|
47
|
+
{
|
|
48
|
+
borderWidth,
|
|
49
|
+
borderColor,
|
|
50
|
+
borderRadius: size / 2,
|
|
51
|
+
width: size,
|
|
52
|
+
height: size,
|
|
53
|
+
},
|
|
54
|
+
]}
|
|
55
|
+
>
|
|
56
|
+
<KImage.Avatar uri={source} size={getSizeVariant(size) as any} />
|
|
57
|
+
</KContainer.View>
|
|
38
58
|
);
|
|
39
59
|
}
|
|
40
60
|
|
|
@@ -71,4 +91,7 @@ const styles = StyleSheet.create({
|
|
|
71
91
|
justifyContent: 'center',
|
|
72
92
|
alignItems: 'center',
|
|
73
93
|
},
|
|
94
|
+
avatarContainer: {
|
|
95
|
+
overflow: 'hidden',
|
|
96
|
+
},
|
|
74
97
|
});
|
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
import { memo } from 'react';
|
|
2
|
+
import { Image, StyleSheet } from 'react-native';
|
|
2
3
|
import { KContainer, KImage, KColors } from '@droppii/libs';
|
|
3
4
|
import { DChatCategory, DChatType } from '../../types/chat';
|
|
5
|
+
import Images from '../../assets/images';
|
|
6
|
+
|
|
7
|
+
const styles = StyleSheet.create({
|
|
8
|
+
icon: {
|
|
9
|
+
width: 14,
|
|
10
|
+
height: 14,
|
|
11
|
+
},
|
|
12
|
+
});
|
|
4
13
|
|
|
5
14
|
interface NamePrefixIconProps {
|
|
6
15
|
chatCategory?: DChatCategory;
|
|
@@ -9,10 +18,14 @@ interface NamePrefixIconProps {
|
|
|
9
18
|
|
|
10
19
|
export const NamePrefixIcon = memo(
|
|
11
20
|
({ chatCategory, chatType }: NamePrefixIconProps) => {
|
|
12
|
-
if (
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
21
|
+
if (chatCategory === DChatCategory.BIZ_BOT_CRM) {
|
|
22
|
+
return (
|
|
23
|
+
<KContainer.View marginR="0.25rem">
|
|
24
|
+
<Image source={Images.ICON_DROPPII} style={styles.icon} />
|
|
25
|
+
</KContainer.View>
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
if (chatCategory === DChatCategory.BIZ_BOT_PDP) {
|
|
16
29
|
return (
|
|
17
30
|
<KContainer.View marginR="0.25rem">
|
|
18
31
|
<KImage.VectorIcons
|
|
@@ -29,10 +42,9 @@ export const NamePrefixIcon = memo(
|
|
|
29
42
|
return (
|
|
30
43
|
<KContainer.View marginR="0.25rem">
|
|
31
44
|
<KImage.VectorIcons
|
|
32
|
-
name="
|
|
33
|
-
provider="MaterialCommunityIcons"
|
|
45
|
+
name="user-two-b"
|
|
34
46
|
size={14}
|
|
35
|
-
color={KColors.
|
|
47
|
+
color={KColors.black}
|
|
36
48
|
/>
|
|
37
49
|
</KContainer.View>
|
|
38
50
|
);
|
|
@@ -66,7 +66,7 @@ const ThreadCard = memo(({ item, onPress }: ThreadCardProps) => {
|
|
|
66
66
|
<NamePrefixIcon chatCategory={chatCategory} chatType={chatType} />
|
|
67
67
|
<KContainer.VisibleView
|
|
68
68
|
visible={
|
|
69
|
-
chatCategory === DChatCategory.BIZ_BOT_CRM ||
|
|
69
|
+
// chatCategory === DChatCategory.BIZ_BOT_CRM ||
|
|
70
70
|
chatCategory === DChatCategory.BIZ_BOT_PDP
|
|
71
71
|
}
|
|
72
72
|
>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { createContext, useContext, useMemo } from 'react';
|
|
2
|
+
import type { ChatContextType, ChatProviderProps } from '../types/chat';
|
|
3
|
+
|
|
4
|
+
export const ChatContext = createContext<ChatContextType | undefined>(
|
|
5
|
+
undefined
|
|
6
|
+
);
|
|
7
|
+
|
|
8
|
+
export const useChatContext = (): ChatContextType => {
|
|
9
|
+
const context = useContext(ChatContext);
|
|
10
|
+
if (!context) {
|
|
11
|
+
throw new Error('useChatContext must be used within ChatProvider');
|
|
12
|
+
}
|
|
13
|
+
return context;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const ChatProviderInner = ({ logGA, children }: ChatProviderProps) => {
|
|
17
|
+
const value = useMemo(() => ({ logGA }), [logGA]);
|
|
18
|
+
|
|
19
|
+
return <ChatContext.Provider value={value}>{children}</ChatContext.Provider>;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export const ChatProvider = ({ enabled, ...props }: ChatProviderProps) =>
|
|
23
|
+
enabled ? <ChatProviderInner {...props} /> : props.children;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ChatContext';
|
|
@@ -7,21 +7,10 @@ import OpenIMSDK, {
|
|
|
7
7
|
} from '@droppii/openim-rn-client-sdk';
|
|
8
8
|
import { useCallback, useEffect } from 'react';
|
|
9
9
|
import { useConversationStore } from '../store/conversation';
|
|
10
|
-
import { getConversationID } from '../utils/conversation';
|
|
11
10
|
|
|
12
11
|
export const useChatListener = () => {
|
|
13
12
|
const onRecvNewMessages = useCallback((messages: MessageItem[]) => {
|
|
14
13
|
console.log('onRecvNewMessages', messages);
|
|
15
|
-
messages.map((message) => {
|
|
16
|
-
const conversationID = getConversationID(
|
|
17
|
-
message.sessionType,
|
|
18
|
-
message.sendID,
|
|
19
|
-
message.recvID
|
|
20
|
-
);
|
|
21
|
-
useConversationStore
|
|
22
|
-
.getState()
|
|
23
|
-
.updateLastMessage(conversationID, message);
|
|
24
|
-
});
|
|
25
14
|
}, []);
|
|
26
15
|
|
|
27
16
|
const onNewRecvMessageRevoked = useCallback((revokedInfo: RevokedInfo) => {
|
|
@@ -15,16 +15,12 @@ import {
|
|
|
15
15
|
|
|
16
16
|
type UseChatMessagesOptions = {
|
|
17
17
|
conversationId: string;
|
|
18
|
-
recvID?: string;
|
|
19
|
-
groupID?: string;
|
|
20
18
|
enabled?: boolean;
|
|
21
19
|
pageSize?: number;
|
|
22
20
|
};
|
|
23
21
|
|
|
24
22
|
export function useChatMessages({
|
|
25
23
|
conversationId,
|
|
26
|
-
recvID = '',
|
|
27
|
-
groupID = '',
|
|
28
24
|
enabled = true,
|
|
29
25
|
pageSize = 20,
|
|
30
26
|
}: UseChatMessagesOptions) {
|
|
@@ -158,44 +154,36 @@ export function useChatMessages({
|
|
|
158
154
|
}
|
|
159
155
|
}, [conversationId, pageSize]);
|
|
160
156
|
|
|
161
|
-
const sendTextMessage = useCallback(
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
}
|
|
157
|
+
const sendTextMessage = useCallback(async (text: string) => {
|
|
158
|
+
const trimmed = text.trim();
|
|
159
|
+
if (!trimmed) {
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
167
162
|
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
groupID,
|
|
172
|
-
});
|
|
173
|
-
|
|
174
|
-
setMessages((current) => mergeMessages(current, [sentMessage]));
|
|
175
|
-
},
|
|
176
|
-
[groupID, recvID]
|
|
177
|
-
);
|
|
178
|
-
|
|
179
|
-
const appendIncomingMessages = useCallback(
|
|
180
|
-
(incoming: MessageItem[]) => {
|
|
181
|
-
const relevant = incoming.filter((message) =>
|
|
182
|
-
belongsToConversation(message, conversationIdRef.current, groupID)
|
|
183
|
-
);
|
|
163
|
+
const sentMessage = await ChatMessageAPI.sendTextMessage({
|
|
164
|
+
text: trimmed,
|
|
165
|
+
});
|
|
184
166
|
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
}
|
|
167
|
+
setMessages((current) => mergeMessages(current, [sentMessage]));
|
|
168
|
+
}, []);
|
|
188
169
|
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
)
|
|
170
|
+
const appendIncomingMessages = useCallback((incoming: MessageItem[]) => {
|
|
171
|
+
const relevant = incoming.filter((message) =>
|
|
172
|
+
belongsToConversation(message, conversationIdRef.current)
|
|
173
|
+
);
|
|
192
174
|
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
175
|
+
if (!relevant.length) {
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
setMessages((current) =>
|
|
180
|
+
mergeMessages(current, relevant as DMessageItem[])
|
|
181
|
+
);
|
|
182
|
+
|
|
183
|
+
ChatMessageAPI.markConversationAsRead(conversationIdRef.current).catch(
|
|
184
|
+
() => undefined
|
|
185
|
+
);
|
|
186
|
+
}, []);
|
|
199
187
|
|
|
200
188
|
useEffect(() => {
|
|
201
189
|
resetState();
|
package/src/index.tsx
CHANGED
|
@@ -31,6 +31,10 @@ const IS_IOS = Platform.OS === 'ios';
|
|
|
31
31
|
const INPUT_FONT_SIZE = 16;
|
|
32
32
|
const INPUT_LINE_HEIGHT = 22.4;
|
|
33
33
|
const INPUT_MAX_HEIGHT = INPUT_LINE_HEIGHT * 5;
|
|
34
|
+
// Android's onContentSizeChange includes paddingVertical (4*2=8) in reported height
|
|
35
|
+
const WRAPPED_HEIGHT_THRESHOLD = IS_IOS
|
|
36
|
+
? INPUT_LINE_HEIGHT + 4
|
|
37
|
+
: INPUT_LINE_HEIGHT + 12;
|
|
34
38
|
|
|
35
39
|
export const ChatComposer = memo(
|
|
36
40
|
({
|
|
@@ -221,7 +225,7 @@ export const ChatComposer = memo(
|
|
|
221
225
|
const handleInputContentSizeChange = useCallback(
|
|
222
226
|
(event: NativeSyntheticEvent<TextInputContentSizeChangeEventData>) => {
|
|
223
227
|
const { height } = event.nativeEvent.contentSize;
|
|
224
|
-
setIsInputWrapped(height >
|
|
228
|
+
setIsInputWrapped(height > WRAPPED_HEIGHT_THRESHOLD);
|
|
225
229
|
},
|
|
226
230
|
[]
|
|
227
231
|
);
|
|
@@ -242,14 +246,10 @@ export const ChatComposer = memo(
|
|
|
242
246
|
|
|
243
247
|
const renderEmojiNode = useCallback(
|
|
244
248
|
() => (
|
|
245
|
-
<KContainer.Touchable
|
|
246
|
-
marginR="0.5rem"
|
|
247
|
-
onPress={onPressEmoji}
|
|
248
|
-
activeOpacity={0.7}
|
|
249
|
-
>
|
|
249
|
+
<KContainer.Touchable marginR="0.5rem" onPress={onPressEmoji}>
|
|
250
250
|
<KImage.VectorIcons
|
|
251
251
|
name="sticker-o"
|
|
252
|
-
size={
|
|
252
|
+
size={24}
|
|
253
253
|
color={KColors.gray.normal}
|
|
254
254
|
/>
|
|
255
255
|
</KContainer.Touchable>
|
|
@@ -397,7 +397,7 @@ const styles = StyleSheet.create({
|
|
|
397
397
|
inputContainer: {
|
|
398
398
|
borderRadius: KSpacingValue['1.25rem'],
|
|
399
399
|
minHeight: 48,
|
|
400
|
-
paddingVertical:
|
|
400
|
+
paddingVertical: KSpacingValue['0.25rem'],
|
|
401
401
|
},
|
|
402
402
|
textInput: {
|
|
403
403
|
flex: 1,
|
|
@@ -407,6 +407,6 @@ const styles = StyleSheet.create({
|
|
|
407
407
|
color: KColors.palette.gray.w900,
|
|
408
408
|
paddingVertical: IS_IOS ? 0 : 4,
|
|
409
409
|
paddingHorizontal: IS_IOS ? 2 : 0,
|
|
410
|
-
|
|
410
|
+
includeFontPadding: false,
|
|
411
411
|
},
|
|
412
412
|
});
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { memo, useState, useCallback } from 'react';
|
|
2
|
-
import { StyleSheet } from 'react-native';
|
|
2
|
+
import { Platform, StyleSheet } from 'react-native';
|
|
3
3
|
import { KeyboardAvoidingView } from 'react-native-keyboard-controller';
|
|
4
|
+
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
4
5
|
import { KContainer } from '@droppii/libs';
|
|
5
6
|
import ChatDetailHeader from './ChatDetailHeader';
|
|
6
7
|
import { ChatList } from './ChatList';
|
|
@@ -14,6 +15,8 @@ const ChatDetail = memo(
|
|
|
14
15
|
avatarUri,
|
|
15
16
|
avatarFullName,
|
|
16
17
|
chatType,
|
|
18
|
+
chatCategory,
|
|
19
|
+
applicationType,
|
|
17
20
|
showAddMember,
|
|
18
21
|
onBack,
|
|
19
22
|
onPressSearch,
|
|
@@ -55,6 +58,7 @@ const ChatDetail = memo(
|
|
|
55
58
|
);
|
|
56
59
|
|
|
57
60
|
const currentInput = inputValue ?? internalInput;
|
|
61
|
+
const insets = useSafeAreaInsets();
|
|
58
62
|
|
|
59
63
|
return (
|
|
60
64
|
<KContainer.Page flex edges={['bottom']}>
|
|
@@ -64,6 +68,8 @@ const ChatDetail = memo(
|
|
|
64
68
|
avatarUri={avatarUri}
|
|
65
69
|
avatarFullName={avatarFullName}
|
|
66
70
|
chatType={chatType}
|
|
71
|
+
chatCategory={chatCategory}
|
|
72
|
+
applicationType={applicationType}
|
|
67
73
|
showAddMember={showAddMember}
|
|
68
74
|
onBack={onBack}
|
|
69
75
|
onPressSearch={onPressSearch}
|
|
@@ -75,6 +81,10 @@ const ChatDetail = memo(
|
|
|
75
81
|
<KeyboardAvoidingView
|
|
76
82
|
style={styles.keyboardAvoiding}
|
|
77
83
|
behavior="padding"
|
|
84
|
+
keyboardVerticalOffset={Platform.select({
|
|
85
|
+
android: insets.bottom,
|
|
86
|
+
default: 0,
|
|
87
|
+
})}
|
|
78
88
|
>
|
|
79
89
|
<ChatList
|
|
80
90
|
messages={messages}
|