React Native学习

react native 调用camera

2018-07-18  本文已影响4人  wanTag

使用第三方插件

npm install react-native-camera
react-native link react-native-camera
android需要特殊注意的两处:

AndroidManifest.xml

 <!--获取相机权限-->
 <uses-permission android:name="android.permission.CAMERA"/>

 <uses-feature android:name="android.hardware.camera" android:required="false" />
 <uses-feature android:name="android.hardware.camera.front" android:required="false" />

android/build.gradle

allprojects {
    repositories {
        mavenLocal()
        jcenter()
        google()
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url "$rootDir/../node_modules/react-native/android"
        }
        maven { url "https://jitpack.io" }
        maven { url "https://maven.google.com" }
    }
}
上一篇 下一篇

猜你喜欢

热点阅读