【发布时间】:2018-12-12 15:38:28
【问题描述】:
使用react-native-camera(RNCamera),当预览是窗口的全宽时,我正在努力将我的相机预览的高度设置为正确,并且完整的预览可见。此问题假定设备始终处于纵向模式。
我的代码如下:
import React, { Component } from "react";
import { Dimensions, Button, View } from "react-native";
import { RNCamera } from "react-native-camera";
export default class CameraScreen extends Component {
static navigationOptions = {
header: null
};
render() {
return (
<View>
<RNCamera
ref={ref => {
this.camera = ref;
}}
style={{
width: Dimensions.get("window").width,
height: 400 // <-- need to know what this value actually is
}}
type={RNCamera.Constants.Type.back}
/>
<Button
title="This button should appear directly below the camera preview"
onPress={() => false}
/>
</View>
);
}
});
我确定它与getSupportedRatiosAsync() 有关,但是这会返回多个比率。有人可以帮忙吗?
【问题讨论】:
标签: reactjs react-native react-native-camera