From aa82b182b5c08668558acacb9ab705b1e77c9460 Mon Sep 17 00:00:00 2001 From: Kilian Finger Date: Fri, 22 Nov 2024 08:39:26 +0100 Subject: [PATCH] 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; }