47 lines
1.2 KiB
JavaScript
47 lines
1.2 KiB
JavaScript
// Metro module 1795 (f1796).
|
|
import { useRef } from "react";
|
|
import { Animated } from "react-native";
|
|
import { findNodeHandle } from "./Module1796";
|
|
export function useEventHandlerRegistration(c13227_0) {
|
|
return (a0) => {
|
|
if (c13227_0.current) {
|
|
const r18 = findNodeHandle(c13227_0.current);
|
|
if (r18) {
|
|
if ("workletEventHandler" in a0) {
|
|
a0.workletEventHandler.registerForEvents(r18);
|
|
} else {
|
|
a0.registerForEvents(r18);
|
|
}
|
|
}
|
|
} else {
|
|
queueMicrotask(() => {
|
|
const r11 = findNodeHandle(c13227_0.current);
|
|
if (r11) {
|
|
if ("workletEventHandler" in a0) {
|
|
a0.workletEventHandler.registerForEvents(r11);
|
|
} else {
|
|
a0.registerForEvents(r11);
|
|
}
|
|
}
|
|
});
|
|
}
|
|
return () => {
|
|
const r11 = findNodeHandle(c13227_0.current);
|
|
if (r11) {
|
|
if ("workletEventHandler" in a0) {
|
|
a0.workletEventHandler.unregisterFromEvents(r11);
|
|
} else {
|
|
a0.unregisterFromEvents(r11);
|
|
}
|
|
}
|
|
};
|
|
};
|
|
}
|
|
export function useAnimatedValue(a0, a1) {
|
|
const ref = useRef(null);
|
|
if (ref.current === null) {
|
|
ref.current = new Animated.Value(a0, a1);
|
|
}
|
|
return ref.current;
|
|
}
|