Using react-native-camera (RNCamera), I am struggling to set the height of my camera preview to be correct when the preview is the full width of the window, with the full preview being visible. This question assumes the device is in portrait mode at all times.
My code is as follows:
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>
);
}
});
I'm sure it has something to do with getSupportedRatiosAsync()
, however this returns multiple ratios. Can anybody help?