decord/source/1522_useNavigationCache.js

103 lines
3.3 KiB
JavaScript
Raw Normal View History

2026-07-20 16:05:17 +00:00
// Module ID: 1522
2026-07-25 08:10:48 +00:00
// Function ID: 17462
2026-07-20 16:05:17 +00:00
// Name: useNavigationCache
2026-07-23 10:11:24 +00:00
// Dependencies: [77, 29, 31, 1478, 1461]
2026-07-20 16:05:17 +00:00
// Exports: default
// Module 1522 (useNavigationCache)
2026-07-23 10:11:24 +00:00
import _defineProperty from "_defineProperty";
import _objectWithoutProperties from "_objectWithoutProperties";
import result from "result";
const require = arg1;
let closure_3 = ["emit"];
2026-07-20 16:05:17 +00:00
export default function useNavigationCache(getState) {
let emitter;
let router;
getState = getState.getState;
2026-07-23 10:11:24 +00:00
let navigation = getState.navigation;
let setOptions = getState.setOptions;
2026-07-20 16:05:17 +00:00
({ router, emitter } = getState);
2026-07-23 10:11:24 +00:00
const stackRef = React.useContext(navigation(setOptions[3])).stackRef;
2026-07-20 16:05:17 +00:00
const items = [getState, navigation, setOptions, router, emitter];
const memo = React.useMemo(() => ({ current: {} }), items);
2026-07-23 10:11:24 +00:00
let _objectWithoutProperties = Object.assign({}, router.actionCreators, getState(setOptions[4]).CommonActions);
2026-07-20 16:05:17 +00:00
const routes = getState.state.routes;
memo.current = routes.reduce((arg0, key) => {
2026-07-23 10:11:24 +00:00
let closure_0 = arg0;
2026-07-20 16:05:17 +00:00
const navigation = key;
if (withStack.current[key.key]) {
arg0[key.key] = tmp;
} else {
const emit = navigation.emit;
2026-07-23 10:11:24 +00:00
const tmp5 = callback(navigation, emitter);
2026-07-20 16:05:17 +00:00
const setOptions = tmp5;
function dispatch(arg0) {
let tmp = arg0;
if ("function" === typeof arg0) {
2026-07-23 10:11:24 +00:00
tmp = arg0(dependencyMap());
2026-07-20 16:05:17 +00:00
}
if (null != tmp) {
const _Object = Object;
2026-07-23 10:11:24 +00:00
const obj = { source: key.key };
key.dispatch(Object.assign(obj, tmp));
2026-07-20 16:05:17 +00:00
}
}
2026-07-23 10:11:24 +00:00
withStack = function withStack(arg0) {
2026-07-20 16:05:17 +00:00
arg0();
2026-07-23 10:11:24 +00:00
};
let _Object = Object;
2026-07-20 16:05:17 +00:00
const keys = Object.keys(callback);
const _Object2 = Object;
const reduced = keys.reduce((arg0, arg1) => {
2026-07-23 10:11:24 +00:00
let closure_0 = arg1;
2026-07-20 16:05:17 +00:00
arg0[arg1] = () => {
const length = arguments.length;
const array = new Array(length);
for (let num = 0; num < length; num = num + 1) {
array[num] = arguments[num];
}
2026-07-23 10:11:24 +00:00
return outer1_4(() => outer2_3(outer3_5[array].apply(outer3_5, array)));
2026-07-20 16:05:17 +00:00
};
return arg0;
}, {});
2026-07-23 10:11:24 +00:00
let obj = {
2026-07-20 16:05:17 +00:00
dispatch(arg0) {
2026-07-23 10:11:24 +00:00
let closure_0 = arg0;
return withStack(() => outer1_3(closure_0));
2026-07-20 16:05:17 +00:00
},
getParent(arg0) {
if (undefined !== arg0) {
if (arg0 === tmp5.getId()) {
2026-07-23 10:11:24 +00:00
let parent = dependencyMap[key.key];
2026-07-20 16:05:17 +00:00
}
return parent;
}
parent = tmp5.getParent(arg0);
},
setOptions(arg0) {
2026-07-23 10:11:24 +00:00
let closure_0 = arg0;
return tmp5((arg0) => Object.assign({}, arg0, memo({}, outer1_1.key, Object.assign({}, arg0[outer1_1.key], closure_0))));
2026-07-20 16:05:17 +00:00
},
2026-07-23 10:11:24 +00:00
isFocused() {
const tmp = dependencyMap();
let tmp2 = tmp.routes[tmp.index].key === key.key;
2026-07-20 16:05:17 +00:00
if (tmp2) {
2026-07-23 10:11:24 +00:00
let isFocusedResult = !key;
2026-07-20 16:05:17 +00:00
if (!isFocusedResult) {
2026-07-23 10:11:24 +00:00
isFocusedResult = key.isFocused();
2026-07-20 16:05:17 +00:00
}
tmp2 = isFocusedResult;
}
return tmp2;
}
};
const _Object3 = Object;
arg0[key.key] = Object.assign({}, tmp5, reduced, dispatch.create(key.key), obj);
}
return arg0;
}, {});
return memo.current;
};