INNER CODE UNIT · JavaScript
runNativeCommand
nitaliano/react-native-mapbox-gl · javascript/utils/index.js:53
export function runNativeCommand(module, name, nativeRef, args = []) {
const handle = findNodeHandle(nativeRef);
if (!handle) {
throw new Error(`Could not find handle for native ref ${module}.${name}`);
}
const managerInstance = isAndroid()
? getAndroidManagerInstance(module)
: getIosManagerInstance(module);
if (!managerInstance) {
throw new Error(`Could not find ${module}`);
}
if (isAndroid()) {
return NativeModules.UIManager.dispatchViewManagerCommand(
handle,
managerInstance.Commands[name],