190 lines
6.6 KiB
React
190 lines
6.6 KiB
React
// Metro module 1604 (f1605).
|
|
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
import { Animated, StyleSheet, Platform } from "react-native";
|
|
import * as _Module1605 from "./Module1605";
|
|
import Module1606, { useSharedValue } from "./Module1606";
|
|
import { KeyboardControllerView, KeyboardControllerViewCommands, FocusedInputEvents } from "./Module1596";
|
|
import { useAnimatedValue, useEventHandlerRegistration } from "./Module1795";
|
|
import { useAnimatedKeyboardHandler, useFocusedInputLayoutHandler } from "./Module1797";
|
|
import { KeyboardController } from "./Module1798";
|
|
import { KeyboardContext } from "./NOOP_1799";
|
|
Platform;
|
|
const isEdgeToEdge = _Module1605.isEdgeToEdge();
|
|
const AnimatedComponent = Module1606.createAnimatedComponent(Animated.createAnimatedComponent(KeyboardControllerView));
|
|
const styles = StyleSheet.create({
|
|
container: {
|
|
flex: 1
|
|
},
|
|
hidden: {
|
|
display: "none",
|
|
position: "absolute"
|
|
}
|
|
});
|
|
const OS = "android";
|
|
const __initData = {
|
|
code: "function pnpm_animatedTsx1(event,platforms){const{OS,progressSV,heightSV}=this.__closure;if(platforms.includes(OS)){progressSV.value=event.progress;heightSV.value=-event.height;}}"
|
|
};
|
|
const __initData2 = {
|
|
code: "function pnpm_animatedTsx2(event){const{updateSharedValues}=this.__closure;updateSharedValues(event,[\"ios\"]);}"
|
|
};
|
|
const __initData3 = {
|
|
code: "function pnpm_animatedTsx3(event){const{updateSharedValues}=this.__closure;updateSharedValues(event,[\"android\"]);}"
|
|
};
|
|
const __initData4 = {
|
|
code: "function pnpm_animatedTsx4(event){const{updateSharedValues}=this.__closure;updateSharedValues(event,[\"android\",\"ios\"]);}"
|
|
};
|
|
const __initData5 = {
|
|
code: "function pnpm_animatedTsx5(event){const{updateSharedValues}=this.__closure;updateSharedValues(event,[\"android\"]);}"
|
|
};
|
|
const __initData6 = {
|
|
code: "function pnpm_animatedTsx6(e){const{layout}=this.__closure;if(e.target!==-1){layout.value=e;}else{layout.value=null;}}"
|
|
};
|
|
export const KeyboardProvider = ({ children, statusBarTranslucent, navigationBarTranslucent, preserveEdgeToEdge, enabled = true, preload: preload2 = true }) => {
|
|
let c13128_12;
|
|
const preload = preload2;
|
|
const ref = useRef(null);
|
|
const [state, setState] = useState(enabled);
|
|
const animatedValue = useAnimatedValue(0);
|
|
const animatedValue2 = useAnimatedValue(0);
|
|
const sharedValue = useSharedValue(0);
|
|
const sharedValue2 = useSharedValue(0);
|
|
const sharedValue3 = useSharedValue(null);
|
|
const eventHandlerRegistration = useEventHandlerRegistration(ref);
|
|
const eventHandlerRegistration2 = useEventHandlerRegistration(ref);
|
|
const callback = useCallback(async () => {
|
|
KeyboardControllerViewCommands.synchronizeFocusedInputLayout(ref.current);
|
|
await new Promise((c31242_0) => {
|
|
let c31242_1 = FocusedInputEvents.addListener("layoutDidSynchronize", () => {
|
|
c31242_1.remove();
|
|
c31242_0(null);
|
|
});
|
|
});
|
|
}, []);
|
|
const memo = useMemo(() => ({
|
|
enabled: state,
|
|
animated: {
|
|
progress: animatedValue,
|
|
height: Animated.multiply(animatedValue2, -1)
|
|
},
|
|
reanimated: {
|
|
progress: sharedValue,
|
|
height: sharedValue2
|
|
},
|
|
layout: sharedValue3,
|
|
update: callback,
|
|
setKeyboardHandlers: eventHandlerRegistration,
|
|
setInputHandlers: eventHandlerRegistration2,
|
|
setEnabled: setState
|
|
}), [state]);
|
|
const memo2 = useMemo(() => [styles.hidden, {
|
|
transform: [{
|
|
translateX: animatedValue2
|
|
}, {
|
|
translateY: animatedValue
|
|
}]
|
|
}], []);
|
|
const memo3 = useMemo(() => Animated.event([{
|
|
nativeEvent: {
|
|
progress: animatedValue,
|
|
height: animatedValue2
|
|
}
|
|
}], {
|
|
useNativeDriver: true
|
|
}), []);
|
|
const _ = function _(a0, a1) {
|
|
if (a1.includes(OS)) {
|
|
sharedValue.value = a0.progress;
|
|
sharedValue2.value = -a0.height;
|
|
}
|
|
};
|
|
_.__closure = {
|
|
OS,
|
|
progressSV: sharedValue,
|
|
heightSV: sharedValue2
|
|
};
|
|
_.__workletHash = 2170890222740;
|
|
_.__initData = __initData;
|
|
c13128_12 = _;
|
|
const D = function D(a0) {
|
|
if (["ios"].includes(OS)) {
|
|
sharedValue.value = a0.progress;
|
|
sharedValue2.value = -a0.height;
|
|
}
|
|
};
|
|
D.__closure = {
|
|
updateSharedValues: _
|
|
};
|
|
D.__workletHash = 17024171887285;
|
|
D.__initData = __initData2;
|
|
const C = function C(a0) {
|
|
if (["android"].includes(OS)) {
|
|
sharedValue.value = a0.progress;
|
|
sharedValue2.value = -a0.height;
|
|
}
|
|
};
|
|
C.__closure = {
|
|
updateSharedValues: _
|
|
};
|
|
C.__workletHash = 9343239356186;
|
|
C.__initData = __initData3;
|
|
const onKeyboardMoveInteractive = function(a0) {
|
|
if (["android", "ios"].includes(OS)) {
|
|
sharedValue.value = a0.progress;
|
|
sharedValue2.value = -a0.height;
|
|
}
|
|
};
|
|
onKeyboardMoveInteractive.__closure = {
|
|
updateSharedValues: _
|
|
};
|
|
onKeyboardMoveInteractive.__workletHash = 9270729921284;
|
|
onKeyboardMoveInteractive.__initData = __initData4;
|
|
const v = function v(a0) {
|
|
if (["android"].includes(OS)) {
|
|
sharedValue.value = a0.progress;
|
|
sharedValue2.value = -a0.height;
|
|
}
|
|
};
|
|
v.__closure = {
|
|
updateSharedValues: _
|
|
};
|
|
v.__workletHash = 10129400155228;
|
|
v.__initData = __initData5;
|
|
const animatedKeyboardHandler = useAnimatedKeyboardHandler({
|
|
onKeyboardMoveStart: D,
|
|
onKeyboardMove: C,
|
|
onKeyboardMoveInteractive,
|
|
onKeyboardMoveEnd: v
|
|
}, []);
|
|
const I = function I(a0) {
|
|
if (a0.target !== -1) {
|
|
sharedValue3.value = a0;
|
|
} else {
|
|
sharedValue3.value = null;
|
|
}
|
|
};
|
|
I.__closure = {
|
|
layout: sharedValue3
|
|
};
|
|
I.__workletHash = 9857955983587;
|
|
I.__initData = __initData6;
|
|
const focusedInputLayoutHandler = useFocusedInputLayoutHandler({
|
|
onFocusedInputLayoutChanged: I
|
|
}, []);
|
|
useEffect(() => {
|
|
if (preload) {
|
|
KeyboardController.preload();
|
|
}
|
|
}, [preload]);
|
|
const Provider = KeyboardContext.Provider;
|
|
let preserveEdgeToEdge2 = isEdgeToEdge;
|
|
const navigationBarTranslucent2 = isEdgeToEdge ? isEdgeToEdge : navigationBarTranslucent;
|
|
const statusBarTranslucent2 = isEdgeToEdge ? isEdgeToEdge : statusBarTranslucent;
|
|
if (!isEdgeToEdge) {
|
|
preserveEdgeToEdge2 = preserveEdgeToEdge;
|
|
}
|
|
return <Provider value={memo}>
|
|
<AnimatedComponent ref={ref} enabled={state} navigationBarTranslucent={navigationBarTranslucent2} statusBarTranslucent={statusBarTranslucent2} preserveEdgeToEdge={preserveEdgeToEdge2} style={styles.container} onKeyboardMoveReanimated={animatedKeyboardHandler} onKeyboardMoveStart={void 0} onKeyboardMove={memo3} onKeyboardMoveInteractive={memo3} onKeyboardMoveEnd={memo3} onFocusedInputLayoutChangedReanimated={focusedInputLayoutHandler}>{children}</AnimatedComponent>
|
|
<Animated.View style={memo2} />
|
|
</Provider>;
|
|
};
|