Files
discord-decomp/_bundle/createNavigationContainerRef.js
T
2026-11-01 12:12:55 +02:00

77 lines
2.5 KiB
JavaScript

// Metro module 1498 (f1499).
import { CommonActions } from "./Module1485";
import { HermesBuiltin } from "../_hermes/prelude";
function $mk102256($env) {
return (a0) => a0 !== $env[0];
}
let c1207_2 = "The 'navigation' object hasn't been initialized yet. This might happen if you don't have a navigator mounted, or if the navigator hasn't finished mounting. See https://reactnavigation.org/docs/navigating-without-navigation-prop#handling-initialization for more details.";
export default function createNavigationContainerRef() {
let c13071_2;
const r17 = [...Object.keys(CommonActions), "addListener", "removeListener", "resetRoot", "dispatch", "isFocused", "canGoBack", "getRootState", "getState", "getParent", "getCurrentRoute", "getCurrentOptions"];
let c13071_0 = {};
const removeListener2 = (a0, a1) => {};
c13071_2 = null;
const r42 = {};
Object.defineProperty(r42, "current", {
get: function() {
return c13071_2;
},
set: function(a0) {
let c24443_0 = a0;
c13071_2 = a0;
if (a0 != null) {
Object.entries(c13071_0).forEach((a0) => {
let [c28896_0, r24] = a0;
r24.forEach((item) => {
c24443_0.addListener(c28896_0, item);
});
});
}
},
enumerable: true,
configurable: true
});
r42.isReady = () => c13071_2 != null && c13071_2.isReady();
HermesBuiltin.copyDataProperties(r42, r17.reduce((acc, item) => {
acc[item] = function(...args) {
let c28897_0, c28897_1;
c28897_0 = void 0;
c28897_1 = void 0;
if (c13071_2 != null) {
return c13071_2[item].apply(c13071_2, [...args]);
}
if (item === "addListener") {
const r32 = args[0];
c28897_0 = r32;
const r33 = args[1];
c28897_1 = r33;
c13071_0[r32] = c13071_0[r32] || [];
c13071_0[r32].push(r33);
return () => {
let env31238;
const r9 = env31238 = {};
env31238[0] = c28897_1;
if (c13071_0[c28897_0]) {
c13071_0[c28897_0] = c13071_0[c28897_0].filter($mk102256(r9));
}
};
}
if (item === "removeListener") {
const r22 = args[0];
const r23 = args[1];
let env28898;
const r27 = env28898 = {};
env28898[0] = r23;
if (c13071_0[r22]) {
c13071_0[r22] = c13071_0[r22].filter($mk102256(r27));
}
} else {
console.error(c1207_2);
}
};
return acc;
}, {}));
return r42;
};
export { c1207_2 as NOT_INITIALIZED_ERROR };