decord/stable/source/modules/chat/native/computeScrollData.tsx
github-actions 528a3dd5ba chore: update source for stable 345.9
Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/04xxx/module_4745.js (118.4 MB)
2026-09-18 20:18:48 +00:00

106 lines
3.4 KiB
TypeScript

// Module ID: 11275
// Function ID: 11276
// Name: computeScrollData
// Dependencies: [4552, 7934, 11276, 4491, 2]
// Exports: default, findMessageRowIndex
// Module 11275 (computeScrollData)
import NativeChatUtils from "NativeChatUtils" /* 11276 */;
import AccessibilityStore from "AccessibilityStore" /* 4552 */;
require = fn;
const RowGeneratorConstants = fn(7934);
({ RowType: c3, SeparatorType: closure_4 } = RowGeneratorConstants);
const size = fn(2);
const result = size.fileFinishedImporting("modules/chat/native/computeScrollData.tsx");
export default function computeScrollData(shouldInitialScroll) {
({ rows, scrollToMessageId, jumpTargetId, animated, scrollPosition, focusTargetId, jumpType } = shouldInitialScroll);
if (shouldInitialScroll.shouldInitialScroll) {
if (null == jumpTargetId) {
const findIndexResult = rows.findIndex((type) => {
let tmp = type.type === constants.SEPARATOR;
if (tmp) {
tmp = type.id === constants2.UNREAD;
}
return tmp;
});
let tmp3;
if (-1 !== findIndexResult) {
tmp3 = findIndexResult;
}
if (null != tmp3) {
const obj2 = { type: NativeChatUtils.ChatScrollType.SCROLL, index: tmp3, animate: null, highlight: false, position: null };
if (animated) {
animated = !AccessibilityStore.useReducedMotion;
}
obj2.animate = animated;
obj2.position = NativeChatUtils.ChatScrollPosition.TOP;
return obj2;
}
}
}
let tmp4;
if (null != scrollToMessageId) {
focusTargetId = scrollToMessageId;
const findIndexResult1 = rows.findIndex((message) => {
let tmp = null != message.message;
if (tmp) {
tmp = message.message.id === focusTargetId;
}
return tmp;
});
let tmp6;
if (-1 !== findIndexResult1) {
tmp6 = findIndexResult1;
}
if (null != tmp6) {
const obj = { type: NativeChatUtils.ChatScrollType.SCROLL, index: tmp6, animate: null, highlight: null, position: null };
const useReducedMotion = AccessibilityStore.useReducedMotion;
let tmp10 = !useReducedMotion;
if (!useReducedMotion) {
tmp10 = jumpType !== tmp7(4491).JumpType.INSTANT;
}
obj.animate = tmp10;
obj.highlight = scrollToMessageId === jumpTargetId;
if (scrollPosition == null) {
scrollPosition = tmp7(11276).ChatScrollPosition.TOP;
}
obj.position = scrollPosition;
tmp4 = obj;
}
}
if (null == tmp4) {
let tmp11;
if (null != focusTargetId) {
const findIndexResult2 = rows.findIndex((message) => {
let tmp = null != message.message;
if (tmp) {
tmp = message.message.id === focusTargetId;
}
return tmp;
});
let tmp13;
if (-1 !== findIndexResult2) {
tmp13 = findIndexResult2;
}
if (null != tmp13) {
const obj3 = { type: NativeChatUtils.ChatScrollType.FOCUS_ONLY, index: tmp13 };
tmp11 = obj3;
}
}
tmp4 = tmp11;
}
return tmp4;
};
export const findMessageRowIndex = function findMessageRowIndex(previousRows, ChatTTITracker) {
closure_0 = ChatTTITracker;
const findIndexResult = previousRows.findIndex((message) => {
let tmp = null != message.message;
if (tmp) {
tmp = message.message.id === focusTargetId;
}
return tmp;
});
return -1 !== findIndexResult ? findIndexResult : undefined;
};