react-native-camera-android icon indicating copy to clipboard operation
react-native-camera-android copied to clipboard

Barcode scanning is not working.

Open rohitgoyal opened this issue 9 years ago • 3 comments

I just tried this plugin and though the camera works but it can't read barcodes. Neither does it shows viewFinder even after setting up all the prop for viewFinder. Any idea what might be causing this issue?

rohitgoyal avatar Feb 17 '16 10:02 rohitgoyal

I'm having exactly the same issue. torchMode={"on"} doesn't work either. (Using React 0.21). All I get is the camera showing a live view with no viewfinder and _barcodeReceived isn't called.

Any help would be appreciated. Thanks.

I'm using the following:

import React, {
  AppRegistry,
  Component,
  StyleSheet,
  Text,
  View,
  Dimensions
} from 'react-native';

import CameraAndroid from 'react-native-camera-android';

class TestApp extends Component {

  _barcodeReceived(e) {
    console.log("here", e);
  }

  render() {
    return (
      <View style={styles.container}>
      <CameraAndroid
        style={{flex: 1,justifyContent: 'flex-end',alignItems: 'center',height: Dimensions.get('window').height,width: Dimensions.get('window').width}}
        ref="cam" // the reference of your camera view
        type={"back"} // the type of your camera
        autoFocus={true}
        torchMode={"on"} // flashlight settings of your camera
        viewFinderDisplay={true} // set it to true if you want to scan barcodes
        onBarCodeRead={this._barcodeReceived}
      />
        {/*<Text style={styles.welcome}>
          Welcome to React Native!
        </Text>
        <Text style={styles.instructions}>
          To get started, edit index.android.js
        </Text>
        <Text style={styles.instructions}>
          Shake or press menu button for dev menu
        </Text>*/}
      </View>
    );
  }
}

UPDATE: Just to note I have tested this both on a physical device (Nexus 5x Android 6.0.1) and Genymotion (Nexus 5 Android 6.0.0 API 23)

miletbaker avatar Mar 16 '16 22:03 miletbaker

I am also facing the same, it is not scanning any barcode/qrcode

john1jan avatar Apr 12 '16 06:04 john1jan

Did you find any solution for this issue??

samah2100 avatar Dec 01 '16 18:12 samah2100