Skip to content

Commit 4c400a1

Browse files
jcarver989facebook-github-bot
authored andcommitted
Make ImagePickerIOS.openCameraDialog work with video (fixes #17989) (#19170)
Summary: Fixes #17989 Previously, `ImagePickerIOS.openCameraDialog` would not render a `Video` option when the camera screen opened. If you passed `ImagePickerIOS.openCameraDialog({ videoMode: true }, ...)` the app would crash with an error complaining about the proper mediaType(s) not being set (see issue: #17989 for full details). This is a 2 line change that sets the mediaTypes properly, so now users can capture videos in addition to photos. Pull Request resolved: #19170 Differential Revision: D14068078 Pulled By: hramos fbshipit-source-id: d04a3d267ca83ea58e88c880a85ac34ddd4744c8
1 parent 937c79e commit 4c400a1

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

Libraries/CameraRoll/RCTImagePickerManager.m

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,8 @@ - (dispatch_queue_t)methodQueue
8585
RCTImagePickerController *imagePicker = [RCTImagePickerController new];
8686
imagePicker.delegate = self;
8787
imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera;
88+
NSArray<NSString *> *availableMediaTypes = [UIImagePickerController availableMediaTypesForSourceType:UIImagePickerControllerSourceTypeCamera];
89+
imagePicker.mediaTypes = availableMediaTypes;
8890
imagePicker.unmirrorFrontFacingCamera = [RCTConvert BOOL:config[@"unmirrorFrontFacingCamera"]];
8991

9092
if ([RCTConvert BOOL:config[@"videoMode"]]) {

0 commit comments

Comments
 (0)