react-native-qrcode-scanner
react-native-qrcode-scanner copied to clipboard
Change Size Preview Camera
I want to change preview size camera like that. But i set width and height Camera and View contain Camera view. They are not working well,
Please help me how to change them
Thanks HuyTran
Do something like this:
<QRCodeScanner
onRead={this.onSuccess.bind(this)}
ref={(node) => { this.scanner = node; }}
containerStyle={{ marginTop: 10 }}
cameraStyle={{ height: 200, marginTop: 20, width: 200, alignSelf: 'center', justifyContent: 'center' }}
/>
Hi guys, I there any way to have the camera's preview screen to fit width of main container ? Thanks
Hi guys, I there any way to have the camera's preview screen to fit width of main container ? Thanks
Isn't it by default?
With the following code I expect my preview to fit screen's width size by default
<QRCodeScanner containerStyle={{ borderColor: 'red', borderWidth: 5 }} cameraStyle={{ borderColor: 'green', borderWidth: 5 }} />
But I don't even see the border color...

Did I missed something ?
@porzioj try giving width of QRCodeScanner as const borderwidth = 5
width: Dimensions.get('screen').width - ( borderwidth * 2 ) borderWidth: borderwidth
Got the same issue and solved it successfully I've explained it at #173, feel free to check it and hopefully it's helpful for your case.
Hi guys, I there any way to have the camera's preview screen to fit width of main container ? Thanks
Setting cameraStyle width to 100% seems to have worked for me.
cameraStyle: {
alignSelf: 'center',
justifyContent: 'center',
width: '100%',
}