Files
discord-decomp/_bundle/Module5399.jsx
T
2026-11-01 12:12:55 +02:00

61 lines
4.7 KiB
React

// Metro module 5399 (f5400).
import { forwardRef, useContext, useImperativeHandle, useMemo } from "react";
import { BottomSheetDraggableContext } from "./Module5257";
import { useScrollHandler, useBottomSheetInternal, useStableCallback, useBottomSheetContentContainerStyle, useScrollableSetter } from "./Module5250";
import { useBottomSheetContentSizeSetter } from "./Module5400";
import { useAnimatedProps } from "./Module1606";
import * as _Module5246 from "./Module5246";
import { Gesture } from "./Module5273";
import { ScrollableContainer } from "./Module5401";
const _excluded = ["focusHook", "scrollEventsHandlersHook", "enableFooterMarginAdjustment", "overScrollMode", "keyboardDismissMode", "showsVerticalScrollIndicator", "contentContainerStyle", "refreshing", "onRefresh", "progressViewOffset", "refreshControl", "preserveScrollMomentum", "onScroll", "onScrollBeginDrag", "onScrollEndDrag", "lockableScrollableContentOffsetY", "onContentSizeChange"];
const __initData = {
code: "function pnpm_createBottomSheetScrollableComponentTsx1(){const{preserveScrollMomentum,SCROLLABLE_DECELERATION_RATE_MAPPER,animatedScrollableState,showsVerticalScrollIndicator,SCROLLABLE_STATE}=this.__closure;return{...(preserveScrollMomentum?{}:{decelerationRate:SCROLLABLE_DECELERATION_RATE_MAPPER[animatedScrollableState.value]}),showsVerticalScrollIndicator:showsVerticalScrollIndicator?animatedScrollableState.value===SCROLLABLE_STATE.UNLOCKED:showsVerticalScrollIndicator};}"
};
export function createBottomSheetScrollableComponent(c14845_0, ScrollableComponent) {
return forwardRef(({ focusHook, scrollEventsHandlersHook, enableFooterMarginAdjustment = false, overScrollMode: overScrollMode2 = "never", keyboardDismissMode: keyboardDismissMode2 = "interactive", showsVerticalScrollIndicator = true, contentContainerStyle, refreshing, onRefresh, progressViewOffset, refreshControl, preserveScrollMomentum, onScroll, onScrollBeginDrag, onScrollEndDrag, lockableScrollableContentOffsetY, onContentSizeChange, ...rest }, a1) => {
const context = useContext(BottomSheetDraggableContext);
const scrollHandler2 = useScrollHandler(scrollEventsHandlersHook, onScroll, onScrollBeginDrag, onScrollEndDrag, lockableScrollableContentOffsetY);
const { scrollableRef, scrollableContentOffsetY, scrollHandler } = scrollHandler2;
const bottomSheetInternal = useBottomSheetInternal();
const { animatedScrollableState, enableContentPanningGesture } = bottomSheetInternal;
const setContentSize = useBottomSheetContentSizeSetter().setContentSize;
if (!context && enableContentPanningGesture) {
throw "'Scrollable' cannot be used out of the BottomSheet!";
}
const J = () => {
const r2 = preserveScrollMomentum ? {} : {
decelerationRate: _Module5246.SCROLLABLE_DECELERATION_RATE_MAPPER[animatedScrollableState.value]
};
let showsVerticalScrollIndicator2 = showsVerticalScrollIndicator;
if (showsVerticalScrollIndicator) {
showsVerticalScrollIndicator2 = animatedScrollableState.value === _Module5246.SCROLLABLE_STATE.UNLOCKED;
}
return {
...r2,
showsVerticalScrollIndicator: showsVerticalScrollIndicator2
};
};
J.__closure = {
preserveScrollMomentum,
SCROLLABLE_DECELERATION_RATE_MAPPER: _Module5246.SCROLLABLE_DECELERATION_RATE_MAPPER,
animatedScrollableState,
showsVerticalScrollIndicator,
SCROLLABLE_STATE: _Module5246.SCROLLABLE_STATE
};
J.__workletHash = 1780437272380;
J.__initData = __initData;
const animatedProps = useAnimatedProps(J, [animatedScrollableState, showsVerticalScrollIndicator, preserveScrollMomentum]);
const memo = useMemo(() => context ? Gesture.Native().simultaneousWithExternalGesture(context).shouldCancelWhenOutside(false) : void 0, [context]);
const stableCallback = useStableCallback((a0, a1) => {
setContentSize(a1);
if (onContentSizeChange) {
onContentSizeChange(a0, a1);
}
});
const bottomSheetContentContainerStyle = useBottomSheetContentContainerStyle(enableFooterMarginAdjustment, contentContainerStyle);
useImperativeHandle(a1, () => scrollableRef.current);
useScrollableSetter(scrollableRef, c14845_0, scrollableContentOffsetY, onRefresh !== void 0, focusHook);
return <ScrollableContainer ref={scrollableRef} nativeGesture={memo} animatedProps={animatedProps} overScrollMode={overScrollMode2} keyboardDismissMode={keyboardDismissMode2} refreshing={refreshing} scrollEventThrottle={16} progressViewOffset={progressViewOffset} contentContainerStyle={bottomSheetContentContainerStyle} onRefresh={onRefresh} onScroll={scrollHandler} onContentSizeChange={stableCallback} setContentSize={setContentSize} ScrollableComponent={ScrollableComponent} refreshControl={refreshControl} {...rest} />;
});
}