ideacreation / react-native-barcodescanner

A barcode scanner component for react native - not maintained anymore - use react-native-camera
MIT License
537 stars 162 forks source link

Error on require on react-native 0.16.0-rc #3

Closed eddiefletchernz closed 8 years ago

eddiefletchernz commented 8 years ago

I've just upgraded react-native to 0.16.0-rc and now the barcode scanner is throwing an error on require:

'BarcodeScannerView' has no propType for native prop 'RNBarcodeScannerView.renderToHardwareTextureAndroid' of native type 'boolean'.

aeperea commented 8 years ago

+1

northfoxz commented 8 years ago

fixed it by replacing the last part of BarcodeScanner.js to

BarcodeScannerView.propTypes = {
  viewFinderBackgroundColor: PropTypes.string,
  viewFinderBorderColor: PropTypes.string,
  viewFinderBorderWidth: PropTypes.number,
  viewFinderBorderLength: PropTypes.number,
  viewFinderDrawLaser: PropTypes.bool,
  viewFinderLaserColor: PropTypes.string,
  torchMode: PropTypes.string,
  cameraType: PropTypes.string,
  onBarCodeRead: PropTypes.func,
  rotation: PropTypes.number,
  scaleX: PropTypes.number,
  scaleY: PropTypes.number,
  translateX: PropTypes.number,
  translateY: PropTypes.number,
  importantForAccessibility: PropTypes.string,
  accessibilityLabel: PropTypes.string,
  testID: PropTypes.string,
  renderToHardwareTextureAndroid: PropTypes.string,
  onLayout: PropTypes.bool
};

var RNBarcodeScannerView = requireNativeComponent('RNBarcodeScannerView', BarcodeScannerView, {
  nativeOnly: {
    onChange: true,
    accessibilityLiveRegion: 'none',
    accessibilityComponentType: 'button'
  }
});
eddiefletchernz commented 8 years ago

@NorthFoxz Thank you so much! Also I can confirm that this bug is still present with the latest 0.16.0

bastengao commented 8 years ago

Same error on react-native 0.17.0

bastengao commented 8 years ago

@NorthFoxz Your code works, thanks. :+1:

DaleLJefferson commented 8 years ago

I can confirm that @NorthFoxz solution fixes the issue on React Native 0.17 it would be great to get this fixed in master.

andreaskeller commented 8 years ago

With @cpunions's merged pull request the issue should now be fixed.