159 lines
6.3 KiB
React
159 lines
6.3 KiB
React
// Metro module 5492 (f5493).
|
|
import { useCallback, useEffect, useMemo, useRef, useState, memo } from "react";
|
|
import * as _Module5493 from "./Module5493";
|
|
import { DEFAULT_ACCESSIBLE, DEFAULT_ACCESSIBILITY_ROLE, DEFAULT_ACCESSIBILITY_LABEL, DEFAULT_ACCESSIBILITY_HINT, DEFAULT_ENABLE_TOUCH_THROUGH } from "./Module5493";
|
|
import * as _Module1606 from "./Module1606";
|
|
import Module1606, { useAnimatedStyle, useAnimatedReaction } from "./Module1606";
|
|
import { useBottomSheet } from "./Module5250";
|
|
import { Gesture, GestureDetector } from "./Module5273";
|
|
import { styles } from "./Module5494";
|
|
const __initData = {
|
|
code: "function pnpm_BottomSheetBackdropTsx1(){const{runOnJS,handleOnPress}=this.__closure;runOnJS(handleOnPress)();}"
|
|
};
|
|
const __initData2 = {
|
|
code: "function pnpm_BottomSheetBackdropTsx2(){const{interpolate,animatedIndex,disappearsOnIndex,appearsOnIndex,opacity,Extrapolation}=this.__closure;return{opacity:interpolate(animatedIndex.value,[-1,disappearsOnIndex,appearsOnIndex],[0,0,opacity],Extrapolation.CLAMP)};}"
|
|
};
|
|
const __initData3 = {
|
|
code: "function pnpm_BottomSheetBackdropTsx3(){const{animatedIndex,disappearsOnIndex}=this.__closure;return animatedIndex.value<=disappearsOnIndex;}"
|
|
};
|
|
const __initData4 = {
|
|
code: "function pnpm_BottomSheetBackdropTsx4(shouldDisableTouchability,previous){const{runOnJS,handleContainerTouchability}=this.__closure;if(shouldDisableTouchability===previous){return;}runOnJS(handleContainerTouchability)(shouldDisableTouchability);}"
|
|
};
|
|
const r32 = memo((a0) => {
|
|
let callback2, animatedStyle;
|
|
const animatedIndex = a0.animatedIndex;
|
|
let opacity = a0.opacity;
|
|
let appearsOnIndex = a0.appearsOnIndex;
|
|
let disappearsOnIndex = a0.disappearsOnIndex;
|
|
let enableTouchThrough = a0.enableTouchThrough;
|
|
let pressBehavior = a0.pressBehavior;
|
|
if (pressBehavior === void 0) {
|
|
pressBehavior = _Module5493.DEFAULT_PRESS_BEHAVIOR;
|
|
}
|
|
const DEFAULT_PRESS_BEHAVIOR = pressBehavior;
|
|
const { onPress, style, children, ViewComponent = Module1606.View } = a0;
|
|
let accessible = a0.accessible;
|
|
if (accessible === void 0) {
|
|
accessible = DEFAULT_ACCESSIBLE;
|
|
}
|
|
let accessibilityRole = a0.accessibilityRole;
|
|
if (accessibilityRole === void 0) {
|
|
accessibilityRole = DEFAULT_ACCESSIBILITY_ROLE;
|
|
}
|
|
let accessibilityLabel = a0.accessibilityLabel;
|
|
if (accessibilityLabel === void 0) {
|
|
accessibilityLabel = DEFAULT_ACCESSIBILITY_LABEL;
|
|
}
|
|
let accessibilityHint = a0.accessibilityHint;
|
|
if (accessibilityHint === void 0) {
|
|
accessibilityHint = DEFAULT_ACCESSIBILITY_HINT;
|
|
}
|
|
callback2 = void 0;
|
|
animatedStyle = void 0;
|
|
const bottomSheet = useBottomSheet();
|
|
const { snapToIndex, close } = bottomSheet;
|
|
const ref = useRef(false);
|
|
if (opacity == null) {
|
|
opacity = _Module5493.DEFAULT_OPACITY;
|
|
}
|
|
const DEFAULT_OPACITY = opacity;
|
|
if (appearsOnIndex == null) {
|
|
appearsOnIndex = _Module5493.DEFAULT_APPEARS_ON_INDEX;
|
|
}
|
|
const DEFAULT_APPEARS_ON_INDEX = appearsOnIndex;
|
|
if (disappearsOnIndex == null) {
|
|
disappearsOnIndex = _Module5493.DEFAULT_DISAPPEARS_ON_INDEX;
|
|
}
|
|
const DEFAULT_DISAPPEARS_ON_INDEX = disappearsOnIndex;
|
|
if (enableTouchThrough == null) {
|
|
enableTouchThrough = DEFAULT_ENABLE_TOUCH_THROUGH;
|
|
}
|
|
const [pointerEvents, setState] = useState(enableTouchThrough ? "none" : "auto");
|
|
const callback = useCallback(() => {
|
|
if (onPress != null) {
|
|
onPress();
|
|
}
|
|
if (DEFAULT_PRESS_BEHAVIOR === "close") {
|
|
close();
|
|
} else if (DEFAULT_PRESS_BEHAVIOR === "collapse") {
|
|
snapToIndex(DEFAULT_DISAPPEARS_ON_INDEX);
|
|
} else if (typeof DEFAULT_PRESS_BEHAVIOR === "number") {
|
|
snapToIndex(DEFAULT_PRESS_BEHAVIOR);
|
|
}
|
|
}, [snapToIndex, close, DEFAULT_DISAPPEARS_ON_INDEX, DEFAULT_PRESS_BEHAVIOR, onPress]);
|
|
callback2 = useCallback((a0) => {
|
|
if (ref.current) {
|
|
setState(a0 ? "none" : "auto");
|
|
}
|
|
}, []);
|
|
const memo = useMemo(() => {
|
|
const r4 = Gesture.Tap();
|
|
const n = function n() {
|
|
_Module1606.runOnJS(callback)();
|
|
};
|
|
n.__closure = {
|
|
runOnJS: _Module1606.runOnJS,
|
|
handleOnPress: callback
|
|
};
|
|
n.__workletHash = 10704059633145;
|
|
n.__initData = __initData;
|
|
return r4.onEnd(n);
|
|
}, [callback]);
|
|
const P = () => ({
|
|
opacity: _Module1606.interpolate(animatedIndex.value, [-1, DEFAULT_DISAPPEARS_ON_INDEX, DEFAULT_APPEARS_ON_INDEX], [0, 0, DEFAULT_OPACITY], _Module1606.Extrapolation.CLAMP)
|
|
});
|
|
P.__closure = {
|
|
interpolate: _Module1606.interpolate,
|
|
animatedIndex,
|
|
disappearsOnIndex: DEFAULT_DISAPPEARS_ON_INDEX,
|
|
appearsOnIndex: DEFAULT_APPEARS_ON_INDEX,
|
|
opacity: DEFAULT_OPACITY,
|
|
Extrapolation: _Module1606.Extrapolation
|
|
};
|
|
P.__workletHash = 7085425846204;
|
|
P.__initData = __initData2;
|
|
animatedStyle = useAnimatedStyle(P, [animatedIndex, DEFAULT_APPEARS_ON_INDEX, DEFAULT_DISAPPEARS_ON_INDEX, DEFAULT_OPACITY]);
|
|
const memo2 = useMemo(() => [styles.backdrop, style, animatedStyle], [style, animatedStyle]);
|
|
const H = () => animatedIndex.value <= DEFAULT_DISAPPEARS_ON_INDEX;
|
|
H.__closure = {
|
|
animatedIndex,
|
|
disappearsOnIndex: DEFAULT_DISAPPEARS_ON_INDEX
|
|
};
|
|
H.__workletHash = 8948110613973;
|
|
H.__initData = __initData3;
|
|
const k = function k(a0, a1) {
|
|
if (a0 !== a1) {
|
|
_Module1606.runOnJS(callback2)(a0);
|
|
}
|
|
};
|
|
k.__closure = {
|
|
runOnJS: _Module1606.runOnJS,
|
|
handleContainerTouchability: callback2
|
|
};
|
|
k.__workletHash = 17426135168622;
|
|
k.__initData = __initData4;
|
|
useAnimatedReaction(H, k, [DEFAULT_DISAPPEARS_ON_INDEX]);
|
|
useEffect(() => {
|
|
ref.current = true;
|
|
return () => {
|
|
ref.current = false;
|
|
};
|
|
}, []);
|
|
if (accessible == null) {
|
|
accessible = void 0;
|
|
}
|
|
if (accessibilityRole == null) {
|
|
accessibilityRole = void 0;
|
|
}
|
|
if (accessibilityLabel == null) {
|
|
accessibilityLabel = void 0;
|
|
}
|
|
if (!accessibilityHint) {
|
|
accessibilityHint = `Tap to ${typeof DEFAULT_PRESS_BEHAVIOR === "string" ? DEFAULT_PRESS_BEHAVIOR : "move"} the Bottom Sheet`;
|
|
}
|
|
const r127 = <ViewComponent style={memo2} pointerEvents={pointerEvents} accessible={accessible} accessibilityRole={accessibilityRole} accessibilityLabel={accessibilityLabel} accessibilityHint={accessibilityHint}>{children}</ViewComponent>;
|
|
return DEFAULT_PRESS_BEHAVIOR !== "none" ? <GestureDetector gesture={memo}>{r127}</GestureDetector> : r127;
|
|
});
|
|
r32.displayName = "BottomSheetBackdrop";
|
|
export { r32 as BottomSheetBackdrop };
|