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

54 lines
1.6 KiB
React

// Metro module 5307 (f5308).
import { useImperativeHandle, useRef, forwardRef } from "react";
import { nativeViewProps, NativeViewGestureHandler } from "./Module5308";
let c3204_6 = [...nativeViewProps, "onGestureHandlerEvent", "onGestureHandlerStateChange"];
export default function createNativeWrapper(a0) {
let Component = a0;
let r5 = arguments[1];
if (r5 === void 0) {
r5 = {};
}
let c14787_1 = r5;
const r11 = forwardRef((a0, a1) => {
let ref, ref2;
const r23 = Object.keys(a0).reduce((acc, item) => {
if (c3204_6.includes(item)) {
acc.gestureHandlerProps[item] = a0[item];
} else {
acc.childProps[item] = a0[item];
}
return acc;
}, {
gestureHandlerProps: {
...c14787_1
},
childProps: {
enabled: a0.enabled,
hitSlop: a0.hitSlop,
testID: a0.testID
}
});
const { gestureHandlerProps, childProps } = r23;
ref = useRef(null);
ref2 = useRef(null);
useImperativeHandle(a1, () => {
const current = ref2.current;
const current2 = ref.current;
let r6 = null;
if (current2) {
r6 = null;
if (current) {
ref.current.handlerTag = current.handlerTag;
r6 = ref.current;
}
}
return r6;
}, [ref, ref2]);
return <NativeViewGestureHandler {...gestureHandlerProps} ref={ref2}>
<Component {...childProps} ref={ref} />
</NativeViewGestureHandler>;
});
r11.displayName = a0?.displayName || (a0 == null ? void 0 : a0.render?.name) || (typeof a0 === "string" ? a0 : typeof a0 === "string") || "ComponentWrapper";
return r11;
};