fix(metro/patchNativeComponentRegistry): return component name if fail
This commit is contained in:
parent
ad9e05c203
commit
26b7615f84
1 changed files with 5 additions and 3 deletions
|
|
@ -91,10 +91,12 @@ function onModuleRequire(moduleExports: any, id: Metro.ModuleID) {
|
||||||
|
|
||||||
// There are modules registering the same native component
|
// There are modules registering the same native component
|
||||||
if (!patchedNativeComponentRegistry && ["customBubblingEventTypes", "customDirectEventTypes", "register", "get"].every(x => moduleExports[x])) {
|
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 {
|
try {
|
||||||
return origFunc(...args);
|
return origFunc(name, cb);
|
||||||
} catch { }
|
} catch {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
patchedNativeComponentRegistry = true;
|
patchedNativeComponentRegistry = true;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue