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

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

undefined is not an object (evaluating 'BarcodeManager.barCodeTypes') #46

Open yanglingnan opened 5 years ago

yanglingnan commented 5 years ago

是编译不成功导致的吗

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" ])

cwh11022 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" ])

I add ” barCodeTypes={['org.iso.QRCode']} // add this prop “,but it also does not work。 It seems like to be short of .podspec file when I use RN0.60.4 with CocoaPods。

I am an iOS developer。My colleague maked it work On Android without CocoaPods。

cwh11022 commented 5 years ago

On RN 0.60.4, When I cd ios directory and use "pod install"。The following prompt appears:

[!] use_native_modules! skipped the react-native dependency 'react-native-smart-barcode'. No podspec file was found.
    - Check to see if there is an updated version that contains the necessary podspec file
    - Contact the library maintainers or send them a PR to add a podspec. The react-native-webview podspec is a good example of a package.json driven
    podspec. See https://github.com/react-native-community/react-native-webview/blob/master/react-native-webview.podspec
    - If necessary, you can disable autolinking for the dependency and link it manually. See
    https://github.com/react-native-community/cli/blob/master/docs/autolinking.md#how-can-i-disable-autolinking-for-unsupported-library

And the following Error on screen when I run the demo

undefined is not an object (evaluating 'BarcodeManager.barCodeTypes')