Skip to content

Commit

Permalink
Restricted the media type to image only in the takePicture method. Fi…
Browse files Browse the repository at this point in the history
…x issue #18
  • Loading branch information
Dimitar Tachev authored and Dimitar Tachev committed Oct 30, 2017
1 parent e2b2db4 commit 5ee8c9f
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/camera.ios.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,11 @@ export let takePicture = function (options): Promise<any> {

let sourceType = UIImagePickerControllerSourceType.Camera;
let mediaTypes = UIImagePickerController.availableMediaTypesForSourceType(sourceType);

if (mediaTypes) {
imagePickerController.mediaTypes = mediaTypes;
let imageMediaType = "public.image";
if (mediaTypes && mediaTypes.containsObject(imageMediaType)) {
let mediaTypesArray = new NSMutableArray<string>({ capacity: 1 });
mediaTypesArray.addObject(imageMediaType);
imagePickerController.mediaTypes = mediaTypesArray;
imagePickerController.sourceType = sourceType;
imagePickerController.cameraDevice = options && options.cameraFacing === "front" ?
UIImagePickerControllerCameraDevice.Front : UIImagePickerControllerCameraDevice.Rear;
Expand Down

0 comments on commit 5ee8c9f

Please sign in to comment.