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

98 lines
3.3 KiB
TypeScript
Raw Normal View History

// Module ID: 13100
// Function ID: 13101
// Name: useSegmentedPagesHeight
// Dependencies: [32, 19, 4310, 1477, 1611, 2]
2026-07-20 16:05:17 +00:00
// Exports: usePageHeights, usePagerFillHeight, usePagesHeightStyle
// Module 13100 (useSegmentedPagesHeight)
import useWindowDimensionsDefault from "useWindowDimensions" /* 1477 */;
import useSafeAreaInsetsDefault from "useSafeAreaInsets" /* 1611 */;
import ReanimatedRexport from "ReanimatedRexport" /* 4310 */;
import _slicedToArray from "module_32" /* 32 */;
import noop from "module_19" /* 19 */;
2026-07-20 16:05:17 +00:00
const require = globalThis.__r;
require = fn;
const __initData = { 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}:{};}" };
const size = fn(2);
let result = size.fileFinishedImporting("modules/user_profile/native/useSegmentedPagesHeight.tsx");
2026-07-20 16:05:17 +00:00
export const usePageHeights = function usePageHeights() {
const sharedValue = ReanimatedRexport.useSharedValue([]);
noop.useRef([]);
2026-07-23 10:11:24 +00:00
let items = [sharedValue];
return {
2026-07-20 16:05:17 +00:00
pageHeights: sharedValue,
handlePageContentSize: noop.useCallback((arg0, arg1, arg2) => {
2026-07-20 16:05:17 +00:00
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)
};
};
export const usePagerFillHeight = function usePagerFillHeight() {
const height = useWindowDimensionsDefault().height;
const bottom = useSafeAreaInsetsDefault().bottom;
const tmp = _slicedToArray(noop.useState(0), 2);
closure_2 = tmp[1];
const ref = noop.useRef(null);
2026-07-20 16:05:17 +00:00
const items = [height, bottom];
return {
pagerRef: ref,
fillHeight: tmp[0],
measureFill: noop.useCallback(() => {
2026-07-20 16:05:17 +00:00
const current = ref.current;
2026-07-29 08:29:29 +00:00
if (current != null) {
2026-07-20 16:05:17 +00:00
current.measureInWindow((arg0, arg1) => {
const diff = height - arg1 - bottom;
2026-07-20 16:05:17 +00:00
let num = 0;
if (diff > 0) {
num = diff;
}
closure_1_2(num);
2026-07-20 16:05:17 +00:00
});
}
}, items)
};
};
export const usePagesHeightStyle = function usePagesHeightStyle(segmentedControlState, pageHeights, fillHeight) {
_require = pageHeights;
2026-07-29 08:29:29 +00:00
let num = fillHeight;
2026-07-20 16:05:17 +00:00
if (fillHeight === undefined) {
num = 0;
}
const visiblePageRange = segmentedControlState.visiblePageRange;
2026-07-20 16:05:17 +00:00
const fn = function u() {
value = pageHeights.get();
const tmp2 = _slicedToArray(visiblePageRange.get(), 2);
2026-08-24 06:08:38 +00:00
num = value[tmp2[0]];
2026-07-29 08:29:29 +00:00
if (num == null) {
num = 0;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
let num2 = value[tmp2[1]];
if (num2 == null) {
num2 = 0;
2026-07-20 16:05:17 +00:00
}
const bound = Math.max(Math.max(num, num2), num);
if (bound > 0) {
const obj2 = { height: bound };
let obj = obj2;
2026-07-20 16:05:17 +00:00
} else {
obj = {};
}
return obj;
};
2026-07-29 08:29:29 +00:00
fn.__closure = { pageHeights, visiblePageRange, fillHeight: num };
2026-07-20 16:05:17 +00:00
fn.__workletHash = 7484186791578;
fn.__initData = __initData;
return require("ReanimatedRexport").useAnimatedStyle(fn);
2026-07-20 16:05:17 +00:00
};