decord/alpha/source/modules/chat/native/computeScrollData.tsx
github-actions c6aa9eb120 chore: update source for alpha 349.3
Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/05xxx/module_5030.js (118.4 MB)
2026-10-01 06:55:13 +00:00

109 lines
3.5 KiB
TypeScript

// Module ID: 11049
// Function ID: 11050
// Name: computeScrollData
// Dependencies: [4834, 7548, 11050, 4772, 2]
// Exports: default, findMessageRowIndex
// Module 11049 (computeScrollData)
import NativeChatUtils from "NativeChatUtils" /* 11050 */;
import AccessibilityStore from "AccessibilityStore" /* 4834 */;
require = fn;
const RowGeneratorConstants = fn(7548);
({ 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, scrollToRowIndexOverride, 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) {
if (scrollToRowIndexOverride == null) {
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;
}
scrollToRowIndexOverride = tmp6;
}
if (null != scrollToRowIndexOverride) {
const obj = { type: NativeChatUtils.ChatScrollType.SCROLL, index: scrollToRowIndexOverride, animate: null, highlight: null, position: null };
const useReducedMotion = AccessibilityStore.useReducedMotion;
let tmp10 = !useReducedMotion;
if (!useReducedMotion) {
tmp10 = jumpType !== tmp7(4772).JumpType.INSTANT;
}
obj.animate = tmp10;
obj.highlight = scrollToMessageId === jumpTargetId;
if (scrollPosition == null) {
scrollPosition = tmp7(11050).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, startMessageId) {
closure_0 = startMessageId;
const findIndexResult = previousRows.findIndex((message) => {
let tmp = null != message.message;
if (tmp) {
tmp = message.message.id === focusTargetId;
}
return tmp;
});
return -1 !== findIndexResult ? findIndexResult : undefined;
};