[ios][storage] fixes #15, fixed an issue where some storage errors are unserializable by RN - workaround is just to send nil instead of the NSError

This commit is contained in:
Salakar 2017-03-23 00:37:38 +00:00
parent f1655c1ea6
commit 67a2b41a61
1 changed files with 7 additions and 2 deletions

View File

@ -80,7 +80,12 @@ RCT_EXPORT_MODULE(RNFirebaseStorage);
break;
}
reject(code, message, error);
if (userInfo != nil && [userInfo objectForKey:@"data"]) {
// errors with 'data' are unserializable - it breaks react so we send nil instead
reject(code, message, nil);
} else {
reject(code, message, error);
}
}
@ -367,7 +372,7 @@ RCT_EXPORT_METHOD(putFile:(NSString *) path localPath:(NSString *)localPath meta
return @{
@"bytesTransferred": @(task.progress.completedUnitCount),
@"ref": task.reference.fullPath,
@"status": [self getTaskStatus:task.status],
@"state": [self getTaskStatus:task.status],
@"totalBytes": @(task.progress.totalUnitCount)
};
}