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

45 lines
2.1 KiB
React

// Metro module 5404 (f5405).
import { useContext, useMemo, memo } from "react";
import { RefreshControl } from "react-native";
import Module1606, { useAnimatedProps } from "./Module1606";
import { BottomSheetDraggableContext } from "./Module5257";
import { useBottomSheetInternal } from "./Module5250";
import * as _Module5246 from "./Module5246";
import { Gesture, GestureDetector } from "./Module5273";
const AnimatedComponent = Module1606.createAnimatedComponent(RefreshControl);
const __initData = {
code: "function pnpm_BottomSheetRefreshControlAndroidTsx1(){const{animatedScrollableState,SCROLLABLE_STATE}=this.__closure;return{enabled:animatedScrollableState.value===SCROLLABLE_STATE.UNLOCKED};}"
};
const r31 = memo(function BottomSheetRefreshControlComponent(props) {
const { onRefresh, scrollableGesture, ...props2 } = props;
const context = useContext(BottomSheetDraggableContext);
const bottomSheetInternal = useBottomSheetInternal();
const { animatedScrollableState, enableContentPanningGesture } = bottomSheetInternal;
if (!context && enableContentPanningGesture) {
throw "'BottomSheetRefreshControl' cannot be used out of the BottomSheet!";
}
const f = () => ({
enabled: animatedScrollableState.value === _Module5246.SCROLLABLE_STATE.UNLOCKED
});
f.__closure = {
animatedScrollableState,
SCROLLABLE_STATE: _Module5246.SCROLLABLE_STATE
};
f.__workletHash = 8403038560398;
f.__initData = __initData;
const animatedProps = useAnimatedProps(f, [animatedScrollableState.value]);
const memo = useMemo(() => {
let r2 = void 0;
if (context) {
const r5 = Gesture.Native();
r2 = r5.simultaneousWithExternalGesture.apply(r5, [...context.toGestureArray(), ...scrollableGesture.toGestureArray()]).shouldCancelWhenOutside(true);
}
return r2;
}, [context, scrollableGesture]);
return memo ? <GestureDetector gesture={memo}>
<AnimatedComponent {...props2} onRefresh={onRefresh} animatedProps={animatedProps} />
</GestureDetector> : <AnimatedComponent {...props2} onRefresh={onRefresh} animatedProps={animatedProps} />;
});
r31.displayName = "BottomSheetRefreshControl";
export default r31;