mirror of
https://github.com/status-im/react-native-mapbox-gl.git
synced 2026-09-02 05:51:12 +00:00
Added complete callback for flyTo
This commit is contained in:
@@ -11,35 +11,19 @@ export function isFunction (fn) {
|
||||
}
|
||||
|
||||
export function runNativeCommand (module, name, nativeRef, args = []) {
|
||||
// android native command
|
||||
const managerInstance = NativeModules.UIManager[module];
|
||||
if (!managerInstance) {
|
||||
throw new Error(`Could not find ${module}`);
|
||||
}
|
||||
|
||||
// get react tag so we can find, this component on the otherside
|
||||
const handle = findNodeHandle(nativeRef);
|
||||
if (!handle) {
|
||||
throw new Error(`Could not find handle for native ref ${module}.${name}`);
|
||||
}
|
||||
|
||||
NativeModules.UIManager.dispatchViewManagerCommand(
|
||||
handle,
|
||||
managerInstance.Commands[name],
|
||||
args,
|
||||
);
|
||||
return;
|
||||
// android native command
|
||||
if (IS_ANDROID) {
|
||||
return;
|
||||
}
|
||||
|
||||
// ios native command
|
||||
const method = managerInstance[name];
|
||||
if (!method) {
|
||||
throw new Error(`Could not find method ${name} on module ${module}`);
|
||||
}
|
||||
|
||||
method(handle, ...args);
|
||||
}
|
||||
|
||||
function getManagerInstance (module) {
|
||||
const obj = IS_ANDROID ? NativeModules.UIManager : NativeModules;
|
||||
return obj[module];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user