From 0a5dfe0f9a8722f7c809240a0c1d5d3b65d6a4bc Mon Sep 17 00:00:00 2001 From: Gabriel Donadel Date: Mon, 18 Mar 2024 21:44:22 -0300 Subject: [PATCH 1/3] fix(app): react-native 0.74 bridgeless mode compatibility --- packages/app/lib/internal/registry/nativeModule.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/packages/app/lib/internal/registry/nativeModule.js b/packages/app/lib/internal/registry/nativeModule.js index 03f001ca08..d31785cd72 100644 --- a/packages/app/lib/internal/registry/nativeModule.js +++ b/packages/app/lib/internal/registry/nativeModule.js @@ -60,7 +60,7 @@ function nativeModuleMethodWrapped(namespace, method, argToPrepend) { * @param argToPrepend */ function nativeModuleWrapped(namespace, NativeModule, argToPrepend) { - const native = {}; + const native = NativeModule; if (!NativeModule) { return NativeModule; } @@ -71,8 +71,6 @@ function nativeModuleWrapped(namespace, NativeModule, argToPrepend) { const property = properties[i]; if (typeof NativeModule[property] === 'function') { native[property] = nativeModuleMethodWrapped(namespace, NativeModule[property], argToPrepend); - } else { - native[property] = NativeModule[property]; } } From 1c4124d4c8facc669d5868b5a2d1b55feb135200 Mon Sep 17 00:00:00 2001 From: Mike Hardy Date: Sun, 19 May 2024 19:42:49 -0500 Subject: [PATCH 2/3] Revert "fix(app): react-native 0.74 bridgeless mode compatibility" This reverts commit 0a5dfe0f9a8722f7c809240a0c1d5d3b65d6a4bc. --- packages/app/lib/internal/registry/nativeModule.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/app/lib/internal/registry/nativeModule.js b/packages/app/lib/internal/registry/nativeModule.js index d31785cd72..03f001ca08 100644 --- a/packages/app/lib/internal/registry/nativeModule.js +++ b/packages/app/lib/internal/registry/nativeModule.js @@ -60,7 +60,7 @@ function nativeModuleMethodWrapped(namespace, method, argToPrepend) { * @param argToPrepend */ function nativeModuleWrapped(namespace, NativeModule, argToPrepend) { - const native = NativeModule; + const native = {}; if (!NativeModule) { return NativeModule; } @@ -71,6 +71,8 @@ function nativeModuleWrapped(namespace, NativeModule, argToPrepend) { const property = properties[i]; if (typeof NativeModule[property] === 'function') { native[property] = nativeModuleMethodWrapped(namespace, NativeModule[property], argToPrepend); + } else { + native[property] = NativeModule[property]; } } From 80fcd1f0077ed172706d3a902bb130b834be3367 Mon Sep 17 00:00:00 2001 From: Mike Hardy Date: Sun, 19 May 2024 19:43:00 -0500 Subject: [PATCH 3/3] fix(app): rn74 new arch bridgeless mode compatibility courtesy of @birdofpreyru --- packages/app/lib/internal/registry/nativeModule.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/app/lib/internal/registry/nativeModule.js b/packages/app/lib/internal/registry/nativeModule.js index 03f001ca08..e93cb6f12f 100644 --- a/packages/app/lib/internal/registry/nativeModule.js +++ b/packages/app/lib/internal/registry/nativeModule.js @@ -65,7 +65,8 @@ function nativeModuleWrapped(namespace, NativeModule, argToPrepend) { return NativeModule; } - const properties = Object.keys(NativeModule); + let properties = Object.keys(Object.getPrototypeOf(NativeModule)); + if (!properties.length) properties = Object.keys(NativeModule); for (let i = 0, len = properties.length; i < len; i++) { const property = properties[i];