decord/source/modules/quests/native/BountiesModal/useBountiesRecapScroll.tsx
github-actions 8d58bae3b2 chore: update source for alpha 347.4
Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/04xxx/module_4907.js (118.4 MB)
2026-09-18 06:58:00 +00:00

72 lines
2.4 KiB
TypeScript

// Module ID: 15229
// Function ID: 15230
// Name: useBountiesRecapScroll
// Dependencies: [19, 2]
// Exports: useBountiesRecapScroll
// Module 15229 (useBountiesRecapScroll)
import noop from "module_19" /* 19 */;
function getRevealProgress(scrollY, c26, height3) {
let num = 0;
if (height3 > 0) {
num = (scrollY - c26) / height3;
}
return num;
}
getRevealProgress.__closure = {};
getRevealProgress.__workletHash = 9769647749947;
getRevealProgress.__initData = { code: "function getRevealProgress_useBountiesRecapScrollTsx1(scrollOffset,startOffset,revealHeight){if(revealHeight<=0){return 0;}return(scrollOffset-startOffset)/revealHeight;}" };
const size = fn(2);
const result = size.fileFinishedImporting("modules/quests/native/BountiesModal/useBountiesRecapScroll.tsx");
export const RECAP_SNAP_EPSILON = 2;
export { getRevealProgress };
export const useBountiesRecapScroll = function useBountiesRecapScroll(listRef) {
listRef = listRef.listRef;
const enabled = listRef.enabled;
const offsets = listRef.offsets;
const items = [listRef];
const callback = listRef.useCallback((offset) => {
if (null != listRef.current) {
const current = tmp.current;
const obj = { offset, animated: true };
current.scrollToOffset(obj);
}
}, items);
const items1 = [offsets.lastBounty, callback];
const items2 = [enabled, , , , ];
({ fullRecap: arr3[1], lastBounty: arr3[2], revealHeight: arr3[3] } = offsets);
items2[4] = callback;
const callback1 = listRef.useCallback(() => {
callback(offsets.lastBounty);
}, items1);
const callback2 = listRef.useCallback((arg0) => {
if (enabled) {
if (arg0 > offsets.lastBounty) {
const revealHeight = tmp2.revealHeight;
if (typeof getRevealProgress === "function") {
let num = 0;
if (revealHeight > 0) {
num = (arg0 - tmp8) / revealHeight;
}
const tmp3 = num >= 0.25 ? tmp2.fullRecap : tmp2.lastBounty;
const _Math = Math;
if (Math.abs(arg0 - tmp3) >= 2) {
callback(tmp3);
}
} else {
throw new TypeError("Trying to call a non-function");
}
}
}
}, items2);
let obj = { scrollToLastBounty: callback1, handleRecapMomentumEnd: null };
const items3 = [enabled, callback2];
obj.handleRecapMomentumEnd = listRef.useCallback((contentOffset) => {
if (enabled) {
callback2(contentOffset.contentOffset.y);
}
}, items3);
return obj;
};