181 lines
7.0 KiB
React
181 lines
7.0 KiB
React
// Metro module 1812 (f1813).
|
|
import Module19, { useCallback, useMemo, forwardRef } from "react";
|
|
import { View } from "react-native";
|
|
import * as _Module1606 from "./Module1606";
|
|
import Module1606, { useSharedValue, useDerivedValue, runOnUI, useAnimatedStyle } from "./Module1606";
|
|
import { useTranslateAnimation, useKeyboardAnimation } from "./Module1813";
|
|
import { useWindowDimensions } from "./useResizeMode";
|
|
import { findNodeHandle } from "./Module1796";
|
|
import { KeyboardControllerNative } from "./Module1596";
|
|
import _default from "./_default_1814";
|
|
const defaultLayout = {
|
|
x: 0,
|
|
y: 0,
|
|
width: 0,
|
|
height: 0
|
|
};
|
|
const __initData = {
|
|
code: "function pnpm_indexTsx1(){const{initialFrame,defaultLayout}=this.__closure;return initialFrame.value||defaultLayout;}"
|
|
};
|
|
const __initData2 = {
|
|
code: "function pnpm_indexTsx2(){const{screenHeight,keyboard,keyboardVerticalOffset,frame}=this.__closure;const keyboardY=screenHeight-keyboard.heightWhenOpened.value-keyboardVerticalOffset;return Math.max(frame.value.y+frame.value.height-keyboardY,0);}"
|
|
};
|
|
const __initData3 = {
|
|
code: "function pnpm_indexTsx3(value){const{interpolate,relativeKeyboardHeight}=this.__closure;return interpolate(value,[0,1],[0,relativeKeyboardHeight()]);}"
|
|
};
|
|
const __initData4 = {
|
|
code: "function pnpm_indexTsx4(layout){const{keyboard,initialFrame,behavior}=this.__closure;if(keyboard.isClosed.value||initialFrame.value===null||behavior!==\"height\"){initialFrame.value=layout;}}"
|
|
};
|
|
const __initData5 = {
|
|
code: "function pnpm_indexTsx5(){const{enabled,interpolateToRelativeKeyboardHeight,keyboard,translate,padding,frame,behavior}=this.__closure;if(!enabled){return{};}const bottom=interpolateToRelativeKeyboardHeight(keyboard.progress.value);const translateY=interpolateToRelativeKeyboardHeight(translate.value);const paddingBottom=interpolateToRelativeKeyboardHeight(padding.value);const height=frame.value.height-bottom;switch(behavior){case\"height\":if(!keyboard.isClosed.value&&height>0){return{height:height,flex:0};}return{};case\"position\":return{bottom:bottom};case\"padding\":return{paddingBottom:bottom};case\"translate-with-padding\":return{paddingTop:paddingBottom,transform:[{translateY:-translateY}]};default:return{};}}"
|
|
};
|
|
export default forwardRef((a0, a1) => {
|
|
let derivedValue, translate, padding, keyboardAnimation, height, callback, callback2, callback3, animatedStyle, contentContainerStyle;
|
|
const { behavior, children, contentContainerStyle: contentContainerStyle2, enabled = true, keyboardVerticalOffset: _keyboardVerticalOffset, automaticOffset: _automaticOffset, style, onLayout, ...props } = a0;
|
|
let c13236_1 = enabled;
|
|
let keyboardVerticalOffset = a0.keyboardVerticalOffset;
|
|
if (keyboardVerticalOffset === void 0) {
|
|
keyboardVerticalOffset = 0;
|
|
}
|
|
let c13236_2 = keyboardVerticalOffset;
|
|
let automaticOffset = a0.automaticOffset;
|
|
if (automaticOffset === void 0) {
|
|
automaticOffset = false;
|
|
}
|
|
let c13236_3 = automaticOffset;
|
|
derivedValue = void 0;
|
|
translate = void 0;
|
|
padding = void 0;
|
|
keyboardAnimation = void 0;
|
|
height = void 0;
|
|
callback = void 0;
|
|
callback2 = void 0;
|
|
callback3 = void 0;
|
|
animatedStyle = void 0;
|
|
contentContainerStyle = void 0;
|
|
const sharedValue = useSharedValue(null);
|
|
const ref = Module19.useRef(null);
|
|
const K = () => sharedValue.value || defaultLayout;
|
|
K.__closure = {
|
|
initialFrame: sharedValue,
|
|
defaultLayout
|
|
};
|
|
K.__workletHash = 4703969179658;
|
|
K.__initData = __initData;
|
|
derivedValue = useDerivedValue(K);
|
|
const translateAnimation = useTranslateAnimation();
|
|
translate = translateAnimation.translate;
|
|
padding = translateAnimation.padding;
|
|
keyboardAnimation = useKeyboardAnimation();
|
|
height = useWindowDimensions().height;
|
|
const V = function V() {
|
|
return Math.max(derivedValue.value.y + derivedValue.value.height - (height - keyboardAnimation.heightWhenOpened.value - c13236_2), 0);
|
|
};
|
|
V.__closure = {
|
|
screenHeight: height,
|
|
keyboard: keyboardAnimation,
|
|
keyboardVerticalOffset,
|
|
frame: derivedValue
|
|
};
|
|
V.__workletHash = 10539040422992;
|
|
V.__initData = __initData2;
|
|
callback = useCallback(V, [height, keyboardVerticalOffset]);
|
|
const C = function C(a0) {
|
|
return _Module1606.interpolate(a0, [0, 1], [0, callback()]);
|
|
};
|
|
C.__closure = {
|
|
interpolate: _Module1606.interpolate,
|
|
relativeKeyboardHeight: callback
|
|
};
|
|
C.__workletHash = 11482114301276;
|
|
C.__initData = __initData3;
|
|
callback2 = useCallback(C, [callback]);
|
|
const D = function D(a0) {
|
|
if (keyboardAnimation.isClosed.value || sharedValue.value === null || behavior !== "height") {
|
|
sharedValue.value = a0;
|
|
}
|
|
};
|
|
D.__closure = {
|
|
keyboard: keyboardAnimation,
|
|
initialFrame: sharedValue,
|
|
behavior
|
|
};
|
|
D.__workletHash = 12256944793057;
|
|
D.__initData = __initData4;
|
|
callback3 = useCallback(D, [behavior]);
|
|
const callback4 = useCallback((a0) => {
|
|
if (onLayout != null) {
|
|
onLayout(a0);
|
|
}
|
|
const layout = a0.nativeEvent.layout;
|
|
if (c13236_3) {
|
|
const r19 = findNodeHandle(ref.current);
|
|
if (r19 !== null) {
|
|
return KeyboardControllerNative.viewPositionInWindow(r19).then((result) => {
|
|
runOnUI(callback3)({
|
|
...layout,
|
|
x: result.x,
|
|
y: result.y
|
|
});
|
|
}).catch(() => {
|
|
runOnUI(callback3)(layout);
|
|
});
|
|
}
|
|
}
|
|
return runOnUI(callback3)(layout);
|
|
}, [onLayout, automaticOffset]);
|
|
const F = function F() {
|
|
if (c13236_1) {
|
|
const bottom = callback2(keyboardAnimation.progress.value);
|
|
const r6 = callback2(translate.value);
|
|
const paddingTop = callback2(padding.value);
|
|
const height2 = derivedValue.value.height - bottom;
|
|
if (behavior === "height") {
|
|
return !keyboardAnimation.isClosed.value && height2 > 0 ? {
|
|
height: height2,
|
|
flex: 0
|
|
} : {};
|
|
}
|
|
if (behavior === "position") {
|
|
return {
|
|
bottom
|
|
};
|
|
}
|
|
if (behavior === "padding") {
|
|
return {
|
|
paddingBottom: bottom
|
|
};
|
|
}
|
|
if (behavior === "translate-with-padding") {
|
|
return {
|
|
paddingTop,
|
|
transform: [{
|
|
translateY: -r6
|
|
}]
|
|
};
|
|
}
|
|
return {};
|
|
}
|
|
return {};
|
|
};
|
|
F.__closure = {
|
|
enabled,
|
|
interpolateToRelativeKeyboardHeight: callback2,
|
|
keyboard: keyboardAnimation,
|
|
translate,
|
|
padding,
|
|
frame: derivedValue,
|
|
behavior
|
|
};
|
|
F.__workletHash = 6440002265153;
|
|
F.__initData = __initData5;
|
|
animatedStyle = useAnimatedStyle(F, [behavior, enabled, callback2]);
|
|
const ref2 = _default(ref, a1);
|
|
const r90 = behavior === "position";
|
|
contentContainerStyle = r90 ? contentContainerStyle2 : style;
|
|
const memo = useMemo(() => [contentContainerStyle, animatedStyle], [contentContainerStyle, animatedStyle]);
|
|
return r90 ? <View ref={ref2} style={style} onLayout={callback4} {...props}>
|
|
<Module1606.View style={memo}>{children}</Module1606.View>
|
|
</View> : <Module1606.View ref={ref2} style={memo} onLayout={callback4} {...props}>{children}</Module1606.View>;
|
|
});
|