Open idanlo opened 4 years ago
@idanlo did you solve this issue, I would really appreciate any help!
@mirhat I did not solve this but apparently this only happens in development, in production build the manual capture works. This still needs to be fixed though.
I suspect the issue has something to do with this: https://github.com/Woonivers/react-native-document-scanner/blob/master/android/src/main/java/com/documentscanner/DocumentScannerModule.java#L27
The question here is "why does this need to be ran like that, rather than just running the view.capture() method directly?".
After all, the capture method will run async and handle all the image processing in the callback method so detecting what thread it's on before calling it is pointless? Am I correct to assume this?
I actually rebuilt this package over at https://github.com/HarvestProfit/react-native-rectangle-scanner which you could try out. If the problem persists, then maybe I'm incorrect to assume that, but my package handles all capturing via manually (it uses javascript to auto call the manual capture function). I've had zero issues with this method.
I'm having the same issue. It would be great to make it work on the simulator too, even if the image is black, to be able to test an app easily :)
Does react-native-rectangle-scanner
work on the iOS simulator?
@antoinerousseau It does work on an iOS simulator. It just shows a black screen. Also the onDeviceSetup
function will send a hasCamera
attribute that will be false so you can also show a custom message like "This device doesn't have a camera" if you want. I included that in the example.
Not working on a simulator was one of my biggest issues with this package and its derivatives which is why I included that requirement when I built the react-native-rectangle-scanner
package.
See #38 for a fix, this is caused by dispatch_get_main_queue
that was here before the set of fixes #26 It removed the non idiomatic singleton approach ( race condition and memory leaks )
When calling the
ref.current.capture()
method I get this error: