decord/alpha/source/utils/native/requireNativeComponentOrDefault.native.tsx

55 lines
1.8 KiB
TypeScript
Raw Normal View History

2026-10-10 08:08:14 +00:00
// Module ID: 5368
// Function ID: 5369
// Name: requireNativeComponentOrDefault
2026-07-29 08:29:29 +00:00
// Dependencies: [17, 3, 2]
2026-07-20 16:05:17 +00:00
// Exports: default
2026-10-10 08:08:14 +00:00
// Module 5368 (requireNativeComponentOrDefault)
import LoggerDefault from "Logger" /* 3 */;
2026-10-03 08:58:59 +00:00
import react_native from "react-native" /* 17 */;
import size from "module_2" /* 2 */;
2026-07-23 10:11:24 +00:00
2026-10-03 08:58:59 +00:00
let set;
let _window;
let c2;
let map;
({ requireNativeComponent: _window, UIManager: map, View: c2 } = react_native);
const logger = new LoggerDefault("RequireNativeComponentOrDefault");
2026-10-03 08:58:59 +00:00
const tmp3 = new LoggerDefault("RequireNativeComponentOrDefault");
map = new Map();
let result = size.fileFinishedImporting("utils/native/requireNativeComponentOrDefault.native.tsx");
2026-07-20 16:05:17 +00:00
export default function requireNativeComponentOrDefault(warnWhenMissing) {
2026-10-03 08:58:59 +00:00
let componentFoundInstance;
let componentMissingFallbackInstance;
let componentName;
let value;
2026-07-20 16:05:17 +00:00
({ componentName, componentFoundInstance, componentMissingFallbackInstance } = warnWhenMissing);
if (componentMissingFallbackInstance === undefined) {
componentMissingFallbackInstance = React2;
2026-07-20 16:05:17 +00:00
}
let flag = warnWhenMissing.warnWhenMissing;
if (flag === undefined) {
flag = true;
}
2026-10-03 08:58:59 +00:00
if (map.hasViewManagerConfig(componentName)) {
2026-07-20 16:05:17 +00:00
if (!map.has(componentName)) {
2026-10-03 08:58:59 +00:00
set = map.set;
2026-07-29 08:29:29 +00:00
if (componentFoundInstance == null) {
componentFoundInstance = React(componentName);
2026-07-20 16:05:17 +00:00
}
2026-10-03 08:58:59 +00:00
const result = set(componentName, componentFoundInstance);
2026-07-20 16:05:17 +00:00
}
value = obj.get(componentName);
2026-07-20 16:05:17 +00:00
} else {
value = componentMissingFallbackInstance;
if (flag) {
const _HermesInternal = HermesInternal;
2026-08-24 06:08:38 +00:00
logger.warn("" + componentName + " not found, you are likely on a branch override without the native code.");
2026-07-20 16:05:17 +00:00
value = componentMissingFallbackInstance;
}
}
return value;
};