ReactNative common component library react-native-camera camera

Call the native camera through react-native-camera, and customize the style

GitHub address:

https://github.com/react-native-community/react-native-camera

Install:

npm install react-native-camera --save
react-native link react-native-camera

Configuration:

1. Modify android/app/build.gradle, the red part is the new content

dependencies {
    compile fileTree(dir: "libs", include: ["*.jar"])
    compile "com.android.support:appcompat-v7:23.0.1"
    compile "com.facebook.react:react-native:+"  // From node_modules
compile (project(':react-native-camera')) { exclude group: "com.google.android.gms" compile 'com.android.support:exifinterface:25.+' compile ('com.google.android.gms:play-services-vision:12.0.1') { force = true } }
}

2. Modify...\android\app\src\main\AndroidManifest.xml to increase camera processing permissions

<uses-permission android:name="android.permission.RECORD_AUDIO"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

3. Add jitpack to android/build.gradle

allprojects {
    repositories {
        maven { url "https://jitpack.io" }
        maven { url "https://maven.google.com" }
    }
}

Add function implementation code:

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325319993&siteId=291194637