From aa82b182b5c08668558acacb9ab705b1e77c9460 Mon Sep 17 00:00:00 2001 From: Kilian Finger Date: Fri, 22 Nov 2024 08:39:26 +0100 Subject: [PATCH 1/2] fix: use UIManager exported from react-native Fixes #488 --- javascript/utils/index.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/javascript/utils/index.ts b/javascript/utils/index.ts index 1f529d38e..5e5d1b3ff 100644 --- a/javascript/utils/index.ts +++ b/javascript/utils/index.ts @@ -5,14 +5,11 @@ import { findNodeHandle, Platform, ImageSourcePropType, + UIManager, } from "react-native"; -function getAndroidManagerInstance(module: string): any { - const haveViewManagerConfig = - NativeModules.UIManager && NativeModules.UIManager.getViewManagerConfig; - return haveViewManagerConfig - ? NativeModules.UIManager.getViewManagerConfig(module) - : NativeModules.UIManager[module]; +function getAndroidManagerInstance(module: string) { + return UIManager.getViewManagerConfig(module); } function getIosManagerInstance(module: string): any { @@ -84,11 +81,13 @@ export function runNativeCommand( } if (isAndroid()) { - return NativeModules.UIManager.dispatchViewManagerCommand( + UIManager.dispatchViewManagerCommand( handle, managerInstance.Commands[name], args, ); + + return null as ReturnType; } return managerInstance[name](handle, ...args); @@ -125,6 +124,7 @@ export function getIOSModuleName(moduleName: string): string { if (moduleName.startsWith("RCT")) { return moduleName.substring(3); } + return moduleName; } From 5f24502ca46bbbc5b85160d5ec97c386c9c0453c Mon Sep 17 00:00:00 2001 From: Kilian Finger Date: Fri, 22 Nov 2024 10:18:55 +0100 Subject: [PATCH 2/2] chore: add comment --- javascript/utils/index.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/javascript/utils/index.ts b/javascript/utils/index.ts index 5e5d1b3ff..af3f09856 100644 --- a/javascript/utils/index.ts +++ b/javascript/utils/index.ts @@ -87,6 +87,7 @@ export function runNativeCommand( args, ); + // Android uses callback instead of return return null as ReturnType; }