ekreutz / react-native-barcode-scanner-google

Barcode scanner for react native, which implements barcode detection from Google's Vision API.
MIT License
113 stars 68 forks source link

camera view, fullscreen not working #12

Open joaoalbertocsjunior opened 6 years ago

joaoalbertocsjunior commented 6 years ago

Hi! I'am following the example on the readme section, and camera doesnt seem to get fullscreen on physical device, even with style flex: 1.

Here is the code:

import React, { Component } from 'react'; import { AppRegistry, StyleSheet, Text, View, Alert } from 'react-native'; import BarcodeScanner from 'react-native-barcode-scanner-google';

export default class BarcodeApp extends Component { render() { return ( <View style={{ flex: 1 }}> <BarcodeScanner style={{ flex: 1, }} onBarcodeRead={({data, type}) => { // handle your scanned barcodes here! // as an example, we show an alert: Alert.alert(Barcode '${data}' of type '${type}' was scanned.); }} /> ); } }

AppRegistry.registerComponent('brcodegooglern', () => BarcodeApp);

What could this be related to?

romanenko commented 6 years ago

Thanks for the great lib, @ekreutz.

I have this issue in my emulator too. I'm running a virtual device in my AVD: 720x1280. API 22. Android 5.1. x86.

This is what I see using cameraFillMode={CameraFillMode.COVER}

image

And this is what it looks like with cameraFillMode={CameraFillMode.FIT}

image

I pass dimensions of the window to the style props like this:

const { width, height } = Dimensions.get('window');

return (
  <BarcodeScanner
    style={{ width, height }}
    onException={this.handleException}
    onBarCodeRead={this.handleBarcodeRead}
    cameraFillMode={CameraFillMode.COVER}
    barcodeType={BarcodeType.EAN_13}
  />
)
cesarm16 commented 6 years ago

i've the same problem, any solution?

ananth10 commented 5 years ago

Hello guys, the camera view fits in mobiles but its not fully fit in some tablet. any solution?