From 25b10b7106ac5da278cd4a2e12b594705700fe66 Mon Sep 17 00:00:00 2001 From: Marc Rousavy Date: Wed, 31 Mar 2021 14:39:17 +0200 Subject: [PATCH] Remove scannable codes stuff --- .../src/main/java/com/mrousavy/camera/CameraView.kt | 1 - .../java/com/mrousavy/camera/CameraViewManager.kt | 8 -------- ios/CameraView.swift | 2 -- ios/CameraViewManager.m | 2 -- src/Camera.tsx | 12 ++++++++++-- 5 files changed, 10 insertions(+), 15 deletions(-) diff --git a/android/src/main/java/com/mrousavy/camera/CameraView.kt b/android/src/main/java/com/mrousavy/camera/CameraView.kt index 17ffb34..aa9cf1a 100644 --- a/android/src/main/java/com/mrousavy/camera/CameraView.kt +++ b/android/src/main/java/com/mrousavy/camera/CameraView.kt @@ -68,7 +68,6 @@ class CameraView(context: Context) : FrameLayout(context), LifecycleOwner { var enableDepthData = false var enableHighResolutionCapture: Boolean? = null var enablePortraitEffectsMatteDelivery = false - var scannableCodes: ReadableArray? = null // props that require format reconfiguring var format: ReadableMap? = null var fps: Int? = null diff --git a/android/src/main/java/com/mrousavy/camera/CameraViewManager.kt b/android/src/main/java/com/mrousavy/camera/CameraViewManager.kt index e84ac01..1be554b 100644 --- a/android/src/main/java/com/mrousavy/camera/CameraViewManager.kt +++ b/android/src/main/java/com/mrousavy/camera/CameraViewManager.kt @@ -44,13 +44,6 @@ class CameraViewManager : SimpleViewManager() { view.enablePortraitEffectsMatteDelivery = enablePortraitEffectsMatteDelivery } - @ReactProp(name = "scannableCodes") - fun setScannableCodes(view: CameraView, scannableCodes: ReadableArray?) { - if (view.scannableCodes != scannableCodes) - addChangedPropToTransaction(view, "scannableCodes") - view.scannableCodes = scannableCodes - } - @ReactProp(name = "format") fun setFormat(view: CameraView, format: ReadableMap?) { if (view.format != format) @@ -131,7 +124,6 @@ class CameraViewManager : SimpleViewManager() { return MapBuilder.builder() .put("cameraInitialized", MapBuilder.of("registrationName", "onInitialized")) .put("cameraError", MapBuilder.of("registrationName", "onError")) - .put("cameraCodeScanned", MapBuilder.of("registrationName", "onCodeScanned")) .build() } diff --git a/ios/CameraView.swift b/ios/CameraView.swift index d93c8cf..bfd8da1 100644 --- a/ios/CameraView.swift +++ b/ios/CameraView.swift @@ -93,7 +93,6 @@ final class CameraView: UIView { @objc var enableHighResolutionCapture: NSNumber? // nullable bool @objc var enablePortraitEffectsMatteDelivery = false @objc var preset: String? - @objc var scannableCodes: [String]? // props that require format reconfiguring @objc var format: NSDictionary? @objc var fps: NSNumber? @@ -107,7 +106,6 @@ final class CameraView: UIView { // events @objc var onInitialized: RCTDirectEventBlock? @objc var onError: RCTDirectEventBlock? - @objc var onCodeScanned: RCTBubblingEventBlock? // pragma MARK: Private Properties internal var isReady = false diff --git a/ios/CameraViewManager.m b/ios/CameraViewManager.m index f67f9cd..7d36585 100644 --- a/ios/CameraViewManager.m +++ b/ios/CameraViewManager.m @@ -33,14 +33,12 @@ RCT_EXPORT_VIEW_PROPERTY(lowLightBoost, NSNumber); // nullable bool RCT_EXPORT_VIEW_PROPERTY(colorSpace, NSString); // other props RCT_EXPORT_VIEW_PROPERTY(preset, NSString); -RCT_EXPORT_VIEW_PROPERTY(scannableCodes, NSArray); RCT_EXPORT_VIEW_PROPERTY(torch, NSString); RCT_EXPORT_VIEW_PROPERTY(zoom, NSNumber); RCT_EXPORT_VIEW_PROPERTY(enableZoomGesture, BOOL); // Camera View Properties RCT_EXPORT_VIEW_PROPERTY(onError, RCTDirectEventBlock); RCT_EXPORT_VIEW_PROPERTY(onInitialized, RCTDirectEventBlock); -RCT_EXPORT_VIEW_PROPERTY(onCodeScanned, RCTBubblingEventBlock); // Camera View Functions RCT_EXTERN_METHOD(startRecording:(nonnull NSNumber *)node options:(NSDictionary *)options onRecordCallback:(RCTResponseSenderBlock)onRecordCallback); diff --git a/src/Camera.tsx b/src/Camera.tsx index 2fcc810..187cc6c 100644 --- a/src/Camera.tsx +++ b/src/Camera.tsx @@ -19,7 +19,7 @@ interface OnErrorEvent { message: string; cause?: ErrorWithCause; } -type NativeCameraViewProps = Omit & { +type NativeCameraViewProps = Omit & { cameraId: string; onInitialized?: (event: NativeSyntheticEvent) => void; onError?: (event: NativeSyntheticEvent) => void; @@ -389,7 +389,15 @@ export class Camera extends React.PureComponent { // We remove the big `device` object from the props because we only need to pass `cameraId` to native. const { device: _, ...props } = this.props; - return ; + return ( + + ); } } //#endregion