@droppii-org/chat-mobile 0.2.89 → 0.2.91
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/context/ChatContext.js +5 -3
- package/lib/module/context/ChatContext.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/ChatDetail.js +64 -5
- package/lib/module/screens/chat-detail/ChatDetail.js.map +1 -1
- package/lib/module/screens/chat-detail/ChatListLegend.js +93 -123
- package/lib/module/screens/chat-detail/ChatListLegend.js.map +1 -1
- package/lib/module/screens/chat-detail/PinnedMessagesSheet.js +4 -1
- package/lib/module/screens/chat-detail/PinnedMessagesSheet.js.map +1 -1
- package/lib/module/screens/chat-detail/PinnedMessagesSheetBackup.js +3 -1
- package/lib/module/screens/chat-detail/PinnedMessagesSheetBackup.js.map +1 -1
- package/lib/module/screens/chat-detail/legend/LegendChatMessage.js +5 -4
- package/lib/module/screens/chat-detail/legend/LegendChatMessage.js.map +1 -1
- package/lib/module/screens/chat-detail/messageToolbox/MessageToolboxOverlay.js +18 -7
- package/lib/module/screens/chat-detail/messageToolbox/MessageToolboxOverlay.js.map +1 -1
- package/lib/module/screens/chat-detail/messageToolbox/messageToolbox.utils.js +3 -5
- package/lib/module/screens/chat-detail/messageToolbox/messageToolbox.utils.js.map +1 -1
- package/lib/module/services/apis.js +2 -1
- package/lib/module/services/apis.js.map +1 -1
- package/lib/module/store/message.js +1 -1
- package/lib/module/store/message.js.map +1 -1
- package/lib/module/store/user.js +6 -0
- package/lib/module/store/user.js.map +1 -1
- package/lib/module/translation/resources/i18n.js +1 -0
- package/lib/module/translation/resources/i18n.js.map +1 -1
- package/lib/module/types/chat.js.map +1 -1
- package/lib/typescript/src/context/ChatContext.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/ChatDetail.d.ts +2 -2
- package/lib/typescript/src/screens/chat-detail/ChatDetail.d.ts.map +1 -1
- package/lib/typescript/src/screens/chat-detail/ChatListLegend.d.ts.map +1 -1
- package/lib/typescript/src/screens/chat-detail/PinnedMessagesSheet.d.ts.map +1 -1
- package/lib/typescript/src/screens/chat-detail/PinnedMessagesSheetBackup.d.ts.map +1 -1
- package/lib/typescript/src/screens/chat-detail/legend/LegendChatMessage.d.ts +5 -3
- package/lib/typescript/src/screens/chat-detail/legend/LegendChatMessage.d.ts.map +1 -1
- package/lib/typescript/src/screens/chat-detail/messageToolbox/MessageToolboxOverlay.d.ts.map +1 -1
- package/lib/typescript/src/screens/chat-detail/messageToolbox/messageToolbox.utils.d.ts +2 -0
- package/lib/typescript/src/screens/chat-detail/messageToolbox/messageToolbox.utils.d.ts.map +1 -1
- package/lib/typescript/src/services/apis.d.ts.map +1 -1
- package/lib/typescript/src/store/user.d.ts +1 -0
- package/lib/typescript/src/store/user.d.ts.map +1 -1
- package/lib/typescript/src/translation/resources/i18n.d.ts.map +1 -1
- package/lib/typescript/src/types/chat.d.ts +4 -0
- package/lib/typescript/src/types/chat.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/context/ChatContext.tsx +3 -0
- package/src/index.tsx +1 -0
- package/src/screens/chat-detail/ChatDetail.tsx +63 -5
- package/src/screens/chat-detail/ChatListLegend.tsx +94 -156
- package/src/screens/chat-detail/PinnedMessagesSheet.tsx +6 -1
- package/src/screens/chat-detail/PinnedMessagesSheetBackup.tsx +3 -1
- package/src/screens/chat-detail/legend/LegendChatMessage.tsx +9 -6
- package/src/screens/chat-detail/messageToolbox/MessageToolboxOverlay.tsx +20 -7
- package/src/screens/chat-detail/messageToolbox/messageToolbox.utils.ts +4 -4
- package/src/services/apis.ts +2 -1
- package/src/store/message.ts +1 -1
- package/src/store/user.ts +7 -0
- package/src/translation/resources/i18n.ts +2 -0
- package/src/types/chat.ts +14 -0
|
@@ -22,7 +22,8 @@ const ChatProviderInner = ({
|
|
|
22
22
|
children,
|
|
23
23
|
applicationType,
|
|
24
24
|
getChatToken,
|
|
25
|
-
onFlashMessagePress
|
|
25
|
+
onFlashMessagePress,
|
|
26
|
+
generateChatDetailLink
|
|
26
27
|
}) => {
|
|
27
28
|
const [isShowFLashMessage, setShow] = useState(true);
|
|
28
29
|
const handleLoginSdk = useCallback(async () => {
|
|
@@ -68,8 +69,9 @@ const ChatProviderInner = ({
|
|
|
68
69
|
onPressFlashMessage,
|
|
69
70
|
isShowFLashMessage,
|
|
70
71
|
setIsShowFLashMessage,
|
|
71
|
-
handleLoginSdk
|
|
72
|
-
|
|
72
|
+
handleLoginSdk,
|
|
73
|
+
generateChatDetailLink
|
|
74
|
+
}), [logGA, applicationType, onPressFlashMessage, isShowFLashMessage, setIsShowFLashMessage, handleLoginSdk, generateChatDetailLink]);
|
|
73
75
|
const {
|
|
74
76
|
top
|
|
75
77
|
} = useSafeAreaInsets();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["createContext","useCallback","useContext","useEffect","useMemo","useState","OpenIMSDK","LoginStatus","Toast","useChatSdk","useSafeAreaInsets","uuid","useUserStore","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","ChatContext","undefined","useChatContext","context","Error","ChatProviderInner","logGA","children","applicationType","getChatToken","onFlashMessagePress","isShowFLashMessage","setShow","handleLoginSdk","res","token","getState","setToken","loginStatus","getLoginStatus","id","Logout","login","userID","v4","userInfo","getSelfUserInfo","setUser","Logged","error","console","onPressFlashMessage","c","setIsShowFLashMessage","v","value","top","Provider","ChatSdkBridge","topOffset","ChatProvider","props","enabled"],"sourceRoot":"../../../src","sources":["context/ChatContext.tsx"],"mappings":";;AAAA,SACEA,aAAa,EACbC,WAAW,EACXC,UAAU,EACVC,SAAS,EACTC,OAAO,EACPC,QAAQ,QACH,OAAO;AAEd,OAAOC,SAAS,IACdC,WAAW,QAEN,+BAA+B;AACtC,OAAOC,KAAK,MAAM,4BAA4B;AAC9C,SAASC,UAAU,QAAQ,kBAAS;AACpC,SAASC,iBAAiB,QAAQ,gCAAgC;AAClE,OAAOC,IAAI,MAAM,mBAAmB;AACpC,SAASC,YAAY,QAAQ,mBAAU;AACvC;AAAA,SAAAC,GAAA,IAAAC,IAAA,EAAAC,QAAA,IAAAC,SAAA,EAAAC,IAAA,IAAAC,KAAA;AAEA,OAAO,MAAMC,WAAW,gBAAGnB,aAAa,CACtCoB,SACF,CAAC;AAED,OAAO,MAAMC,cAAc,GAAGA,CAAA,KAAuB;EACnD,MAAMC,OAAO,GAAGpB,UAAU,CAACiB,WAAW,CAAC;EACvC,IAAI,CAACG,OAAO,EAAE;IACZ,MAAM,IAAIC,KAAK,CAAC,iDAAiD,CAAC;EACpE;EACA,OAAOD,OAAO;AAChB,CAAC;AAED,MAAME,iBAAiB,GAAGA,CAAC;EACzBC,KAAK;EACLC,QAAQ;EACRC,eAAe;EACfC,YAAY;EACZC;AACiB,CAAC,KAAK;EACvB,MAAM,CAACC,kBAAkB,EAAEC,OAAO,CAAC,
|
|
1
|
+
{"version":3,"names":["createContext","useCallback","useContext","useEffect","useMemo","useState","OpenIMSDK","LoginStatus","Toast","useChatSdk","useSafeAreaInsets","uuid","useUserStore","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","ChatContext","undefined","useChatContext","context","Error","ChatProviderInner","logGA","children","applicationType","getChatToken","onFlashMessagePress","generateChatDetailLink","isShowFLashMessage","setShow","handleLoginSdk","res","token","getState","setToken","loginStatus","getLoginStatus","id","Logout","login","userID","v4","userInfo","getSelfUserInfo","setUser","Logged","error","console","onPressFlashMessage","c","setIsShowFLashMessage","v","value","top","Provider","ChatSdkBridge","topOffset","ChatProvider","props","enabled"],"sourceRoot":"../../../src","sources":["context/ChatContext.tsx"],"mappings":";;AAAA,SACEA,aAAa,EACbC,WAAW,EACXC,UAAU,EACVC,SAAS,EACTC,OAAO,EACPC,QAAQ,QACH,OAAO;AAEd,OAAOC,SAAS,IACdC,WAAW,QAEN,+BAA+B;AACtC,OAAOC,KA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AkB,EAClBsB,qBAAqB,EACrBpB,cAAc,EACdH,sBAAsB,CAE1B,CAAC;EAED,MAAM;IAAE0B;EAAI,CAAC,GAAG9C,iBAAiB,CAAC,CAAC;EACnC,oBACEI,IAAA,CAACK,WAAW,CAACsC,QAAQ;IAACF,KAAK,EAAEA,KAAM;IAAA7B,QAAA,eAE/BR,KAAA,CAAAF,SAAA;MAAAU,QAAA,gBACEZ,IAAA,CAAC4C,aAAa,IAAE,CAAC,EAChBhC,QAAQ,eACTZ,IAAA,CAACN,KAAK;QAACmD,SAAS,EAAEH;MAAI,CAAE,CAAC;IAAA,CACzB;EAAC,CAEe,CAAC;AAE3B,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA,MAAME,aAAa,GAAGA,CAAA,KAAM;EAC1BjD,UAAU,CAAC,CAAC;EACZ,OAAO,IAAI;AACb,CAAC;AAED,OAAO,MAAMmD,YAAY,GAAGA,CAAC;EAAE,GAAGC;AAAyB,CAAC,KAAK;EAC/D,MAAM;IAAEC,OAAO,GAAG;EAAK,CAAC,GAAGD,KAAK;EAEhC,IAAI,CAACC,OAAO,EAAE;IACZ,OAAOD,KAAK,CAACnC,QAAQ;EACvB;EAEA,oBAAOZ,IAAA,CAACU,iBAAiB;IAAA,GAAKqC;EAAK,CAAG,CAAC;AACzC,CAAC","ignoreList":[]}
|
package/lib/module/index.js
CHANGED
|
@@ -14,6 +14,7 @@ export { useMediaViewer } from "./hooks/useMediaViewer.js";
|
|
|
14
14
|
export * from "./types/chat.js";
|
|
15
15
|
export * from "./types/imageUpload.js";
|
|
16
16
|
export * from "./types/attachment.js";
|
|
17
|
+
export * from "./types/events.js";
|
|
17
18
|
export { initializeAttachmentHandlers } from "./services/attachmentHandlers/index.js";
|
|
18
19
|
export { AttachmentOrchestratorService } from "./services/attachmentOrchestrator.js";
|
|
19
20
|
export { Avatar } from "./components/Avatar/index.js";
|
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["ChatAPI","setAuthToken","getAuthToken","clearAuthToken","setTokenRefreshCallback","setTokenRefreshFailedCallback","refreshAuthToken","initBaseUrl","getBaseUrl","Config","useImageAttachment","useMediaViewer","initializeAttachmentHandlers","AttachmentOrchestratorService","Avatar","ThreadCard","AttachmentPreview","MediaViewerModal","Inbox","default","MediaViewerScreen","ResourceCenterScreen","SearchConversation","SearchMessage","LoginStatus","MessageType","GroupJoinSource","registerUIUtils","UIUtils","DFlowContext"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,SAASA,OAAO,QAAQ,qBAAY;AACpC,SACEC,YAAY,EACZC,YAAY,EACZC,cAAc,EACdC,uBAAuB,EACvBC,6BAA6B,EAC7BC,gBAAgB,QACX,oBAAiB;AACxB,SAASC,WAAW,EAAEC,UAAU,QAAQ,2BAAwB;AAChE,SAASC,MAAM,QAAQ,mBAAU;AACjC,cAAc,iBAAQ;AACtB,cAAc,kBAAS;AACvB,cAAc,oBAAW;AACzB,cAAc,gCAA6B;AAC3C,cAAc,mCAAgC;AAC9C,SAASC,kBAAkB,QAAQ,+BAA4B;AAC/D,SAASC,cAAc,QAAQ,2BAAwB;AAEvD,cAAc,iBAAc;AAC5B,cAAc,wBAAqB;AACnC,cAAc,uBAAoB;AAClC,SAASC,4BAA4B,QAAQ,wCAA+B;AAC5E,SAASC,6BAA6B,QAAQ,sCAAmC;AACjF,SAASC,MAAM,QAAQ,8BAAqB;AAC5C,SAASC,UAAU,QAAQ,kCAAyB;AACpD,SAASC,iBAAiB,QAAQ,yCAAgC;AAClE,SAASC,gBAAgB,QAAQ,kCAA+B;AAChE,SAASC,KAAK,QAAQ,0BAAiB;AACvC,SAASC,OAAO,IAAIC,iBAAiB,QAAQ,8BAAqB;AAClE,SAASD,OAAO,IAAIE,oBAAoB,QAAQ,mCAA0B;AAE1E,SAASF,OAAO,IAAIG,kBAAkB,QAAQ,uCAA8B;AAC5E,SAASH,OAAO,IAAII,aAAa,QAAQ,kCAAyB;AAClE,cAAc,gCAAuB;AACrC,cAAc,6BAAoB;AAOlC,SACEC,WAAW,EACXC,WAAW,EACXC,eAAe,QACV,+BAA+B;AACtC,cAAc,gCAAuB;AAgBrC,SAASC,eAAe,EAAEC,OAAO,QAAQ,oBAAiB;AAE1D,SAASC,YAAY,QAAQ,kBAAe","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["ChatAPI","setAuthToken","getAuthToken","clearAuthToken","setTokenRefreshCallback","setTokenRefreshFailedCallback","refreshAuthToken","initBaseUrl","getBaseUrl","Config","useImageAttachment","useMediaViewer","initializeAttachmentHandlers","AttachmentOrchestratorService","Avatar","ThreadCard","AttachmentPreview","MediaViewerModal","Inbox","default","MediaViewerScreen","ResourceCenterScreen","SearchConversation","SearchMessage","LoginStatus","MessageType","GroupJoinSource","registerUIUtils","UIUtils","DFlowContext"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,SAASA,OAAO,QAAQ,qBAAY;AACpC,SACEC,YAAY,EACZC,YAAY,EACZC,cAAc,EACdC,uBAAuB,EACvBC,6BAA6B,EAC7BC,gBAAgB,QACX,oBAAiB;AACxB,SAASC,WAAW,EAAEC,UAAU,QAAQ,2BAAwB;AAChE,SAASC,MAAM,QAAQ,mBAAU;AACjC,cAAc,iBAAQ;AACtB,cAAc,kBAAS;AACvB,cAAc,oBAAW;AACzB,cAAc,gCAA6B;AAC3C,cAAc,mCAAgC;AAC9C,SAASC,kBAAkB,QAAQ,+BAA4B;AAC/D,SAASC,cAAc,QAAQ,2BAAwB;AAEvD,cAAc,iBAAc;AAC5B,cAAc,wBAAqB;AACnC,cAAc,uBAAoB;AAClC,cAAc,mBAAgB;AAC9B,SAASC,4BAA4B,QAAQ,wCAA+B;AAC5E,SAASC,6BAA6B,QAAQ,sCAAmC;AACjF,SAASC,MAAM,QAAQ,8BAAqB;AAC5C,SAASC,UAAU,QAAQ,kCAAyB;AACpD,SAASC,iBAAiB,QAAQ,yCAAgC;AAClE,SAASC,gBAAgB,QAAQ,kCAA+B;AAChE,SAASC,KAAK,QAAQ,0BAAiB;AACvC,SAASC,OAAO,IAAIC,iBAAiB,QAAQ,8BAAqB;AAClE,SAASD,OAAO,IAAIE,oBAAoB,QAAQ,mCAA0B;AAE1E,SAASF,OAAO,IAAIG,kBAAkB,QAAQ,uCAA8B;AAC5E,SAASH,OAAO,IAAII,aAAa,QAAQ,kCAAyB;AAClE,cAAc,gCAAuB;AACrC,cAAc,6BAAoB;AAOlC,SACEC,WAAW,EACXC,WAAW,EACXC,eAAe,QACV,+BAA+B;AACtC,cAAc,gCAAuB;AAgBrC,SAASC,eAAe,EAAEC,OAAO,QAAQ,oBAAiB;AAE1D,SAASC,YAAY,QAAQ,kBAAe","ignoreList":[]}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import { memo, useCallback, useEffect, useRef } from 'react';
|
|
4
|
-
import { DeviceEventEmitter } from 'react-native';
|
|
4
|
+
import { ActivityIndicator, DeviceEventEmitter } from 'react-native';
|
|
5
5
|
import { useKeyboardScrollToEnd } from '@legendapp/list/keyboard';
|
|
6
6
|
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
7
|
-
import { KContainer } from '@droppii/libs';
|
|
8
|
-
import { useNavigation } from '@react-navigation/native';
|
|
7
|
+
import { KColors, KContainer, KNavigation } from '@droppii/libs';
|
|
8
|
+
import { useNavigation, useRoute } from '@react-navigation/native';
|
|
9
9
|
import { usePinMessage } from "../../hooks/message/usePinMessage.js";
|
|
10
10
|
import { PinnedMessageBar } from "./PinnedMessageBar.js";
|
|
11
11
|
import { openPinnedMessagesSheet } from "./PinnedMessagesSheet.js";
|
|
@@ -24,6 +24,9 @@ import { ChatEvent } from "../../types/events.js";
|
|
|
24
24
|
import { useSetIsShowFLashMessage } from "../../context/global.js";
|
|
25
25
|
import { useJoinGroup } from "../../hooks/groups/useJoinGroup.js";
|
|
26
26
|
import { useGroupAccessGuard } from "../../hooks/groups/useGroupAccessGuard.js";
|
|
27
|
+
import { isMessageRevoked } from "../../utils/messageUtils.js";
|
|
28
|
+
import { UIUtils } from "../../utils/UIUtils.js";
|
|
29
|
+
import { trans } from "../../translation/index.js";
|
|
27
30
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
28
31
|
const ChatDetail = /*#__PURE__*/memo(({
|
|
29
32
|
targetConversationId = '',
|
|
@@ -106,6 +109,25 @@ const ChatDetail = /*#__PURE__*/memo(({
|
|
|
106
109
|
groupID: conversation?.groupID || targetGroupId,
|
|
107
110
|
onBlocked: handleAccessBlocked
|
|
108
111
|
});
|
|
112
|
+
|
|
113
|
+
// Scroll to the target message if it exists in the current message list
|
|
114
|
+
// And show a toast if the message is revoked.
|
|
115
|
+
const params = useRoute().params;
|
|
116
|
+
useEffect(() => {
|
|
117
|
+
if (!targetMessageId || initLoading) return;
|
|
118
|
+
const targetMessage = messages.find(m => m.clientMsgID === targetMessageId);
|
|
119
|
+
if (!targetMessage) return;
|
|
120
|
+
DeviceEventEmitter.emit(ChatEvent.ScrollToMessage, {
|
|
121
|
+
clientMessageId: targetMessageId
|
|
122
|
+
});
|
|
123
|
+
if (isMessageRevoked(targetMessage)) {
|
|
124
|
+
UIUtils.toast.open({
|
|
125
|
+
title: trans('chat:target_message_unavailable'),
|
|
126
|
+
theme: 'error'
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
130
|
+
}, [params]);
|
|
109
131
|
const resolvedShowAddMember = showAddMember ?? shouldShowAddMember(conversation);
|
|
110
132
|
const insets = useSafeAreaInsets();
|
|
111
133
|
const listRef = useRef(null);
|
|
@@ -197,6 +219,43 @@ const ChatDetail = /*#__PURE__*/memo(({
|
|
|
197
219
|
})]
|
|
198
220
|
});
|
|
199
221
|
});
|
|
200
|
-
|
|
201
|
-
|
|
222
|
+
export default props => {
|
|
223
|
+
const isUserLoaded = useUserStore(s => s.user != null);
|
|
224
|
+
const navigation = useNavigation();
|
|
225
|
+
|
|
226
|
+
// Handle sdk not loaded yet when navigate using deeplink
|
|
227
|
+
if (!isUserLoaded) {
|
|
228
|
+
return /*#__PURE__*/_jsxs(KContainer.Page, {
|
|
229
|
+
flex: true,
|
|
230
|
+
edges: ['bottom'],
|
|
231
|
+
children: [/*#__PURE__*/_jsx(KNavigation.Header, {
|
|
232
|
+
theme: "light",
|
|
233
|
+
alignment: "left",
|
|
234
|
+
size: "small",
|
|
235
|
+
disableCenterSpace: true,
|
|
236
|
+
shadow: true,
|
|
237
|
+
leftButton: {
|
|
238
|
+
id: 'back',
|
|
239
|
+
icon: {
|
|
240
|
+
size: 24,
|
|
241
|
+
vectorName: 'arrow-left-o',
|
|
242
|
+
vectorProvider: 'DroppiiNew',
|
|
243
|
+
tintColor: KColors.primary.normal
|
|
244
|
+
},
|
|
245
|
+
onPress: navigation.goBack
|
|
246
|
+
}
|
|
247
|
+
}), /*#__PURE__*/_jsx(KContainer.View, {
|
|
248
|
+
flex: true,
|
|
249
|
+
center: true,
|
|
250
|
+
children: /*#__PURE__*/_jsx(ActivityIndicator, {
|
|
251
|
+
size: "small",
|
|
252
|
+
color: KColors.primary.normal
|
|
253
|
+
})
|
|
254
|
+
})]
|
|
255
|
+
});
|
|
256
|
+
}
|
|
257
|
+
return /*#__PURE__*/_jsx(ChatDetail, {
|
|
258
|
+
...props
|
|
259
|
+
});
|
|
260
|
+
};
|
|
202
261
|
//# sourceMappingURL=ChatDetail.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["memo","useCallback","useEffect","useRef","DeviceEventEmitter","useKeyboardScrollToEnd","useSafeAreaInsets","KContainer","useNavigation","usePinMessage","PinnedMessageBar","openPinnedMessagesSheet","MediaViewerModal","useConversation","useConversationStore","useUserStore","ChatDetailHeader","ChatListLegend","ChatComposer","shouldShowAddMember","normalizeUrl","MessageToolboxOverlay","useGetConversationDetail","useGetConversationTarget","GroupJoinSource","useMessages","ChatEvent","useSetIsShowFLashMessage","useJoinGroup","useGroupAccessGuard","jsx","_jsx","jsxs","_jsxs","ChatDetail","targetConversationId","targetUserId","targetGroupId","targetBotId","targetMessageId","showAddMember","onBack","onPressSearch","onPressAddMember","onPressMenu","onPressUrl","customMessageItemFactory","pannelActions","groupJoinSource","navigation","mediaViewerRef","messageToolboxRef","currentUser","s","user","conversationId","isLoading","isLoadingConversation","conversation","data","target","isComposeDisabled","isActive","handleBackDefault","goBack","handleMediaPress","items","index","current","show","messages","initLoading","moreOldLoading","moreNewLoading","getMoreOldMessages","getMoreNewMessages","hasMoreOld","hasMoreNew","startClientMsgId","peerType","mutate","joinGroup","isPending","isJoiningGroup","setShowFLashMessage","pinnedMessages","pinMessage","unpinMessage","getState","setCurrentConversation","undefined","handleAccessBlocked","isCheckingAccess","groupID","onBlocked","resolvedShowAddMember","insets","listRef","freeze","scrollMessageToEnd","handlePressUrl","url","handleMessageLongPress","message","rect","handlePressPinnedMessageBar","currentUserId","userID","onPressMessage","
|
|
1
|
+
{"version":3,"names":["memo","useCallback","useEffect","useRef","ActivityIndicator","DeviceEventEmitter","useKeyboardScrollToEnd","useSafeAreaInsets","KColors","KContainer","KNavigation","useNavigation","useRoute","usePinMessage","PinnedMessageBar","openPinnedMessagesSheet","MediaViewerModal","useConversation","useConversationStore","useUserStore","ChatDetailHeader","ChatListLegend","ChatComposer","shouldShowAddMember","normalizeUrl","MessageToolboxOverlay","useGetConversationDetail","useGetConversationTarget","GroupJoinSource","useMessages","ChatEvent","useSetIsShowFLashMessage","useJoinGroup","useGroupAccessGuard","isMessageRevoked","UIUtils","trans","jsx","_jsx","jsxs","_jsxs","ChatDetail","targetConversationId","targetUserId","targetGroupId","targetBotId","targetMessageId","showAddMember","onBack","onPressSearch","onPressAddMember","onPressMenu","onPressUrl","customMessageItemFactory","pannelActions","groupJoinSource","navigation","mediaViewerRef","messageToolboxRef","currentUser","s","user","conversationId","isLoading","isLoadingConversation","conversation","data","target","isComposeDisabled","isActive","handleBackDefault","goBack","handleMediaPress","items","index","current","show","messages","initLoading","moreOldLoading","moreNewLoading","getMoreOldMessages","getMoreNewMessages","hasMoreOld","hasMoreNew","startClientMsgId","peerType","mutate","joinGroup","isPending","isJoiningGroup","setShowFLashMessage","pinnedMessages","pinMessage","unpinMessage","getState","setCurrentConversation","undefined","handleAccessBlocked","isCheckingAccess","groupID","onBlocked","params","targetMessage","find","m","clientMsgID","emit","ScrollToMessage","clientMessageId","toast","open","title","theme","resolvedShowAddMember","insets","listRef","freeze","scrollMessageToEnd","handlePressUrl","url","handleMessageLongPress","message","rect","handlePressPinnedMessageBar","currentUserId","userID","onPressMessage","handlePressMenu","handlePressJoinGroup","reqMsg","joinSource","Search","groupName","showName","Page","flex","edges","children","onPressAvatar","onPress","onLoadMoreOld","onLoadMoreNew","onMediaPress","onLongPress","keyboardOffset","bottom","isEmptyMessage","length","onPressJoinGroup","ref","onPinMessage","onUnpinMessage","props","isUserLoaded","Header","alignment","size","disableCenterSpace","shadow","leftButton","id","icon","vectorName","vectorProvider","tintColor","primary","normal","View","center","color"],"sourceRoot":"../../../../src","sources":["screens/chat-detail/ChatDetail.tsx"],"mappings":";;AAAA,SAASA,IAAI,EAAEC,WAAW,EAAEC,SAAS,EAAEC,MAAM,QAAQ,OAAO;AAC5D,SAASC,iBAAiB,EAAEC,kBAAkB,QAAQ,cAAc;AAEpE,SAASC,sBAAsB,QAAQ,0BAA0B;AAEjE,SAASC,iBAAiB,QAAQ,gCAAgC;AAClE,SAASC,OAAO,EAAEC,UAAU,EAAEC,WAAW,QAAQ,eAAe;AAChE,SAASC,aAAa,EAAEC,QAAQ,QAAQ,0BAA0B;AAClE,SAASC,aAAa,QAAQ,sCAAmC;AACjE,SAASC,gBAAgB,QAAQ,uBAAoB;AACrD,SAASC,uBAAuB,QAAQ,0BAAuB;AAC/D,SACEC,gBAAgB,QAEX,sCAAmC;AAC1C,SACEC,eAAe,EACfC,oBAAoB,EACpBC,YAAY,QACP,sBAAa;AACpB,OAAOC,gBAA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NC,UAAU,EAAE;UACVC,EAAE,EAAE,MAAM;UACVC,IAAI,EAAE;YACJL,IAAI,EAAE,EAAE;YACRM,UAAU,EAAE,cAAc;YAC1BC,cAAc,EAAE,YAAY;YAC5BC,SAAS,EAAE7J,OAAO,CAAC8J,OAAO,CAACC;UAC7B,CAAC;UACD3B,OAAO,EAAEpF,UAAU,CAACe;QACtB;MAAE,CACH,CAAC,eACFjC,IAAA,CAAC7B,UAAU,CAAC+J,IAAI;QAAChC,IAAI;QAACiC,MAAM;QAAA/B,QAAA,eAC1BpG,IAAA,CAAClC,iBAAiB;UAACyJ,IAAI,EAAC,OAAO;UAACa,KAAK,EAAElK,OAAO,CAAC8J,OAAO,CAACC;QAAO,CAAE;MAAC,CAClD,CAAC;IAAA,CACH,CAAC;EAEtB;EAEA,oBAAOjI,IAAA,CAACG,UAAU;IAAA,GAAKgH;EAAK,CAAG,CAAC;AAClC,CAAC","ignoreList":[]}
|
|
@@ -35,14 +35,15 @@ import ChatImageDimens, { CHAT_IMAGE_VIEW_SOURCE } from "../../utils/chatImageDi
|
|
|
35
35
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
36
36
|
const ROW_MARGIN_CLUSTER_END = KSpacingValue['0.5rem'];
|
|
37
37
|
const ROW_MARGIN_IN_CLUSTER = KSpacingValue['0.25rem'];
|
|
38
|
-
|
|
39
|
-
// Tags every __DEV__ diagnostic log below with the platform, so logs from an
|
|
40
|
-
// iOS and an Android run can be told apart when compared side by side.
|
|
41
|
-
const LOG_TAG = `[ChatListLegend:${Platform.OS}]`;
|
|
42
38
|
const BUTTON_FADE_CONFIG = {
|
|
43
39
|
duration: 200,
|
|
44
40
|
easing: Easing.out(Easing.ease)
|
|
45
41
|
};
|
|
42
|
+
|
|
43
|
+
// Long enough to swallow Android's willShow→willHide→willShow flapping
|
|
44
|
+
// (~1.3s period, measured), short enough that a real keyboard close still
|
|
45
|
+
// settles within one animation.
|
|
46
|
+
const KEYBOARD_HIDE_DEBOUNCE_MS = 300;
|
|
46
47
|
const getRowMarginBottom = position => position === 'last' || position === 'solo' ? ROW_MARGIN_CLUSTER_END : ROW_MARGIN_IN_CLUSTER;
|
|
47
48
|
export const ChatListLegend = /*#__PURE__*/memo(({
|
|
48
49
|
messages = [],
|
|
@@ -85,16 +86,6 @@ export const ChatListLegend = /*#__PURE__*/memo(({
|
|
|
85
86
|
const last = messages[messages.length - 1];
|
|
86
87
|
return last?.clientMsgID || last?.serverMsgID || null;
|
|
87
88
|
}, [messages]);
|
|
88
|
-
// Stopgap for the keyboard-open blank-gap bug (unresolved upstream —
|
|
89
|
-
// see project_chatlistlegend_scroll_debugging memory): below this
|
|
90
|
-
// threshold, disable `alignItemsAtEnd` and let plain CSS `flex-end`
|
|
91
|
-
// anchor short content to the bottom instead. Known trade-off (same
|
|
92
|
-
// memory, bug #17/#19): disabling `alignItemsAtEnd` removes the extra
|
|
93
|
-
// scrollable room `clampScrollOffset` needs, so sending a message while
|
|
94
|
-
// the keyboard is open on one of these same short conversations can
|
|
95
|
-
// land the new message away from the composer instead of scrolling to
|
|
96
|
-
// it — verify that scenario specifically after any change here.
|
|
97
|
-
const isVeryShortConversation = messages.length < 15;
|
|
98
89
|
const {
|
|
99
90
|
mutate: runFlow
|
|
100
91
|
} = useRunFlow();
|
|
@@ -104,15 +95,10 @@ export const ChatListLegend = /*#__PURE__*/memo(({
|
|
|
104
95
|
const buttonOpacity = useSharedValue(0);
|
|
105
96
|
const isAtBottomRef = useRef(true);
|
|
106
97
|
const scrollDebounceRef = useRef(undefined);
|
|
107
|
-
//
|
|
108
|
-
//
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
// `handleScroll` below to auto-detect the known issue where that native
|
|
112
|
-
// inset silently fails to apply (confirmed via manual trace: contentOffset
|
|
113
|
-
// scrolls correctly but contentInset stays {bottom:0} on this RN/Reanimated/
|
|
114
|
-
// Old-Architecture combo, leaving a blank gap past the real content end).
|
|
115
|
-
const expectedKeyboardInsetRef = useRef(0);
|
|
98
|
+
// Current keyboard height, and the trigger for the re-anchor effect
|
|
99
|
+
// below — see the keyboard listener for how each platform uses it.
|
|
100
|
+
const [keyboardInset, setKeyboardInset] = useState(0);
|
|
101
|
+
const hasSeenFirstKeyboardInsetRef = useRef(false);
|
|
116
102
|
const rowRefsMap = useRef(new Map());
|
|
117
103
|
// Set on a real touch-drag (`onScrollBeginDrag`), before onStartReached/
|
|
118
104
|
// onEndReached's threshold could fire. `onMomentumScrollBegin` was tried
|
|
@@ -212,13 +198,14 @@ export const ChatListLegend = /*#__PURE__*/memo(({
|
|
|
212
198
|
collapsable: false,
|
|
213
199
|
children: /*#__PURE__*/_jsx(LegendChatMessage, {
|
|
214
200
|
message: message,
|
|
201
|
+
messageId: messageId,
|
|
215
202
|
isOutgoing: isOutgoing,
|
|
216
203
|
createdAtTime: createdAt,
|
|
217
204
|
onMediaPress: onMediaPress,
|
|
218
205
|
onPressUrl: onPressUrl,
|
|
219
206
|
onRetry: retryMessage,
|
|
220
|
-
onPress:
|
|
221
|
-
onLongPress: onLongPress ?
|
|
207
|
+
onPress: handleMessagePress,
|
|
208
|
+
onLongPress: onLongPress ? handleMessageLongPress : undefined,
|
|
222
209
|
customMessageItemFactory: customMessageItemFactory,
|
|
223
210
|
isHighlighted: highlightedId === messageId,
|
|
224
211
|
isTimeRevealed: revealedMessageId === messageId,
|
|
@@ -335,44 +322,20 @@ export const ChatListLegend = /*#__PURE__*/memo(({
|
|
|
335
322
|
revealedMessageId
|
|
336
323
|
}), [messageDataMap, conversationFlow?.flowCurrentStep?.id, lastMessageId, highlightedId, revealedMessageId]);
|
|
337
324
|
const handleStartReached = useCallback(() => {
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
hasMoreOld,
|
|
343
|
-
moreOldLoading: useMessageStore.getState().moreOldLoading
|
|
344
|
-
});
|
|
345
|
-
}
|
|
346
|
-
if (!hasUserScrolledRef.current) {
|
|
347
|
-
const wouldHaveLoaded = __DEV__ && hasMoreOld && !useMessageStore.getState().moreOldLoading;
|
|
348
|
-
if (wouldHaveLoaded) {
|
|
349
|
-
console.warn(`${LOG_TAG} onStartReached fired before user scroll — suppressed`, {
|
|
350
|
-
conversationId,
|
|
351
|
-
hasMoreOld
|
|
352
|
-
});
|
|
353
|
-
}
|
|
354
|
-
return;
|
|
355
|
-
}
|
|
325
|
+
// Both thresholds are checked continuously, including at mount before
|
|
326
|
+
// any gesture — `hasUserScrolledRef` is what keeps that from firing a
|
|
327
|
+
// load-more the user never asked for.
|
|
328
|
+
if (!hasUserScrolledRef.current) return;
|
|
356
329
|
if (hasMoreOld && !useMessageStore.getState().moreOldLoading) {
|
|
357
330
|
onLoadMoreOld?.(true);
|
|
358
331
|
}
|
|
359
|
-
}, [
|
|
332
|
+
}, [hasMoreOld, onLoadMoreOld]);
|
|
360
333
|
const handleEndReached = useCallback(() => {
|
|
361
|
-
if (!hasUserScrolledRef.current)
|
|
362
|
-
const wouldHaveLoaded = __DEV__ && hasMoreNew && !useMessageStore.getState().moreNewLoading;
|
|
363
|
-
if (wouldHaveLoaded) {
|
|
364
|
-
console.warn(`${LOG_TAG} onEndReached fired before user scroll — suppressed`, {
|
|
365
|
-
conversationId,
|
|
366
|
-
hasMoreNew
|
|
367
|
-
});
|
|
368
|
-
}
|
|
369
|
-
return;
|
|
370
|
-
}
|
|
334
|
+
if (!hasUserScrolledRef.current) return;
|
|
371
335
|
if (hasMoreNew && !useMessageStore.getState().moreNewLoading) {
|
|
372
|
-
if (__DEV__) console.log(`${LOG_TAG} handleEndReached`);
|
|
373
336
|
onLoadMoreNew?.(true);
|
|
374
337
|
}
|
|
375
|
-
}, [
|
|
338
|
+
}, [hasMoreNew, onLoadMoreNew]);
|
|
376
339
|
const handleScrollBeginDrag = useCallback(() => {
|
|
377
340
|
hasUserScrolledRef.current = true;
|
|
378
341
|
}, []);
|
|
@@ -380,30 +343,9 @@ export const ChatListLegend = /*#__PURE__*/memo(({
|
|
|
380
343
|
const {
|
|
381
344
|
contentOffset,
|
|
382
345
|
contentSize,
|
|
383
|
-
layoutMeasurement
|
|
384
|
-
contentInset
|
|
346
|
+
layoutMeasurement
|
|
385
347
|
} = e.nativeEvent;
|
|
386
348
|
const isAtBottom = contentOffset.y + layoutMeasurement.height >= contentSize.height - 100;
|
|
387
|
-
if (__DEV__) {
|
|
388
|
-
const expected = expectedKeyboardInsetRef.current;
|
|
389
|
-
const actual = contentInset?.bottom ?? 0;
|
|
390
|
-
// `contentInset` failing to apply is a constant, systemic mismatch
|
|
391
|
-
// (present regardless of conversation length) — but it only shows
|
|
392
|
-
// up as a visible gap once the scroll position has actually moved
|
|
393
|
-
// past the real end of content. Gate on that so the warning fires
|
|
394
|
-
// only when the bug is actually visible, not on every keyboard
|
|
395
|
-
// open in every conversation.
|
|
396
|
-
const scrolledPastRealContentEnd = contentOffset.y + layoutMeasurement.height > contentSize.height;
|
|
397
|
-
if (expected > 0 && Math.abs(actual - expected) > 5 && scrolledPastRealContentEnd) {
|
|
398
|
-
console.warn(`${LOG_TAG} keyboard contentInset mismatch — expected bottom inset ~${expected} (keyboard open) but native reports ${actual}, and scroll position is past the real content end. This reproduces the known "blank gap" issue: contentOffset scrolls correctly but contentInset silently fails to apply.`, {
|
|
399
|
-
expected,
|
|
400
|
-
actual,
|
|
401
|
-
contentOffsetY: contentOffset.y,
|
|
402
|
-
contentSizeHeight: contentSize.height,
|
|
403
|
-
layoutHeight: layoutMeasurement.height
|
|
404
|
-
});
|
|
405
|
-
}
|
|
406
|
-
}
|
|
407
349
|
|
|
408
350
|
// Debounce animation updates
|
|
409
351
|
if (scrollDebounceRef.current) {
|
|
@@ -451,23 +393,71 @@ export const ChatListLegend = /*#__PURE__*/memo(({
|
|
|
451
393
|
};
|
|
452
394
|
}, []);
|
|
453
395
|
|
|
454
|
-
//
|
|
455
|
-
// `
|
|
456
|
-
//
|
|
457
|
-
//
|
|
396
|
+
// Tracks the keyboard's height as the trigger for the re-anchor below.
|
|
397
|
+
// The `willHide` side is debounced because Android's event stream flaps
|
|
398
|
+
// willShow→willHide→willShow roughly every 1.3s for as long as the
|
|
399
|
+
// keyboard stays open (measured on device) — without this, every flap
|
|
400
|
+
// would fire another scroll. A real close still lands, just one tick
|
|
401
|
+
// later. Setting the same height twice is a no-op for the effect below,
|
|
402
|
+
// so a stable open only ever re-anchors once.
|
|
403
|
+
//
|
|
404
|
+
// JS-thread only (no worklet), so none of the reentrant-lock crash risk
|
|
405
|
+
// that reaching into `useKeyboardHandler`'s worklets carries.
|
|
458
406
|
useEffect(() => {
|
|
459
|
-
|
|
407
|
+
let pendingHide;
|
|
408
|
+
const clearPendingHide = () => {
|
|
409
|
+
if (pendingHide) {
|
|
410
|
+
clearTimeout(pendingHide);
|
|
411
|
+
pendingHide = undefined;
|
|
412
|
+
}
|
|
413
|
+
};
|
|
414
|
+
const applyInset = nextInset => {
|
|
415
|
+
// Android only: the bottom inset the library applies there is a
|
|
416
|
+
// synthetic prop that `onScroll` does not report (its own
|
|
417
|
+
// `ScrollViewWithBottomPadding` says as much), so LegendList never
|
|
418
|
+
// learns about it, `alignItemsAtEndPadding` never shrinks, and the
|
|
419
|
+
// re-anchor below has no room to scroll into. Reporting it closes
|
|
420
|
+
// that gap. iOS needs none of this — there the inset is real and
|
|
421
|
+
// arrives through `onScroll` on its own, and overriding it here
|
|
422
|
+
// would double-count.
|
|
423
|
+
if (Platform.OS === 'android') {
|
|
424
|
+
listRef.current?.reportContentInset(nextInset > 0 ? {
|
|
425
|
+
bottom: nextInset
|
|
426
|
+
} : null);
|
|
427
|
+
}
|
|
428
|
+
setKeyboardInset(nextInset);
|
|
429
|
+
};
|
|
460
430
|
const willShow = KeyboardEvents.addListener('keyboardWillShow', e => {
|
|
461
|
-
|
|
431
|
+
clearPendingHide();
|
|
432
|
+
applyInset(Math.max(e.height - keyboardOffset, 0));
|
|
462
433
|
});
|
|
463
434
|
const willHide = KeyboardEvents.addListener('keyboardWillHide', () => {
|
|
464
|
-
|
|
435
|
+
clearPendingHide();
|
|
436
|
+
pendingHide = setTimeout(() => applyInset(0), KEYBOARD_HIDE_DEBOUNCE_MS);
|
|
465
437
|
});
|
|
466
438
|
return () => {
|
|
439
|
+
clearPendingHide();
|
|
467
440
|
willShow.remove();
|
|
468
441
|
willHide.remove();
|
|
469
442
|
};
|
|
470
|
-
}, [keyboardOffset]);
|
|
443
|
+
}, [keyboardOffset, listRef]);
|
|
444
|
+
|
|
445
|
+
// Re-anchors to the end once the keyboard's inset has landed, which puts
|
|
446
|
+
// the last message at exactly the spacing the closed-keyboard layout has
|
|
447
|
+
// (verified on device against both a 7-message and a long conversation).
|
|
448
|
+
// Skipped when the user has scrolled away from the bottom — opening the
|
|
449
|
+
// keyboard shouldn't yank them back down.
|
|
450
|
+
useEffect(() => {
|
|
451
|
+
if (!hasSeenFirstKeyboardInsetRef.current) {
|
|
452
|
+
hasSeenFirstKeyboardInsetRef.current = true;
|
|
453
|
+
return;
|
|
454
|
+
}
|
|
455
|
+
if (!isAtBottomRef.current) return;
|
|
456
|
+
scrollMessageToEnd({
|
|
457
|
+
animated: true,
|
|
458
|
+
closeKeyboard: false
|
|
459
|
+
});
|
|
460
|
+
}, [keyboardInset, scrollMessageToEnd]);
|
|
471
461
|
|
|
472
462
|
// This component can stay mounted across a conversationId change (e.g.
|
|
473
463
|
// navigation.replace reusing the same screen instance), so this ref must
|
|
@@ -492,47 +482,20 @@ export const ChatListLegend = /*#__PURE__*/memo(({
|
|
|
492
482
|
// handleListLoad's job), not a new message; a real id → a different
|
|
493
483
|
// one is.
|
|
494
484
|
const shouldFire = previousLastMessageId !== null && !!lastMessageId && !moreOldLoadingRef.current && isAtBottomRef.current;
|
|
495
|
-
if (__DEV__) {
|
|
496
|
-
console.log(`${LOG_TAG} lastMessageId effect — ${shouldFire ? 'firing animated scroll' : 'skipped'}`, {
|
|
497
|
-
conversationId,
|
|
498
|
-
lastMessageId,
|
|
499
|
-
initialPopulation: previousLastMessageId === null,
|
|
500
|
-
moreOldLoading: moreOldLoadingRef.current,
|
|
501
|
-
isAtBottom: isAtBottomRef.current
|
|
502
|
-
});
|
|
503
|
-
}
|
|
504
485
|
if (!shouldFire) return;
|
|
505
486
|
scrollMessageToEnd({
|
|
506
487
|
animated: true,
|
|
507
488
|
closeKeyboard: false
|
|
508
489
|
});
|
|
509
|
-
}, [lastMessageId, scrollMessageToEnd
|
|
510
|
-
const handleListLoad = useCallback(
|
|
490
|
+
}, [lastMessageId, scrollMessageToEnd]);
|
|
491
|
+
const handleListLoad = useCallback(() => {
|
|
511
492
|
if (hasCorrectedInitialPaddingRef.current) return;
|
|
512
493
|
hasCorrectedInitialPaddingRef.current = true;
|
|
513
|
-
|
|
514
|
-
// Diagnostic: how long bootstrap + the flush below each take.
|
|
515
|
-
if (__DEV__) {
|
|
516
|
-
console.log(`${LOG_TAG} onLoad (bootstrap settle done)`, {
|
|
517
|
-
conversationId,
|
|
518
|
-
messagesLength: messages.length,
|
|
519
|
-
elapsedTimeInMs: info.elapsedTimeInMs
|
|
520
|
-
});
|
|
521
|
-
}
|
|
522
|
-
const startedAt = __DEV__ ? Date.now() : 0;
|
|
523
|
-
const flushPromise = scrollMessageToEnd({
|
|
494
|
+
scrollMessageToEnd({
|
|
524
495
|
animated: false,
|
|
525
496
|
closeKeyboard: false
|
|
526
497
|
});
|
|
527
|
-
|
|
528
|
-
flushPromise.then(() => {
|
|
529
|
-
console.log(`${LOG_TAG} handleListLoad flush resolved`, {
|
|
530
|
-
conversationId,
|
|
531
|
-
tookMs: Date.now() - startedAt
|
|
532
|
-
});
|
|
533
|
-
});
|
|
534
|
-
}
|
|
535
|
-
}, [scrollMessageToEnd, conversationId, messages.length]);
|
|
498
|
+
}, [scrollMessageToEnd]);
|
|
536
499
|
useEffect(() => {
|
|
537
500
|
const bottomSubscription = DeviceEventEmitter.addListener(ChatEvent.ScrollToBottom, handleScrollToBottom);
|
|
538
501
|
const subscription = DeviceEventEmitter.addListener(ChatEvent.ScrollToMessage, ({
|
|
@@ -600,7 +563,7 @@ export const ChatListLegend = /*#__PURE__*/memo(({
|
|
|
600
563
|
keyExtractor: item => String(item.clientMsgID || item.serverMsgID),
|
|
601
564
|
recycleItems: true,
|
|
602
565
|
extraData: listExtraData,
|
|
603
|
-
alignItemsAtEnd:
|
|
566
|
+
alignItemsAtEnd: true,
|
|
604
567
|
alwaysRender: {
|
|
605
568
|
top: 10
|
|
606
569
|
},
|
|
@@ -612,12 +575,22 @@ export const ChatListLegend = /*#__PURE__*/memo(({
|
|
|
612
575
|
,
|
|
613
576
|
drawDistance: 800,
|
|
614
577
|
freeze: freeze,
|
|
615
|
-
keyboardOffset: keyboardOffset
|
|
578
|
+
keyboardOffset: keyboardOffset
|
|
579
|
+
// The list's own keyboard compensation is off on both platforms —
|
|
580
|
+
// measured, it overshoots badly either way. On iOS it scrolls on
|
|
581
|
+
// top of React Native's `automaticallyAdjustContentInsets` (which
|
|
582
|
+
// already insets the scroll view by the full keyboard height), and
|
|
583
|
+
// that double lift is the blank gap. On Android it overshot by
|
|
584
|
+
// ~690px against a 128px target. What both platforms do keep from
|
|
585
|
+
// the library is the bottom inset it sets, which is the room the
|
|
586
|
+
// re-anchor above scrolls into.
|
|
587
|
+
,
|
|
588
|
+
keyboardLiftBehavior: "never",
|
|
616
589
|
scrollEventThrottle: 16,
|
|
617
590
|
onScroll: handleScroll,
|
|
618
591
|
onScrollBeginDrag: handleScrollBeginDrag,
|
|
619
592
|
onLoad: handleListLoad,
|
|
620
|
-
contentContainerStyle:
|
|
593
|
+
contentContainerStyle: styles.content,
|
|
621
594
|
scrollIndicatorInsets: {
|
|
622
595
|
right: 1
|
|
623
596
|
},
|
|
@@ -665,9 +638,6 @@ const styles = StyleSheet.create({
|
|
|
665
638
|
paddingVertical: KSpacingValue['0.75rem'],
|
|
666
639
|
flexGrow: 1
|
|
667
640
|
},
|
|
668
|
-
contentBottomAnchored: {
|
|
669
|
-
justifyContent: 'flex-end'
|
|
670
|
-
},
|
|
671
641
|
scrollToBottomButton: {
|
|
672
642
|
position: 'absolute',
|
|
673
643
|
bottom: 20,
|