moaazsidat / react-native-qrcode-scanner

A QR code scanner component for React Native.
MIT License
2.03k stars 513 forks source link

RNP.available.includes fails because RNP.available is undefined. #289

Closed PauliusLiekis closed 4 years ago

PauliusLiekis commented 4 years ago

I'm trying to install the plugin as described. My project already contains react-native-permissions (v2.0.3). When I run the project I get an exception that properly 'includes' can not be read on undefined, while evaluating RNP.available.includes.

I noticed that react-native-qrcode-scanner uses ^v2.0.2 of react-native-permissions (which installs 2.2.0).

I tried changing my project dependency to be v2.0.2 and then v2.2.0 too for react-native-permissions, but that resulted in the same issue. Then I reverted the local setting to 2.0.3 and the problem went away! but I don't understand why, and the git says that I have no local changes. It's very strange that install order affects whether it works or not. However, the clean checkout of the project doesn't work again.

I'm testing on iOS at the moment.

I checked the source code of react-native-permissions and the latest version doesn't seem to contain RNP.available property anymore, so I suspect it's something wrong with the dependencies on react-native-qrcode-scanner. If you think that's not the case - maybe you can give some advice on how to solve this problem?

renatobenks commented 4 years ago

closing this as it's duplicated by https://github.com/moaazsidat/react-native-qrcode-scanner/issues/287

PauliusLiekis commented 4 years ago

@renatobenks that was some harsh judgment :) Technically the issue is slightly different. I closed #287 because I thought the issue went away, but then it came back, so I opened a new one with the corrected description.

PauliusLiekis commented 4 years ago

Anyway, you don't need to reopen the issue. I hope I solved the issue by changing my local version of react-native-permissions to 2.2.0 and then cleaning up node_modules and reinstalling. That got rid of extra install of react-native-permissions in node_modules/ react-native-qrcode-scanner. So the issue is real, but it's probably caused by npm (?) rather than react-native-qrcode-scanner itself.