mirror of
https://github.com/status-im/react-native-camera.git
synced 2025-02-24 09:48:17 +00:00
setZoom method added
This commit is contained in:
parent
c8ca1b0304
commit
3622e22286
@ -90,6 +90,7 @@ typedef NS_ENUM(NSInteger, RCTCameraTorchMode) {
|
||||
- (void)stopSession;
|
||||
- (void)focusAtThePoint:(CGPoint) atPoint;
|
||||
- (void)zoom:(CGFloat)velocity reactTag:(NSNumber *)reactTag;
|
||||
- (void)setZoom;
|
||||
|
||||
|
||||
@end
|
||||
|
@ -453,6 +453,20 @@ RCT_EXPORT_METHOD(hasFlash:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRej
|
||||
resolve(@(device.hasFlash));
|
||||
}
|
||||
|
||||
RCT_EXPORT_METHOD(setZoom:(CGFloat)zoomFactor) {
|
||||
if (isnan(zoomFactor)) {
|
||||
return;
|
||||
}
|
||||
NSError *error = nil;
|
||||
AVCaptureDevice *device = [[self videoCaptureDeviceInput] device];
|
||||
if ([device lockForConfiguration:&error]) {
|
||||
device.videoZoomFactor = zoomFactor;
|
||||
[device unlockForConfiguration];
|
||||
} else {
|
||||
NSLog(@"error: %@", error);
|
||||
}
|
||||
}
|
||||
|
||||
- (void)startSession {
|
||||
#if TARGET_IPHONE_SIMULATOR
|
||||
return;
|
||||
|
@ -332,6 +332,10 @@ export default class Camera extends Component {
|
||||
}
|
||||
return CameraManager.hasFlash();
|
||||
}
|
||||
|
||||
setZoom(zoomFactor) {
|
||||
return CameraManager.setZoom(zoomFactor);
|
||||
}
|
||||
}
|
||||
|
||||
export const constants = Camera.constants;
|
||||
|
Loading…
x
Reference in New Issue
Block a user