Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: use UIManager exported from react-native #511

Merged
merged 2 commits into from
Nov 25, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
KiwiKilian marked this conversation as resolved.
Show resolved Hide resolved
}

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