diff --git a/Barcode.js b/Barcode.js index 0fdb6ac..daad9bd 100644 --- a/Barcode.js +++ b/Barcode.js @@ -7,9 +7,9 @@ import React, { - PropTypes, Component, } from 'react' + import { View, requireNativeComponent, @@ -18,6 +18,8 @@ import { Platform, } from 'react-native' +import PropTypes from 'prop-types' + const BarcodeManager = Platform.OS == 'ios' ? NativeModules.Barcode : NativeModules.CaptureModule diff --git a/ios/RCTBarcode/RCTBarcode/RCTBarcode.h b/ios/RCTBarcode/RCTBarcode/RCTBarcode.h index 5afd1af..9338f31 100644 --- a/ios/RCTBarcode/RCTBarcode/RCTBarcode.h +++ b/ios/RCTBarcode/RCTBarcode/RCTBarcode.h @@ -10,7 +10,7 @@ @property (nonatomic,strong)NSTimer *scanLineTimer; @property (nonatomic,strong)LineView *scanLine; @property (nonatomic,assign)CGRect scannerRect; -@property (nonatomic, copy) RCTBubblingEventBlock onBarCodeRead; +@property (nonatomic, copy) RCTDirectEventBlock onBarCodeRead; @property (nonatomic, assign) NSInteger scannerRectWidth; @property (nonatomic, assign) NSInteger scannerRectHeight; @property (nonatomic, assign) NSInteger scannerRectTop; diff --git a/ios/RCTBarcode/RCTBarcode/RCTBarcodeManager.m b/ios/RCTBarcode/RCTBarcode/RCTBarcodeManager.m index e871da8..5c06c95 100644 --- a/ios/RCTBarcode/RCTBarcode/RCTBarcodeManager.m +++ b/ios/RCTBarcode/RCTBarcode/RCTBarcodeManager.m @@ -24,7 +24,7 @@ @implementation RCTBarcodeManager RCT_EXPORT_VIEW_PROPERTY(scannerRectCornerColor, NSString) -RCT_EXPORT_VIEW_PROPERTY(onBarCodeRead, RCTBubblingEventBlock) +RCT_EXPORT_VIEW_PROPERTY(onBarCodeRead, RCTDirectEventBlock) RCT_CUSTOM_VIEW_PROPERTY(barCodeTypes, NSArray, RCTBarcode) { // NSLog(@"custom barCodeTypes -> %@", self.barCodeTypes); diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..2e091af --- /dev/null +++ b/package-lock.json @@ -0,0 +1,35 @@ +{ + "name": "react-native-smart-barcode", + "version": "1.0.6", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==" + }, + "loose-envify": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", + "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==", + "requires": { + "js-tokens": "^3.0.0 || ^4.0.0" + } + }, + "object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=" + }, + "prop-types": { + "version": "15.6.2", + "resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.6.2.tgz", + "integrity": "sha512-3pboPvLiWD7dkI3qf3KbUe6hKFKa52w+AE0VCqECtf+QHAKgOL37tTaNCnuX1nAAQ4ZhyP+kYVKf8rLmJ/feDQ==", + "requires": { + "loose-envify": "^1.3.1", + "object-assign": "^4.1.1" + } + } + } +} diff --git a/package.json b/package.json index 23fd36e..2675862 100644 --- a/package.json +++ b/package.json @@ -24,5 +24,8 @@ "homepage": "https://github.com/react-native-component/react-native-smart-barcode#readme", "peerDependencies": { "react-native": ">=0.40.0" + }, + "dependencies": { + "prop-types": "^15.6.2" } }