ideacreation / react-native-barcodescanner

A barcode scanner component for react native - not maintained anymore - use react-native-camera
MIT License
537 stars 162 forks source link

cann't work well with react-native-navigation #42

Open SPxiaomin-zz opened 8 years ago

SPxiaomin-zz commented 8 years ago

following the instruction, I install the react-native-barcodescanner, and it work well without react-native-navigation. But, when it comes to react-native-navigation and I create a individual page for the react-native-barcodescanner to work, it cann't work well. When i go to the page by pressing a button on a another page, It only show a red line on the left, nothing else.

Plz help me~ thx in advance~

agiamas commented 8 years ago

+1, worked fine with react-native 0.24 but with 0.29.2 I get the same behavior. Looks like something is there coz if you add a custom width/height in an enclosing View you can get a red box in the top ~ the number of pixels you defined

SPxiaomin-zz commented 8 years ago

@agiamas you are using react-native-navigation combined with react-native-barcodescanner, really ?

liujibin commented 8 years ago

because it extends RootActivity.so MainApplication will not work.find react-native-navigation in node_modules.Override getPackages() method in RootActivity.Then Override getPackages method in MainActivity in you Application.

SPxiaomin-zz commented 8 years ago

@liujibin1836591303 sorry, I'm almost a newbie in Java. can you describe more minutely. Or If it is convenient for you, you can show me the code directly.

Thx in advance.

liujibin commented 8 years ago

@SPxiaomin QQ:1836591303

ThaJay commented 8 years ago

I don't think this is related to your navigation solution. I had the same problem and these props solved it for me. This removes the viewfinder in the camera image, but you can give children if you want to make your own.

      <BarcodeScanner
        onBarCodeRead={this.props.onBarCodeRead}
        viewFinderBorderWidth={Dimensions.get('window').width}
        viewFinderBorderLength={Dimensions.get('window').height}
        viewFinderBorderColor={transparent}
        style={{flex: 1}}
      />
rrandom commented 7 years ago

@ThaJay It works!