28 lines
737 B
JavaScript
28 lines
737 B
JavaScript
// Metro module 5364 (f5365).
|
|
import { useEffect, useRef } from "react";
|
|
import { makeMutable, cancelAnimation } from "./Module1606";
|
|
export const useReactiveSharedValue = (a0) => {
|
|
const ref2 = useRef(null);
|
|
const ref = useRef(null);
|
|
if (!((a0 ? typeof a0 === "object" : a0) && "value" in a0)) {
|
|
if (ref.current === null) {
|
|
ref2.current = a0;
|
|
ref.current = typeof a0 === "object" ? makeMutable({
|
|
...a0
|
|
}) : makeMutable(a0);
|
|
} else if (ref2.current !== a0) {
|
|
ref.current.value = a0;
|
|
}
|
|
}
|
|
useEffect(() => () => {
|
|
if (ref.current) {
|
|
cancelAnimation(ref.current);
|
|
}
|
|
}, []);
|
|
let current = ref.current;
|
|
if (current == null) {
|
|
current = a0;
|
|
}
|
|
return current;
|
|
};
|