ImagePicker always called with cancelCallback
Summary: We should pick 2 callbacks from pickerCallbacks and pickerCancelCallbacks arrays and call them depens on args. Closes https://github.com/facebook/react-native/pull/4411 Reviewed By: svcscm Differential Revision: D2703209 Pulled By: javache fb-gh-sync-id: 7d2d7c63b933a66a1ff600663c3a7fcc821c750b
This commit is contained in:
Родитель
32fa0b7fa1
Коммит
015c6b3be2
|
@ -132,7 +132,8 @@ didFinishPickingMediaWithInfo:(NSDictionary<NSString *, id> *)info
|
||||||
- (void)_dismissPicker:(UIImagePickerController *)picker args:(NSArray *)args
|
- (void)_dismissPicker:(UIImagePickerController *)picker args:(NSArray *)args
|
||||||
{
|
{
|
||||||
NSUInteger index = [_pickers indexOfObject:picker];
|
NSUInteger index = [_pickers indexOfObject:picker];
|
||||||
RCTResponseSenderBlock callback = _pickerCancelCallbacks[index];
|
RCTResponseSenderBlock successCallback = _pickerCallbacks[index];
|
||||||
|
RCTResponseSenderBlock cancelCallback = _pickerCancelCallbacks[index];
|
||||||
|
|
||||||
[_pickers removeObjectAtIndex:index];
|
[_pickers removeObjectAtIndex:index];
|
||||||
[_pickerCallbacks removeObjectAtIndex:index];
|
[_pickerCallbacks removeObjectAtIndex:index];
|
||||||
|
@ -141,7 +142,11 @@ didFinishPickingMediaWithInfo:(NSDictionary<NSString *, id> *)info
|
||||||
UIViewController *rootViewController = RCTKeyWindow().rootViewController;
|
UIViewController *rootViewController = RCTKeyWindow().rootViewController;
|
||||||
[rootViewController dismissViewControllerAnimated:YES completion:nil];
|
[rootViewController dismissViewControllerAnimated:YES completion:nil];
|
||||||
|
|
||||||
callback(args ?: @[]);
|
if (args) {
|
||||||
|
successCallback(args);
|
||||||
|
} else {
|
||||||
|
cancelCallback(@[]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
Загрузка…
Ссылка в новой задаче