ideacreation / react-native-barcodescanner

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

Balck screen after navigating #71

Open affibox opened 7 years ago

affibox commented 7 years ago

This modules is leaving a black frame on the lower part of the app after navigating away from it. I only manage to remove the black frame after reopening the app.

Also it needs urgently a start and stop feature.

affibox commented 7 years ago

Nothing?

nyablo commented 7 years ago

can confirm

affibox commented 7 years ago

I did a hack that fixes this. But it has to be done on the JAVA side.

Scimonster commented 7 years ago

@affibox Maybe fork and make a pull request if you haven't done that yet.

obykoo commented 7 years ago

@affibox Please share fix :+1:

affibox commented 7 years ago

@obykoo @Scimonster i just saw this message. Let me see if i can tackle this in the morning. God bless

affibox commented 7 years ago

Please look at this code ''' <BarcodeScanner onBarCodeRead={this.barcodeReceived.bind(this)} style={{ width:(Dimensions.get('window').width0.95),height:(Dimensions.get('window').height0.95) }} torchMode={this.state.torchMode} cameraType={this.state.cameraType}

'''

I remember that the problem went away after hardcoding the height and width of the bardcode scanner component.

Let me know if this works.

affibox commented 7 years ago

Did it work? @Scimonster @obykoo

coderFun commented 7 years ago

@affibox it works if not set width to SCREEN_WIDTH

jhon-andrew commented 7 years ago

I've encountered the same issue, this works for me:

I set <BarcodeScanner>'s width to Dimensions.get('window').width - 1 and the height to Dimensions.get('window').height - 25 where 25 is the height of the status bar. Then I placed it inside a <View> with a background color black to at least hide the white border appearing.

<View style={{flex: 1, alignItems: 'center', justifyContent: 'center', backgroundColor: 'black'}}>
  <BarcodeScanner
    onBarCodeRead={this.barcodeReceived.bind(this)}
    style={{width: Dimensions.get('window').width - 1, height: Dimensions.get('window').height - 25}}
    torchMode={this.state.torchMode}
    cameraType={this.state.cameraType}
    />
</View>