55 lines
1.4 KiB
JavaScript
55 lines
1.4 KiB
JavaScript
// Metro module 1764 (f1765).
|
|
import { useEffect, useRef } from "react";
|
|
import { shouldBeUseWeb } from "./Module1609";
|
|
import { makeMutable, startMapper, stopMapper } from "./Module1650";
|
|
import { initialUpdaterRun } from "./Module1678";
|
|
const __initData = {
|
|
code: "function pnpm_useDerivedValueTs1(){const{sharedValue,updater}=this.__closure;sharedValue.value=updater();}"
|
|
};
|
|
export function useDerivedValue(a0, a1) {
|
|
const updater = a0;
|
|
const ref = useRef(null);
|
|
const r9 = Object;
|
|
let __closure = a0.__closure;
|
|
if (__closure == null) {
|
|
__closure = {};
|
|
}
|
|
let r10 = r9.values(__closure);
|
|
let c13213_1 = r10;
|
|
let r24 = shouldBeUseWeb() && !r10.length;
|
|
let r26 = a1;
|
|
if (r24) {
|
|
r24 = a1?.length;
|
|
}
|
|
if (r24) {
|
|
c13213_1 = a1;
|
|
r10 = a1;
|
|
}
|
|
if (a1 === void 0) {
|
|
r26 = [...r10, a0.__workletHash];
|
|
} else {
|
|
a1.push(a0.__workletHash);
|
|
}
|
|
if (ref.current === null) {
|
|
ref.current = makeMutable(initialUpdaterRun(a0));
|
|
}
|
|
const current = ref.current;
|
|
useEffect(() => {
|
|
let c24669_0;
|
|
const t = function t() {
|
|
current.value = updater();
|
|
};
|
|
t.__closure = {
|
|
sharedValue: current,
|
|
updater
|
|
};
|
|
t.__workletHash = 1316501239615;
|
|
t.__initData = __initData;
|
|
c24669_0 = startMapper(t, c13213_1, [current]);
|
|
return () => {
|
|
stopMapper(c24669_0);
|
|
};
|
|
}, r26);
|
|
return current;
|
|
}
|