Skip to content

Commit b41cd7d

Browse files
committed
chore(ios): working frontMirrored
1 parent 41b2687 commit b41cd7d

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

packages/ui-cameraview/platforms/ios/src/NSCameraView.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ public class NSCameraView: UIView, NextLevelVideoDelegate, NextLevelPhotoDelegat
207207
}
208208
public func toggleCamera() {
209209
self.nextLevel?.flipCaptureDevicePosition()
210-
if let previewLayer = nextLevel.previewLayer {
210+
if let previewLayer = self.nextLevel?.previewLayer {
211211
if self._frontMirrored {
212212
previewLayer.connection?.automaticallyAdjustsVideoMirroring = true
213213
} else {
@@ -276,11 +276,11 @@ public class NSCameraView: UIView, NextLevelVideoDelegate, NextLevelPhotoDelegat
276276
private var _frontMirrored: Bool = true
277277
public var frontMirrored: Bool {
278278
get {
279-
return self.frontMirrored
279+
return self._frontMirrored
280280
}
281281
set {
282282
self._frontMirrored = newValue
283-
if let previewLayer = nextLevel.previewLayer {
283+
if let previewLayer = self.nextLevel?.previewLayer {
284284
if self._frontMirrored {
285285
previewLayer.connection?.automaticallyAdjustsVideoMirroring = true
286286
} else {

src/ui-cameraview/index.ios.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { TakePictureOptions } from '.';
2-
import { CameraViewBase, ScaleType, autoFocusProperty, captureModeProperty, flashModeProperty, stretchProperty, zoomProperty } from './index.common';
2+
import { CameraViewBase, ScaleType, autoFocusProperty, captureModeProperty, flashModeProperty, frontMirroredProperty, stretchProperty, zoomProperty } from './index.common';
33
import { File, Property, Utils } from '@nativescript/core';
44

55
function getScaleType(scaleType: ScaleType) {
@@ -354,6 +354,10 @@ export class CameraView extends CameraViewBase {
354354
this.nativeViewProtected.videoZoomFactor = value;
355355
}
356356

357+
[frontMirroredProperty.setNative](value) {
358+
this.nativeViewProtected.frontMirrored = value;
359+
}
360+
357361
getAllAvailablePictureSizes() {
358362
// TODO: implement
359363
}

src/ui-cameraview/typings/ios.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ declare class NSCameraView extends UIView {
6262

6363
zoomEnabled: boolean;
6464

65+
frontMirrored: boolean;
66+
6567
capturePhoto(options: string): void;
6668

6769
capturePhotoFromVideo(): void;

0 commit comments

Comments
 (0)