Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

fw-rn-baidu-ocr

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fw-rn-baidu-ocr

百度Ocr的RN集成

  • 0.2.1
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
16
increased by700%
Maintainers
1
Weekly downloads
 
Created
Source

React Native的百度OCR插件

注意事项:
1.x
2.// file: android/settings.gradle 
android{

    defaultConfig{
        ...
        manifestPlaceholders = [
                // 请选择您的初始化方式 为true的情况不适用ak和sk 请检查assets内是否有license文件
                INIT_WITH_LICENSE: false,
                BAIDU_OCR_AK: "你看的ak",
                BAIDU_OCR_SK: "你的sk"
        ]
    }
    
}

如何安装

1.首先安装npm包

npm install fw-rn-baidu-ocr --save
react-native link fw-rn-baidu-ocr
ios
待补充
Android
// file: android/settings.gradle
...

include ':fw-rn-baidu-ocr'
project(':fw-rn-baidu-ocr').projectDir = new File(rootProject.projectDir, '../node_modules/fw-rn-baidu-ocr/android')
// file: android/app/build.gradle
...

dependencies {
    ...
    implementation project(':fw-rn-baidu-ocr')
}

android/app/src/main/java/<你的包名>/MainApplication.java

...
import cn.fw.ocr.OcrPackage;

public class MainApplication extends Application implements ReactApplication {

  private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
    @Override
    protected boolean getUseDeveloperSupport() {
      return BuildConfig.DEBUG;
    }

    @Override
    protected List<ReactPackage> getPackages() {
      return Arrays.<ReactPackage>asList(
          new OcrPackage(), // 然后添加这一行
          new MainReactPackage()
      );
    }
  };

  @Override
  public ReactNativeHost getReactNativeHost() {
      return mReactNativeHost;
  }
   @Override
  public void onCreate() {
   super.onCreate();
    SoLoader.init(this, /* native exopackage */ false);
   ...
  }
}

3.工程配置

iOS配置
待补充
Android配置

android/app/build.gradle里,defaultConfig栏目下添加如下代码:

 manifestPlaceholders = [
                 // 请选择您的初始化方式 为true的情况不适用ak和sk 请检查assets内是否有license文件
                INIT_WITH_LICENSE: false,
                BAIDU_OCR_AK: "你看的ak",
                BAIDU_OCR_SK: "你的sk"
        ]

AndroidManifest.xml里,添加如下代码:

< manifest

    ......

        <meta-data
            android:name="BAIDU_OCR_AK"
            android:value="${BAIDU_OCR_AK}" />
        <meta-data
            android:name="BAIDU_OCR_SK"
            android:value="${BAIDU_OCR_SK}" />
        <meta-data
            android:name="INIT_WITH_LICENSE"
            android:value="${INIT_WITH_LICENSE}" />

如何使用

引入包

import { XXX } from 'fw-rn-baidu-ocr'; //你需要的模块
直接调用

Keywords

FAQs

Package last updated on 31 Mar 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc