Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/04xxx/module_4821.js (118.4 MB)
53 lines
1.9 KiB
JavaScript
53 lines
1.9 KiB
JavaScript
// Module ID: 10895
|
|
// Function ID: 10896
|
|
// Dependencies: [19, 21, 1636]
|
|
// Exports: GlobalStateProvider, useGlobalState
|
|
|
|
// Module 10895
|
|
import cancelAnimation from "cancelAnimation" /* 1636 */;
|
|
import noop from "module_19" /* 19 */;
|
|
|
|
require = fn;
|
|
const jsx = fn(21).jsx;
|
|
let context = noop.createContext({});
|
|
const __initData = { code: "function pnpm_indexTsx1(index,dimensions){const{itemDimensions}=this.__closure;itemDimensions.value={...itemDimensions.value,[index]:dimensions};}" };
|
|
const __initData2 = { code: "function pnpm_indexTsx2(dimensions){const{containerSize}=this.__closure;containerSize.value=dimensions;}" };
|
|
|
|
export const GlobalStateContext = context;
|
|
export const GlobalStateProvider = (arg0) => {
|
|
({ children, value } = arg0);
|
|
const sharedValue = cancelAnimation.useSharedValue({ width: 0, height: 0 });
|
|
const sharedValue1 = cancelAnimation.useSharedValue({});
|
|
const fn = function c(arg0, arg1) {
|
|
const obj = {};
|
|
const merged = Object.assign(sharedValue1.value);
|
|
obj[arg0] = arg1;
|
|
sharedValue1.value = obj;
|
|
};
|
|
fn.__closure = { itemDimensions: sharedValue1 };
|
|
fn.__workletHash = 9846581158902;
|
|
fn.__initData = __initData;
|
|
const fn2 = function _(value) {
|
|
sharedValue.value = value;
|
|
};
|
|
fn2.__closure = { containerSize: sharedValue };
|
|
fn2.__workletHash = 5978604737778;
|
|
fn2.__initData = __initData2;
|
|
const obj3 = { value: null, children: null };
|
|
const obj4 = {};
|
|
let merged = Object.assign(value);
|
|
obj4.layout = { containerSize: sharedValue, itemDimensions: sharedValue1, updateItemDimensions: fn, updateContainerSize: fn2 };
|
|
obj3.value = obj4;
|
|
obj3.children = children;
|
|
return <context.Provider value={null}>{null}</context.Provider>;
|
|
};
|
|
export const useGlobalState = () => {
|
|
context = noop.useContext(context);
|
|
if (context) {
|
|
return context;
|
|
} else {
|
|
const _Error = Error;
|
|
const error = new Error("useGlobalState must be used within a GlobalStateProvider");
|
|
throw error;
|
|
}
|
|
};
|