Skip to content

Commit

Permalink
fix(metro/patchNativeComponentRegistry): return component name if fail
Browse files Browse the repository at this point in the history
  • Loading branch information
pylixonly committed Dec 26, 2024
1 parent ad9e05c commit 26b7615
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/metro/internals/modules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 26b7615

Please sign in to comment.