File tree Expand file tree Collapse file tree 2 files changed +18
-1
lines changed
android/src/main/java/com/documentscanner Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -102,7 +102,7 @@ private void processPreviewFrame(PreviewFrame previewFrame) {
102
102
if (detectPreviewDocument (frame ) && focused ) {
103
103
numOfSquares ++;
104
104
double now = (double )(new Date ()).getTime () / 1000.0 ;
105
- if (numOfSquares == numOfRectangles && now < lastCaptureTime + durationBetweenCaptures ) {
105
+ if (numOfSquares == numOfRectangles && now > lastCaptureTime + durationBetweenCaptures ) {
106
106
lastCaptureTime = now ;
107
107
numOfSquares = 0 ;
108
108
mMainActivity .requestPicture ();
Original file line number Diff line number Diff line change @@ -84,6 +84,23 @@ class PdfScanner extends React.Component<PdfScannerProps> {
84
84
}
85
85
}
86
86
87
+ componentDidUpdate ( prevProps : PdfScannerProps ) {
88
+ if ( Platform . OS === 'android' ) {
89
+ if ( this . props . onPictureTaken !== prevProps . onPictureTaken ) {
90
+ if ( prevProps . onPictureTaken )
91
+ DeviceEventEmitter . removeListener ( 'onPictureTaken' , prevProps . onPictureTaken )
92
+ if ( this . props . onPictureTaken )
93
+ DeviceEventEmitter . addListener ( 'onPictureTaken' , this . props . onPictureTaken )
94
+ }
95
+ if ( this . props . onProcessing !== prevProps . onProcessing ) {
96
+ if ( prevProps . onProcessing )
97
+ DeviceEventEmitter . removeListener ( 'onProcessingChange' , prevProps . onProcessing )
98
+ if ( this . props . onProcessing )
99
+ DeviceEventEmitter . addListener ( 'onProcessingChange' , this . props . onProcessing )
100
+ }
101
+ }
102
+ }
103
+
87
104
componentWillUnmount ( ) {
88
105
if ( Platform . OS === 'android' ) {
89
106
const { onPictureTaken, onProcessing } = this . props
You can’t perform that action at this time.
0 commit comments