decord/source/modules/user_profile/native/useSegmentedPagesHeight.tsx

96 lines
3.1 KiB
TypeScript
Raw Normal View History

2026-07-24 07:16:23 +00:00
// Module ID: 12134
// Function ID: 95090
2026-07-20 16:05:17 +00:00
// Name: usePageHeights
2026-07-23 10:11:24 +00:00
// Dependencies: [57, 31, 3991, 1450, 1557, 2]
2026-07-20 16:05:17 +00:00
// Exports: usePageHeights, usePagerFillHeight, usePagesHeightStyle
2026-07-24 07:16:23 +00:00
// Module 12134 (usePageHeights)
2026-07-23 10:11:24 +00:00
import _slicedToArray from "_slicedToArray";
import result from "result";
2026-07-20 16:05:17 +00:00
2026-07-23 10:11:24 +00:00
const require = arg1;
2026-07-20 16:05:17 +00:00
let closure_5 = { code: "function useSegmentedPagesHeightTsx1(){const{pageHeights,visiblePageRange,fillHeight}=this.__closure;var _heights$lo,_heights$hi;const heights=pageHeights.get();const[lo,hi]=visiblePageRange.get();const contentHeight=Math.max((_heights$lo=heights[lo])!==null&&_heights$lo!==void 0?_heights$lo:0,(_heights$hi=heights[hi])!==null&&_heights$hi!==void 0?_heights$hi:0);const height=Math.max(contentHeight,fillHeight);return height>0?{height:height}:{};}" };
2026-07-23 10:11:24 +00:00
let result = require("module_3991").fileFinishedImporting("modules/user_profile/native/useSegmentedPagesHeight.tsx");
2026-07-20 16:05:17 +00:00
export const usePageHeights = function usePageHeights() {
2026-07-23 10:11:24 +00:00
let obj = sharedValue(3991);
sharedValue = obj.useSharedValue([]);
2026-07-20 16:05:17 +00:00
let closure_1 = React.useRef([]);
2026-07-23 10:11:24 +00:00
let items = [sharedValue];
2026-07-20 16:05:17 +00:00
obj = {
pageHeights: sharedValue,
handlePageContentSize: React.useCallback((arg0, arg1, arg2) => {
let tmp = arg2 <= 0;
if (!tmp) {
tmp = ref.current[arg0] === arg2;
}
if (!tmp) {
ref.current[arg0] = arg2;
const items = [];
HermesBuiltin.arraySpread(ref.current, 0);
const result = sharedValue.set(items);
}
}, items)
};
return obj;
};
export const usePagerFillHeight = function usePagerFillHeight() {
2026-07-23 10:11:24 +00:00
const height = bottom(1450)().height;
bottom = bottom(1557)().bottom;
const tmp = ref(React.useState(0), 2);
const dependencyMap = tmp[1];
ref = React.useRef(null);
2026-07-20 16:05:17 +00:00
const items = [height, bottom];
return {
pagerRef: ref,
fillHeight: tmp[0],
measureFill: React.useCallback(() => {
const current = ref.current;
if (null != current) {
current.measureInWindow((arg0, arg1) => {
2026-07-23 10:11:24 +00:00
const diff = outer1_0 - arg1 - outer1_1;
2026-07-20 16:05:17 +00:00
let num = 0;
if (diff > 0) {
num = diff;
}
2026-07-23 10:11:24 +00:00
outer1_2(num);
2026-07-20 16:05:17 +00:00
});
}
}, items)
};
};
export const usePagesHeightStyle = function usePagesHeightStyle(segmentedControlState, pageHeights, fillHeight) {
let num = fillHeight;
2026-07-23 10:11:24 +00:00
const _require = pageHeights;
2026-07-20 16:05:17 +00:00
if (fillHeight === undefined) {
num = 0;
}
2026-07-23 10:11:24 +00:00
let visiblePageRange;
visiblePageRange = segmentedControlState.visiblePageRange;
let obj = _require(visiblePageRange[2]);
2026-07-20 16:05:17 +00:00
const fn = function u() {
2026-07-23 10:11:24 +00:00
const value = pageHeights.get();
const tmp2 = outer1_3(visiblePageRange.get(), 2);
2026-07-20 16:05:17 +00:00
let num = 0;
if (null != value[tmp2[0]]) {
num = tmp3;
}
let num2 = 0;
if (null != value[tmp2[1]]) {
num2 = tmp4;
}
const bound = Math.max(Math.max(num, num2), num);
if (bound > 0) {
let obj = { height: bound };
} else {
obj = {};
}
return obj;
};
obj = { pageHeights, visiblePageRange, fillHeight: num };
fn.__closure = obj;
fn.__workletHash = 7484186791578;
fn.__initData = closure_5;
return obj.useAnimatedStyle(fn);
};