调用摄像头拍照
yarn add react-native-image-picker
运行react-native link自动注册相关的组件到原生配置中
打开项目中的android->app->src->main->AndroidManifest.xml文件,在第8行添加如下配置:
打开项目中的android->app->src->main->java->com->当前项目名称文件夹->MainActivity.java文件,修改配置如下:
```java
package com.native_camera;
import com.facebook.react.ReactActivity;
// 1. 添加以下两行:
import com.imagepicker.permissions.OnImagePickerPermissionsCallback; //
import com.facebook.react.modules.core.PermissionListener; //
public class MainActivity extends ReactActivity {
// 2. 添加如下一行:
private PermissionListener listener; //
* Returns the name of the main component registered from JavaScript.
* This is used to schedule rendering of the component.
*/
@Override
protected St