【问题标题】:'react-native-barcodescanner' reading only QRCodes'react-native-barcodescanner' 只读二维码
【发布时间】:2016-07-20 11:14:23
【问题描述】:

我正在使用模块“react-native-barcodescanner”来读取条形码,但安卓手机只能扫描二维码。如何在 ract-native 应用程序中读取各种条形码。

【问题讨论】:

    标签: android npm react-native


    【解决方案1】:

    你必须在构建语句中一一设置Bacode Format,

    以下是支持的格式

        BarcodeFormat.UPC_A
        BarcodeFormat.UPC_E
        BarcodeFormat.EAN_13
        BarcodeFormat.EAN_8
        BarcodeFormat.RSS_14
        BarcodeFormat.CODE_39
        BarcodeFormat.CODE_93
        BarcodeFormat.CODE_128
        BarcodeFormat.ITF
        BarcodeFormat.CODABAR
        BarcodeFormat.QR_CODE
        BarcodeFormat.DATA_MATRIX
        BarcodeFormat.PDF_417
    

    像下面的例子

        mReactInstanceManager = ReactInstanceManager.builder()
      .setApplication(getApplication())
      .setBundleAssetName("index.android.bundle")
      .setJSMainModuleName("index.android")
      .setFormats(BarcodeFormat.UPC_A)
      .setFormats(BarcodeFormat.EAN_13)
      .setFormats(BarcodeFormat.CODE_93)
      .setFormats(BarcodeFormat.CODE_128) 
      .addPackage(new MainReactPackage())
      .addPackage(new RNCameraViewPackage())              // <------ add here
      .setUseDeveloperSupport(BuildConfig.DEBUG)
      .setInitialLifecycleState(LifecycleState.RESUMED)
      .build();
    

    【讨论】:

    • 您能指导更多吗?哪个文件?
    • 在扫描活动中使用的库的主要Java类
    【解决方案2】:

    图书馆工作正常,我们只需要在横向模式下扫描条形码。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多