decord/source/modules/user_profile/native/useSegmentedPagesHeight.tsx
github-actions 20a21ad13f chore: update source for alpha 346.5
Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/04xxx/module_4791.js (118.4 MB)
2026-09-11 19:12:58 +00:00

97 lines
3.3 KiB
TypeScript

// Module ID: 13170
// Function ID: 13171
// Name: useSegmentedPagesHeight
// Dependencies: [32, 19, 4343, 1477, 1611, 2]
// Exports: usePageHeights, usePagerFillHeight, usePagesHeightStyle
// Module 13170 (useSegmentedPagesHeight)
import useWindowDimensionsDefault from "useWindowDimensions" /* 1477 */;
import useSafeAreaInsetsDefault from "useSafeAreaInsets" /* 1611 */;
import ReanimatedRexport from "ReanimatedRexport" /* 4343 */;
import _slicedToArray from "module_32" /* 32 */;
import noop from "module_19" /* 19 */;
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");
export const usePageHeights = function usePageHeights() {
const sharedValue = ReanimatedRexport.useSharedValue([]);
noop.useRef([]);
let items = [sharedValue];
return {
pageHeights: sharedValue,
handlePageContentSize: noop.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)
};
};
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);
const items = [height, bottom];
return {
pagerRef: ref,
fillHeight: tmp[0],
measureFill: noop.useCallback(() => {
const current = ref.current;
if (current != null) {
current.measureInWindow((arg0, arg1) => {
const diff = height - arg1 - bottom;
let num = 0;
if (diff > 0) {
num = diff;
}
closure_1_2(num);
});
}
}, items)
};
};
export const usePagesHeightStyle = function usePagesHeightStyle(segmentedControlState, pageHeights, fillHeight) {
_require = pageHeights;
let num = fillHeight;
if (fillHeight === undefined) {
num = 0;
}
const visiblePageRange = segmentedControlState.visiblePageRange;
const fn = function u() {
value = pageHeights.get();
const tmp2 = _slicedToArray(visiblePageRange.get(), 2);
num = value[tmp2[0]];
if (num == null) {
num = 0;
}
let num2 = value[tmp2[1]];
if (num2 == null) {
num2 = 0;
}
const bound = Math.max(Math.max(num, num2), num);
if (bound > 0) {
const obj2 = { height: bound };
let obj = obj2;
} else {
obj = {};
}
return obj;
};
fn.__closure = { pageHeights, visiblePageRange, fillHeight: num };
fn.__workletHash = 7484186791578;
fn.__initData = __initData;
return require("ReanimatedRexport").useAnimatedStyle(fn);
};