103 lines
4.3 KiB
JavaScript
103 lines
4.3 KiB
JavaScript
// Metro module 5360 (f5361).
|
|
import { useEffect } from "react";
|
|
import { Keyboard, Platform } from "react-native";
|
|
import { useSharedValue, useWorkletCallback, runOnUI, useAnimatedReaction } from "./Module1606";
|
|
import * as _Module5246 from "./Module5246";
|
|
import { SCREEN_HEIGHT } from "./Module5246";
|
|
Platform;
|
|
let c3274_4 = "keyboardDidShow";
|
|
let c3274_5 = "keyboardDidHide";
|
|
const __initData = {
|
|
code: "function pnpm_useKeyboardTs1(state,height,duration,easing,bottomOffset){const{KEYBOARD_STATE,shouldHandleKeyboardEvents,temporaryCachedKeyboardEvent,keyboardHeight,includeBottomOffset,keyboardAnimationDuration,keyboardAnimationEasing,keyboardState}=this.__closure;if(state===KEYBOARD_STATE.SHOWN&&!shouldHandleKeyboardEvents.value){temporaryCachedKeyboardEvent.value=[state,height,duration,easing];return;}keyboardHeight.value=state===KEYBOARD_STATE.SHOWN?height:keyboardHeight.value;if(bottomOffset&&includeBottomOffset){keyboardHeight.value=keyboardHeight.value+bottomOffset;}keyboardAnimationDuration.value=duration;keyboardAnimationEasing.value=easing;keyboardState.value=state;temporaryCachedKeyboardEvent.value=[];}"
|
|
};
|
|
const __initData2 = {
|
|
code: "function pnpm_useKeyboardTs2(){const{shouldHandleKeyboardEvents}=this.__closure;return shouldHandleKeyboardEvents.value;}"
|
|
};
|
|
const __initData3 = {
|
|
code: "function pnpm_useKeyboardTs3(result){const{temporaryCachedKeyboardEvent,handleKeyboardEvent}=this.__closure;const params=temporaryCachedKeyboardEvent.value;if(result&¶ms.length>0){handleKeyboardEvent(params[0],params[1],params[2],params[3]);}}"
|
|
};
|
|
export const useKeyboard = ({ includeBottomOffset }) => {
|
|
let workletCallback;
|
|
workletCallback = void 0;
|
|
const sharedValue = useSharedValue(false);
|
|
const sharedValue2 = useSharedValue(_Module5246.KEYBOARD_STATE.UNDETERMINED);
|
|
const sharedValue3 = useSharedValue(0);
|
|
const sharedValue4 = useSharedValue("keyboard");
|
|
const sharedValue5 = useSharedValue(500);
|
|
const sharedValue6 = useSharedValue([]);
|
|
const v = function v(a0, a1, a2, a3, a4) {
|
|
let value = a1;
|
|
if (a0 === _Module5246.KEYBOARD_STATE.SHOWN && !sharedValue.value) {
|
|
sharedValue6.value = [a0, a1, a2, a3];
|
|
} else {
|
|
if (a0 !== _Module5246.KEYBOARD_STATE.SHOWN) {
|
|
value = sharedValue3.value;
|
|
}
|
|
sharedValue3.value = value;
|
|
if (a4 ? includeBottomOffset : a4) {
|
|
sharedValue3.value = sharedValue3.value + a4;
|
|
}
|
|
sharedValue5.value = a2;
|
|
sharedValue4.value = a3;
|
|
sharedValue2.value = a0;
|
|
sharedValue6.value = [];
|
|
}
|
|
};
|
|
v.__closure = {
|
|
KEYBOARD_STATE: _Module5246.KEYBOARD_STATE,
|
|
shouldHandleKeyboardEvents: sharedValue,
|
|
temporaryCachedKeyboardEvent: sharedValue6,
|
|
keyboardHeight: sharedValue3,
|
|
includeBottomOffset,
|
|
keyboardAnimationDuration: sharedValue5,
|
|
keyboardAnimationEasing: sharedValue4,
|
|
keyboardState: sharedValue2
|
|
};
|
|
v.__workletHash = 7905199978020;
|
|
v.__initData = __initData;
|
|
workletCallback = useWorkletCallback(v, []);
|
|
useEffect(() => {
|
|
let c25445_1;
|
|
let c25445_0 = Keyboard.addListener(c3274_4, (a0) => {
|
|
runOnUI(workletCallback)(_Module5246.KEYBOARD_STATE.SHOWN, a0.endCoordinates.height, a0.duration, a0.easing, SCREEN_HEIGHT - a0.endCoordinates.height - a0.endCoordinates.screenY);
|
|
});
|
|
c25445_1 = Keyboard.addListener(c3274_5, (a0) => {
|
|
runOnUI(workletCallback)(_Module5246.KEYBOARD_STATE.HIDDEN, a0.endCoordinates.height, a0.duration, a0.easing);
|
|
});
|
|
return () => {
|
|
c25445_0.remove();
|
|
c25445_1.remove();
|
|
};
|
|
}, [workletCallback]);
|
|
const b = () => sharedValue.value;
|
|
b.__closure = {
|
|
shouldHandleKeyboardEvents: sharedValue
|
|
};
|
|
b.__workletHash = 11615500623565;
|
|
b.__initData = __initData2;
|
|
const y = function y(a0) {
|
|
let r4 = a0;
|
|
const value = sharedValue6.value;
|
|
if (a0) {
|
|
r4 = value.length > 0;
|
|
}
|
|
if (r4) {
|
|
workletCallback(value[0], value[1], value[2], value[3]);
|
|
}
|
|
};
|
|
y.__closure = {
|
|
temporaryCachedKeyboardEvent: sharedValue6,
|
|
handleKeyboardEvent: workletCallback
|
|
};
|
|
y.__workletHash = 16636741173520;
|
|
y.__initData = __initData3;
|
|
useAnimatedReaction(b, y, []);
|
|
return {
|
|
state: sharedValue2,
|
|
height: sharedValue3,
|
|
animationEasing: sharedValue4,
|
|
animationDuration: sharedValue5,
|
|
shouldHandleKeyboardEvents: sharedValue
|
|
};
|
|
};
|