react-native-camera-android
react-native-camera-android copied to clipboard
Merge with react-native-camera?
Hey Eddie. By the looks of it you've done some good working getting the camera working on Android. Are you interested in unifying the code base under react-native-camera
so we have a single cross-platform module? I'd love to have you as a co-author on the module.
+1
1+
@lwansbrough sure!
Do we have to unify the api calls?
and how can we get started?
Awesome! I think it would be appropriate to unify the API calls, yes. I've just given you write access to lwansbrough/react-native-camera - feel free to push your code up whenever you like. We can indicate the progress being made to merge the modules in the read me. Attribute yourself as you see fit.
@lwansbrough ok thanks!
I will be modifying my code for the next few days
it might take a while
@NorthFoxz I've revoked access temporarily until we get the merge sorted out. There are a few forks for Android. Yours is one of the most complete and functional ones I've seen. I think everyone can contribute to it the merge, but we should align on what we want to do before anyone commits code. Apologies! Please join the conversation, we're gonna need as much input as possible: https://github.com/lwansbrough/react-native-camera/issues/87
@lwansbrough @NorthFoxz hey guys...just wanted to let you know that I had problems with the barcode scanner never reaching the onBarCodeScan event. I found the problem inside the method getFramingRectInPreview always returning a null object because getWidth and getHeight methods for viewport size would return 0. I defaulted them to screen size, and although it is a nasty hack, at least it works. viewFinderDisplay prop is set to true, but there is still no view finder whatsoever, so I guess the problem originates somewhere in passing that prop. Hope I helped at least a little :)
@tarikmlaco +1 Did you find any solution to it yet? I can't scan barcodes at all.
Yes, I did. I managed to hack the code inside react-native-camera-android Java code...you need to manually set the viewfinder Rect to screen size and then it will scan barcodes. It seems there is a problem with the viewfinder prop, as it never gets rendered even when it's set to true.
2016-02-17 11:04 GMT+01:00 rohitgoyal [email protected]:
@tarikmlaco https://github.com/tarikmlaco +1 Did you find any solution to it yet? I can't scan barcodes at all.
— Reply to this email directly or view it on GitHub https://github.com/NorthFoxz/react-native-camera-android/issues/1#issuecomment-185132070 .
@tarikmlaco Where should I do that? Can you share that code?
public synchronized Rect getFramingRectInPreview(int previewWidth, int
previewHeight) {
if(this.mFramingRectInPreview == null) {
Rect framingRect = this.mViewFinderView.getFramingRect();
int viewFinderViewWidth = this.mViewFinderView.getWidth();
int viewFinderViewHeight = this.mViewFinderView.getHeight();
if(framingRect != null) {
Rect rect = new Rect(framingRect);
rect.top = 0;
rect.left = 0;
rect.right = previewWidth;
rect.bottom = previewHeight;
return rect;
}
if(framingRect == null || viewFinderViewWidth == 0 ||
viewFinderViewHeight == 0) {
return null;
}
Rect rect = new Rect(framingRect);
rect.left = rect.left * previewWidth / viewFinderViewWidth;
rect.right = rect.right * previewWidth / viewFinderViewWidth;
rect.top = rect.top * previewHeight / viewFinderViewHeight;
rect.bottom = rect.bottom * previewHeight /
viewFinderViewHeight;
this.mFramingRectInPreview = rect;
}
return this.mFramingRectInPreview;
}
@rohitgoyal Find this function in the module, it is in RNCameraInstanceView.java and hack it the way I did.
@tarikmlaco Thanks! Just tried it and it works. :) @lwansbrough Any plans on correcting the issue?
@rohitgoyal No problem. But bear in mind that this is only a hack and subsequent version should fix the issue with the viewfinder prop. @lwansbrough @NorthFoxz any news on the merge?
https://github.com/lwansbrough/react-native-camera/issues/87#issuecomment-174223015