47 lines
1.6 KiB
TypeScript
47 lines
1.6 KiB
TypeScript
// Metro module 14039 (f14040).
|
|
import { useCallback } from "react";
|
|
let getRevealProgress;
|
|
const getRevealProgress2 = function getRevealProgress(a0, a1, a2) {
|
|
return a2 <= 0 ? 0 : (a0 - a1) / a2;
|
|
};
|
|
getRevealProgress2.__closure = {};
|
|
getRevealProgress2.__workletHash = 9769647749947;
|
|
getRevealProgress2.__initData = {
|
|
code: "function getRevealProgress_useBountiesRecapScrollTsx1(scrollOffset,startOffset,revealHeight){if(revealHeight<=0){return 0;}return(scrollOffset-startOffset)/revealHeight;}"
|
|
};
|
|
getRevealProgress = getRevealProgress2;
|
|
export const RECAP_SNAP_EPSILON = 2;
|
|
export { getRevealProgress };
|
|
export function useBountiesRecapScroll({ listRef, enabled, offsets }) {
|
|
let callback2;
|
|
callback2 = void 0;
|
|
const callback = useCallback((a0) => {
|
|
if (listRef.current != null) {
|
|
listRef.current.scrollToOffset({
|
|
offset: a0,
|
|
animated: true
|
|
});
|
|
}
|
|
}, [listRef]);
|
|
const callback3 = useCallback(() => {
|
|
callback(offsets.lastBounty);
|
|
}, [offsets.lastBounty, callback]);
|
|
callback2 = useCallback((a0) => {
|
|
if (enabled && !(a0 <= offsets.lastBounty)) {
|
|
const { lastBounty, revealHeight } = offsets;
|
|
const r15 = (revealHeight <= 0 ? 0 : (a0 - lastBounty) / revealHeight) >= 0.25 ? offsets.fullRecap : offsets.lastBounty;
|
|
if (!(Math.abs(a0 - r15) < 2)) {
|
|
callback(r15);
|
|
}
|
|
}
|
|
}, [enabled, offsets.fullRecap, offsets.lastBounty, offsets.revealHeight, callback]);
|
|
return {
|
|
scrollToLastBounty: callback3,
|
|
handleRecapMomentumEnd: useCallback((a0) => {
|
|
if (enabled) {
|
|
callback2(a0.contentOffset.y);
|
|
}
|
|
}, [enabled, callback2])
|
|
};
|
|
}
|