Skip to content
This repository has been archived by the owner on Jun 16, 2023. It is now read-only.

Commit

Permalink
fix: update docs and add check for focus mode support
Browse files Browse the repository at this point in the history
  • Loading branch information
beaur committed Jun 18, 2018
1 parent 39cc29d commit ca5a12b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion docs/RNCamera.md
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ Most cameras have a Auto Focus feature. It adjusts your camera lens position aut

Use the `autoFocus` property to specify the auto focus setting of your camera. `RNCamera.Constants.AutoFocus.on` turns it ON, `RNCamera.Constants.AutoFocus.off` turns it OFF.

#### `autoFocusPointOfInterest`
#### `iOS` `autoFocusPointOfInterest`

Values: Object `{ x: 0.5, y: 0.5 }`.

Expand Down
3 changes: 2 additions & 1 deletion ios/RN/RNCamera.m
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,8 @@ - (void)updateAutoFocusPointOfInterest
if ([self.autoFocusPointOfInterest objectForKey:@"x"] && [self.autoFocusPointOfInterest objectForKey:@"y"]) {
float xValue = [self.autoFocusPointOfInterest[@"x"] floatValue];
float yValue = [self.autoFocusPointOfInterest[@"y"] floatValue];
if ([device isFocusPointOfInterestSupported]) {
if ([device isFocusPointOfInterestSupported] && [device isFocusModeSupported:AVCaptureFocusModeContinuousAutoFocus]) {

CGPoint autofocusPoint = CGPointMake(xValue, yValue);
[device setFocusPointOfInterest:autofocusPoint];
[device setFocusMode:AVCaptureFocusModeContinuousAutoFocus];
Expand Down

0 comments on commit ca5a12b

Please sign in to comment.