fix(metro/patchNativeComponentRegistry): return component name if fail

This commit is contained in:
pylixonly 2024-12-26 12:54:58 +08:00
parent ad9e05c203
commit 26b7615f84

View file

@ -91,10 +91,12 @@ function onModuleRequire(moduleExports: any, id: Metro.ModuleID) {
// There are modules registering the same native component
if (!patchedNativeComponentRegistry && ["customBubblingEventTypes", "customDirectEventTypes", "register", "get"].every(x => moduleExports[x])) {
instead("register", moduleExports, (args: any, origFunc: any) => {
instead("register", moduleExports, ([name, cb]: any, origFunc: any) => {
try {
return origFunc(...args);
} catch { }
return origFunc(name, cb);
} catch {
return name;
}
});
patchedNativeComponentRegistry = true;