Skip to content

Commit

Permalink
fix: use UIManager exported from react-native
Browse files Browse the repository at this point in the history
Fixes #488
  • Loading branch information
KiwiKilian committed Nov 22, 2024
1 parent cab6e95 commit aa82b18
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions javascript/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -84,11 +81,13 @@ export function runNativeCommand<ReturnType = NativeArg>(
}

if (isAndroid()) {
return NativeModules.UIManager.dispatchViewManagerCommand(
UIManager.dispatchViewManagerCommand(
handle,
managerInstance.Commands[name],
args,
);

return null as ReturnType;
}

return managerInstance[name](handle, ...args);
Expand Down Expand Up @@ -125,6 +124,7 @@ export function getIOSModuleName(moduleName: string): string {
if (moduleName.startsWith("RCT")) {
return moduleName.substring(3);
}

return moduleName;
}

Expand Down

0 comments on commit aa82b18

Please sign in to comment.