You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
I can not get the camera to focus on macro with 💯 width. I am using version v14.0.0-beta12 from #533 (comment)
To Reproduce
importReactfrom'react';import{StyleSheet,View,Dimensions}from'react-native';import{Camera}from'react-native-camera-kit';const{width, height}=Dimensions.get('window');constcameraHeight=height*0.25;// Set the camera's height to 25% of the screen's heightconstcameraWidth=width;// Set the camera's width to 100% of the screen's widthconststyles=StyleSheet.create({container: {width: cameraWidth,height: cameraHeight,},camera: {flex: 1,aspectRatio: 16/9,// Set the aspect ratio to 16:9 for widescreen},});exportdefaultfunctionAppScan(){constscanBarcode=e=>{console.log({code: e.nativeEvent.codeStringValue});};return(<View><Viewstyle={styles.container}><CamerafocusMode="on"scanBarcode={true}style={styles.camera}showFrame={false}onReadCode={scanBarcode}/></View>{/* OTHER CONTENT */}</View>);}
Expected behavior
Expecting the aspect ratio to make the camera screen wider. I would like the camera to take 100% of the width and its not doing that. Is the aspect ratio is locked into a square?
Screenshots
Trying to get the camera to take up 100% of the width on the top 25% of the screen.
The text was updated successfully, but these errors were encountered:
The camera maintains the aspect ratio, while staying with the viewport it's given, which is to prevent common mistakes with warping and accidental cropping. (We used to get reports of people saying their camera content was cropped, or the picture bigger than what they were seeing).
If you'd like it to be cropped, you can place the Camera component and size it appropriately, then use a parent View to limit how much of the child is visible (by providing a smaller size). Note that you need to decide on how to crop the camera. I'd assume you want it cropped from the center, in which case you need to center-align the camera component in the smaller container.
We don't currently have an API for changing the aspect ratio or crop behavior as those features caused problems in the past, particularly on Android.
Also please note that cropping the viewport does not change what is saved when capturing a photo.
Describe the bug
I can not get the camera to focus on macro with 💯 width. I am using version
v14.0.0-beta12
from #533 (comment)To Reproduce
Expected behavior
Expecting the aspect ratio to make the camera screen wider. I would like the camera to take 100% of the width and its not doing that. Is the aspect ratio is locked into a square?
Screenshots
Trying to get the camera to take up 100% of the width on the top 25% of the screen.
The text was updated successfully, but these errors were encountered: