react-native-component / react-native-smart-barcode

A smart barcode scanner component for React Native app.
MIT License
308 stars 168 forks source link

BarcodeManager.barCodeTypes undefind #9

Open pbwei opened 7 years ago

ShaileshPrajapati-BTC commented 7 years ago

Same error in android

urieluvd commented 7 years ago

Same here

urieluvd commented 7 years ago

Solved mine by 'react-native upgrade' this make the necesary imports in MainApplication.java and MainActivity.java, these files will be overwritten, so you will need to 'react-native link' again, and reconfigure the gradle files for this one and any other plugins installed.
This error will be solved, however a few bugs with the android implementation will show up but I have made another issue to show how to solve them. check this #13

joaoalbertocsjunior commented 6 years ago

Im having the same issue. react-native upgrade doesnt help.

nkhoanguyen2703 commented 6 years ago

Same in iOS , how to solve this problem :( ! undefined is not an object ( evaluating BarcodeManager.barCodeTypes )

kosiakMD commented 6 years ago

+1 iOS RN 0.47.1 RN CLI 2.0.1 react-native-smart-barcode 1.0.6

2b-dev commented 6 years ago

I use React Native 0.55.4 React 16.3.1 I fix by Remove folder android : rm -rf android then I generate folder android : react-native upgrade then : react-native link add Permission to AndroidManifest.xml uses-permission android:name="android.permission.CAMERA" uses-permission android:name="android.permission.VIBRATE" uses-feature android:name="android.hardware.camera" uses-feature android:name="android.hardware.camera.autofocus" and At file RCTCapturePackage.java I comment at @Override ( node_module/react-native-smart-barcode/android/src/main/java/com/reactnativecomponent/barcode/RCTCapturePackage.java ) //@Override public List<Class<? extends JavaScriptModule>> createJSModules() { return Collections.emptyList(); } It work for me I not config file MainApplication.java and MainActivity.java like At readme https://github.com/react-native-component/react-native-smart-barcode /// sorry I'm not good in English

Update : For React Native 0.43 + at node_module/react-native-smart-barcode/Barcode.js Use : import React, { Component } from 'react'; import PropTypes from 'prop-types';

12343954 commented 5 years ago
<Barcode style={{ flex: 1, alignSelf: 'stretch', }}
    ref={component => this._barCode = component}
    barCodeTypes={['org.iso.QRCode']}  // add this prop
    onBarCodeRead={(event) => this._onBarCodeRead(event)} />

barCodeTypes=oneOf([ 0: "org.gs1.EAN-8" 1: "org.gs1.EAN-13" 2: "org.iso.Aztec" 3: "org.iso.QRCode" 4: "org.iso.PDF417" 5: "org.iso.Code128" 6: "org.iso.Code39" 7: "com.intermec.Code93" 8: "org.gs1.UPC-E" 9: "org.iso.Code39Mod43" ])