decord/source/modules/quests/native/BountiesModal/useBountiesRecapScroll.tsx

75 lines
2.4 KiB
TypeScript
Raw Normal View History

2026-08-24 06:08:38 +00:00
// Module ID: 14433
// Function ID: 14434
2026-07-20 16:05:17 +00:00
// Name: getRevealProgress
2026-07-29 08:29:29 +00:00
// Dependencies: [19, 2]
2026-07-20 16:05:17 +00:00
// Exports: useBountiesRecapScroll
2026-08-24 06:08:38 +00:00
// Module 14433 (getRevealProgress)
import closure_0 from "noop" /* 19 */;
2026-07-23 10:11:24 +00:00
2026-07-29 08:29:29 +00:00
function getRevealProgress(scrollY, lastBountyScrollOffset, height3) {
let num = 0;
if (height3 > 0) {
num = (scrollY - lastBountyScrollOffset) / height3;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
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;}" };
2026-07-23 10:11:24 +00:00
const result = require("set").fileFinishedImporting("modules/quests/native/BountiesModal/useBountiesRecapScroll.tsx");
2026-07-20 16:05:17 +00:00
export const RECAP_SNAP_EPSILON = 2;
2026-07-29 08:29:29 +00:00
export { getRevealProgress };
2026-07-20 16:05:17 +00:00
export const useBountiesRecapScroll = function useBountiesRecapScroll(listRef) {
listRef = listRef.listRef;
const enabled = listRef.enabled;
const offsets = listRef.offsets;
2026-07-29 08:29:29 +00:00
let callback;
let callback2;
2026-07-20 16:05:17 +00:00
const items = [listRef];
2026-07-29 08:29:29 +00:00
callback = listRef.useCallback((arg0) => {
2026-07-20 16:05:17 +00:00
if (null != listRef.current) {
2026-07-29 08:29:29 +00:00
const current = tmp.current;
const obj = { offset: null, animated: true };
obj[0] = arg0;
2026-07-20 16:05:17 +00:00
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;
2026-07-23 10:11:24 +00:00
const callback1 = listRef.useCallback(() => {
2026-07-20 16:05:17 +00:00
callback(offsets.lastBounty);
}, items1);
2026-07-29 08:29:29 +00:00
callback2 = listRef.useCallback((arg0) => {
2026-07-20 16:05:17 +00:00
if (enabled) {
if (arg0 > offsets.lastBounty) {
2026-07-29 08:29:29 +00:00
({ revealHeight, lastBounty } = tmp2);
2026-08-04 21:03:28 +00:00
if (typeof enabled !== "function") {
2026-07-29 08:29:29 +00:00
HermesBuiltin.throwTypeError();
}
let num = 0;
if (revealHeight > 0) {
num = (arg0 - lastBounty) / revealHeight;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
const tmp3 = num >= 0.25 ? tmp2.fullRecap : tmp2.lastBounty;
2026-07-20 16:05:17 +00:00
const _Math = Math;
2026-07-29 08:29:29 +00:00
if (Math.abs(arg0 - tmp3) >= 2) {
callback(tmp3);
2026-07-20 16:05:17 +00:00
}
}
}
}, items2);
const items3 = [enabled, callback2];
return {
scrollToLastBounty: callback1,
2026-07-23 10:11:24 +00:00
handleRecapMomentumEnd: listRef.useCallback((contentOffset) => {
2026-07-20 16:05:17 +00:00
if (enabled) {
callback2(contentOffset.contentOffset.y);
}
}, items3)
};
};