Merge pull request #138 from wix/barcode_key

Barcode key
This commit is contained in:
Ran Greenberg 2018-03-06 14:55:36 +02:00 committed by GitHub
commit 43e11e61fe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 5 additions and 7 deletions

View File

@ -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

View File

@ -279,7 +279,7 @@ public class CameraViewManager extends SimpleViewManager<CameraView> {
@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);
}
});

View File

@ -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'}

View File

@ -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];
});

View File

@ -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)

View File

@ -164,7 +164,6 @@ export default class CameraScreenBase extends Component {
onReadCode = {this.props.onReadCode}
scannerOptions = {this.state.scannerOptions}
isShowFrameForScanner = {this.props.isShowFrameForScanner}
/>
}
</View>