Skip to content

patch imagepickerios video widths #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 11, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions Libraries/CameraRoll/RCTImagePickerManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
#import <React/RCTRootView.h>
#import <React/RCTUtils.h>

@import Photos;

@interface RCTImagePickerController : UIImagePickerController

@property (nonatomic, assign) BOOL unmirrorFrontFacingCamera;
Expand Down Expand Up @@ -143,7 +145,15 @@ - (void)imagePickerController:(UIImagePickerController *)picker
if (image) {
height = @(image.size.height);
width = @(image.size.width);
} else if (isMovie) {
PHFetchResult<PHAsset *> *assets = [PHAsset fetchAssetsWithALAssetURLs:@[[info valueForKey:UIImagePickerControllerReferenceURL]] options:nil];
if (assets.count > 0) {
PHAsset *videoAsset = assets.firstObject;
height = @(videoAsset.pixelHeight);
width = @(videoAsset.pixelWidth);
}
}

if (imageURL) {
[self _dismissPicker:picker args:@[imageURL.absoluteString, RCTNullIfNil(height), RCTNullIfNil(width)]];
return;
Expand Down