From b29f855a44a22274017923cdd98b907921e1e058 Mon Sep 17 00:00:00 2001 From: Roman Kozlov Date: Tue, 6 Mar 2018 13:52:35 +0200 Subject: [PATCH 1/3] android key fix --- .../main/java/com/wix/RNCameraKit/camera/CameraViewManager.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/android/src/main/java/com/wix/RNCameraKit/camera/CameraViewManager.java b/android/src/main/java/com/wix/RNCameraKit/camera/CameraViewManager.java index af064d2..05be099 100644 --- a/android/src/main/java/com/wix/RNCameraKit/camera/CameraViewManager.java +++ b/android/src/main/java/com/wix/RNCameraKit/camera/CameraViewManager.java @@ -279,7 +279,7 @@ public class CameraViewManager extends SimpleViewManager { @Override public void handleResult(Result rawResult) { WritableMap event = Arguments.createMap(); - event.putString("qrcodeStringValue", rawResult.getText()); + event.putString("codeStringValue", rawResult.getText()); reactContext.getJSModule(RCTEventEmitter.class).receiveEvent(cameraViews.peek().getId(), "onReadCode", event); } }); From 6a015e54e5c08fdf675c2aeaa4da524c7dff1399 Mon Sep 17 00:00:00 2001 From: Roman Kozlov Date: Tue, 6 Mar 2018 13:56:21 +0200 Subject: [PATCH 2/3] change key --- README.md | 2 +- example/src/BarcodeScreen.js | 1 - ios/lib/ReactNativeCameraKit/CKCamera.m | 4 ++-- ios/lib/ReactNativeCameraKit/CKCameraManager.m | 2 +- src/CameraScreen/CameraKitCameraScreenBase.js | 2 +- 5 files changed, 5 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 339d2c1..5a8a9b9 100644 --- a/README.md +++ b/README.md @@ -233,7 +233,7 @@ Attribute | Values onReadQRCode={((event) => Alert.alert("Qr code found"))} //optional hideControls={false} //(default false) optional, hide buttons and additional controls on top and bottom of screen - isShowFrameForScanner={true} //(default false) optional, show frame with transparent layer (qr code or barcode will be read on this area ONLY), start animation for scanner,that stoped when find any code. Frame always at center of the screen + showFrame={true} //(default false) optional, show frame with transparent layer (qr code or barcode will be read on this area ONLY), start animation for scanner,that stoped when find any code. Frame always at center of the screen offsetForScannerFrame = {10} //(default 30) optional, offset from left and right side of the screen heightForScannerFrame = {300} //(default 200) optional, change height of the scanner frame colorForScannerFrame = {'red'} //(default white) optional, change colot of the scanner frame diff --git a/example/src/BarcodeScreen.js b/example/src/BarcodeScreen.js index 1ef48e6..92bf19d 100644 --- a/example/src/BarcodeScreen.js +++ b/example/src/BarcodeScreen.js @@ -37,7 +37,6 @@ export default class CameraScreen extends Component { onReadCode={((event) => Alert.alert(`Qr code found ${event.nativeEvent.codeStringValue} `))} hideControls={true} - isShowFrameForScanner={true} // offsetForScannerFrame = {10} // heightForScannerFrame = {300} colorForScannerFrame = {'blue'} diff --git a/ios/lib/ReactNativeCameraKit/CKCamera.m b/ios/lib/ReactNativeCameraKit/CKCamera.m index d589c9d..26b6942 100644 --- a/ios/lib/ReactNativeCameraKit/CKCamera.m +++ b/ios/lib/ReactNativeCameraKit/CKCamera.m @@ -95,7 +95,7 @@ RCT_ENUM_CONVERTER(CKCameraZoomMode, (@{ // frame for Scanner @property (nonatomic, strong) NSDictionary *scannerOptions; -@property (nonatomic) BOOL isShowFrameForScanner; +@property (nonatomic) BOOL showFrame; @property (nonatomic) UIView *greenScanner; @property (nonatomic) CGFloat frameOffset; @@ -363,7 +363,7 @@ RCT_ENUM_CONVERTER(CKCameraZoomMode, (@{ [self addObservers]; [self.session startRunning]; self.sessionRunning = self.session.isRunning; - if (self.isShowFrameForScanner) { + if (self.showFrame) { dispatch_async(dispatch_get_main_queue(), ^{ [self addFrameForScanner]; }); diff --git a/ios/lib/ReactNativeCameraKit/CKCameraManager.m b/ios/lib/ReactNativeCameraKit/CKCameraManager.m index 5d68a89..858a27e 100644 --- a/ios/lib/ReactNativeCameraKit/CKCameraManager.m +++ b/ios/lib/ReactNativeCameraKit/CKCameraManager.m @@ -29,7 +29,7 @@ RCT_EXPORT_VIEW_PROPERTY(cameraOptions, NSDictionary) RCT_EXPORT_VIEW_PROPERTY(onReadCode, RCTDirectEventBlock) RCT_EXPORT_VIEW_PROPERTY(scannerOptions, NSDictionary) -RCT_EXPORT_VIEW_PROPERTY(isShowFrameForScanner, BOOL) +RCT_EXPORT_VIEW_PROPERTY(showFrame, BOOL) diff --git a/src/CameraScreen/CameraKitCameraScreenBase.js b/src/CameraScreen/CameraKitCameraScreenBase.js index f6ec1de..65b6c67 100644 --- a/src/CameraScreen/CameraKitCameraScreenBase.js +++ b/src/CameraScreen/CameraKitCameraScreenBase.js @@ -164,7 +164,7 @@ export default class CameraScreenBase extends Component { onReadCode = {this.props.onReadCode} scannerOptions = {this.state.scannerOptions} - isShowFrameForScanner = {this.props.isShowFrameForScanner} + showFrame = {this.props.showFrame} /> } From 7d41a445f7c35ecb089e151cde32f3d2e0e1ce98 Mon Sep 17 00:00:00 2001 From: Roman Kozlov Date: Tue, 6 Mar 2018 13:58:15 +0200 Subject: [PATCH 3/3] fix refactor --- src/CameraScreen/CameraKitCameraScreenBase.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/CameraScreen/CameraKitCameraScreenBase.js b/src/CameraScreen/CameraKitCameraScreenBase.js index 65b6c67..4dbb72c 100644 --- a/src/CameraScreen/CameraKitCameraScreenBase.js +++ b/src/CameraScreen/CameraKitCameraScreenBase.js @@ -164,7 +164,6 @@ export default class CameraScreenBase extends Component { onReadCode = {this.props.onReadCode} scannerOptions = {this.state.scannerOptions} - showFrame = {this.props.showFrame} /> }