Android 反应本机摄影机无法渲染
我的相机有问题。它以前工作过,但现在停止了,我不知道为什么。 问题是它没有呈现,没有显示请求权限的弹出窗口,并且我可以在日志中看到此错误:Android 反应本机摄影机无法渲染,android,react-native,react-native-camera,Android,React Native,React Native Camera,我的相机有问题。它以前工作过,但现在停止了,我不知道为什么。 问题是它没有呈现,没有显示请求权限的弹出窗口,并且我可以在日志中看到此错误: Possible Unhandled Promise Rejection (id: 3): TypeError: CameraManager.checkVideoAuthorizationStatus is not a function TypeError: CameraManager.checkVideoAuthorizationStatus is not
Possible Unhandled Promise Rejection (id: 3):
TypeError: CameraManager.checkVideoAuthorizationStatus is not a function
TypeError: CameraManager.checkVideoAuthorizationStatus is not a function
at requestPermissions$ (/home/pro/Documents/app/.vscode/.react/index.bundle:143969:61)
at tryCatch (/home/pro/Documents/app/.vscode/.react/index.bundle:25021:19)
at Generator.invoke [as _invoke] (/home/pro/Documents/app/.vscode/.react/index.bundle:25194:24)
at Generator.next (/home/pro/Documents/app/.vscode/.react/index.bundle:25064:23)
at tryCatch (/home/pro/Documents/app/.vscode/.react/index.bundle:25021:19)
at invoke (/home/pro/Documents/app/.vscode/.react/index.bundle:25094:22)
at /home/pro/Documents/app/.vscode/.react/index.bundle:25124:13
at tryCallTwo (/home/pro/Documents/app/.vscode/.react/index.bundle:27110:7)
at doResolve (/home/pro/Documents/app/.vscode/.react/index.bundle:27274:15)
at new Promise (/home/pro/Documents/app/.vscode/.react/index.bundle:27133:5)
RNCamera的使用方式如下:
import { RNCamera } from 'react-native-camera';
...
<RNCamera
style={{ flex: 1 }}
captureAudio={false}
ref={(cam) => {
this.camera = cam;
}}
barCodeTypes={[
RNCamera.Constants.BarCodeType.aztec,
RNCamera.Constants.BarCodeType.qr,
RNCamera.Constants.BarCodeType.datamatrix,
]}
onBarCodeRead={this.onSuccessQrScan}
notAuthorizedView={
<View style={StylesGlobal.container}>
<Icon name="close" size={60} color={Color.RED} style={{ alignSelf: 'center' }} />
<TextCenter small>{strings.general.cameraNotAuthorized}</TextCenter>
</View>
}
androidCameraPermissionOptions={{
title: strings.general.cameraPermissionTitle,
message: strings.general.cameraPermission,
buttonPositive: strings.general.ok,
buttonNegative: strings.general.cancel,
}}
/>
...
从'react native camera'导入{RNCamera};
...
{
这个摄像头=凸轮;
}}
条码类型={[
RNCamera.Constants.BarCodeType.aztec,
RNCamera.Constants.BarCodeType.qr,
RNCamera.Constants.BarCodeType.datamatrix,
]}
onBarCodeRead={this.onSuccessQrScan}
未授权视图={
{strings.general.cameraNotAuthorized}
}
androidCameraPermissionOptions={{
标题:strings.general.cameraPermissionTitle,
消息:strings.general.cameraPermission,
buttonPositive:strings.general.ok,
buttonNegative:strings.general.cancel,
}}
/>
...
react本机版本为0.63.2
react本机摄像头版本为3.23.1
我试图使用手动安装所述,但得到的错误,模块链接两次,我没有克服
你能帮忙吗。如果你需要任何其他来源,我可以提供
谢谢
编辑:
我发现了一件奇怪的事。RNCamera在应用程序中的两个不同位置使用,有时它在1个位置工作,但不会在其他位置工作,并出现所述错误
编辑2:
我已成功手动安装了react-native camera(如此处所述),并解决了模块通过链接两次的问题,但结果相同我认为react-native-link react-native camera无法按预期工作。手动链接库将解决此问题。
对于您的错误-模块链接了两次-首先取消与react-native camera相关的所有链接,然后使用文档再次添加手动链接。AFAIK因为RN>0.60自动链接已完成,所以我没有执行
react-native-link react-native camera