INNER CODE UNIT · TypeScript
runNativeCommand
maplibre/maplibre-react-native · package/src/utils/index.ts:49
export function runNativeCommand<ReturnType = NativeArg>(
module: string,
name: string,
nativeRef: Component,
args: NativeArg[] = [],
): ReturnType {
const handle = findNodeHandle(nativeRef);
if (!handle) {
throw new Error(`Could not find handle for native ref ${module}.${name}`);
}
const managerInstance = isAndroid()
? UIManager.getViewManagerConfig(module)
: NativeModules[module];
if (!managerInstance) {
throw new Error(`Could not find ${module}`);
}