Android Take PictureAsync of Expo';照相机什么也不回。(承诺从未兑现)
我开始使用Expo中的Android Take PictureAsync of Expo';照相机什么也不回。(承诺从未兑现),android,react-native,camera,expo,Android,React Native,Camera,Expo,我开始使用Expo中的摄像头来拍摄React Native() 我看到摄像头窗口,但当我调用时,请等待此消息。camera.takePictureAsync()承诺从未完成,我也没有得到任何输出 我的相机: <Camera ref={(camera) => this.camera = camera} style={{flex: 1}} type={this.state.type} > <Button onPress={() => this.snap()}
摄像头来拍摄React Native()
我看到摄像头窗口,但当我调用时,请等待此消息。camera.takePictureAsync()代码>承诺从未完成,我也没有得到任何输出
我的相机:
<Camera ref={(camera) => this.camera = camera}
style={{flex: 1}}
type={this.state.type}
>
<Button onPress={() => this.snap()} title='SNAP'/>
</Camera>
SNAP代码>显示在控制台中,因此摄像头本身没有问题。永远不会调用第二个控制台.log
我正在Android 9(真实设备)上测试我的应用程序
编辑:它正在emulator上工作,因此实际设备肯定有问题尝试将相机元素的useCamera2Api prop设置为true
snap = async () => {
if (this.camera) {
console.log("SNAP!");
let photo = await this.camera.takePictureAsync();
console.log(photo);
}
};