Added complete callback for flyTo

This commit is contained in:
Nick
2017-09-26 20:12:07 -07:00
parent 8efab247e8
commit 32cdc559b6
7 changed files with 46 additions and 25 deletions
+4 -20
View File
@@ -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];
}