ekreutz / react-native-barcode-scanner-google

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

Fix black background issue #6

Closed kruyvanna closed 6 years ago

kruyvanna commented 7 years ago

When used with navigation, the barcode scanner view remains on top of other view with black background.

ekreutz commented 7 years ago

Nice, thanks. I'll take a look soon and merge it!

kruyvanna commented 7 years ago

Hi, with further testing, it's not fully fixed yet. I will let u know when I get new update.

kruyvanna commented 6 years ago

I finally found the cause. Turns out setting child size bigger than it's parent is the culprit.

I changed fillLayout() to fitLayout() in previewLayout()

I don't know how to make fillLayout() works though.

screen shot 2017-10-25 at 11 03 08 am
kruyvanna commented 6 years ago

This is the project to reproduce the bug https://github.com/kruyvanna/react-native-barcode-scanner-google-black-view-bug

srolija commented 6 years ago

Thank you very much, been attempting work around that problem for quite some time, never crossed my mind that could be the issue. Since I am also looking into keeping fillLayout, I will as well give it a go at why it breaks.

kruyvanna commented 6 years ago

@srolija great! looking forward to hearing from you

ekreutz commented 6 years ago

There were some good observations in this PR, but I feel like it's a bit of a hack that fixes the issue at the expense of modifying intended behaviour of the module. I made a long comment about this and pushed a (hopefully) more thorough fix for this. Read more: https://github.com/ekreutz/react-native-barcode-scanner-google/issues/4

Closing this for now. Thanks for putting in the hard work, it was definitely helpful in solving the issue!

MeLean commented 4 years ago

I found a workaround here

srolija commented 4 years ago

If you are planning to use it in the production app, I would highly recommend you to check the RNCamera instead, at the time this was without the doubt the only library that worked performantly enough on Android, but during the last two years, things drastically changed. And while RNCamera was constantly updated, this one remained the same. My personal experience is that moving to that library drastically lowered the number of issues arriving into Sentry from dozen a week to a few a month.

You can find more details in another issue on this same issue tracker: https://github.com/ekreutz/react-native-barcode-scanner-google/pull/7#issuecomment-528620721.