Skip to content

Commit cb5414d

Browse files
committed
fix ios scanner memleak
1 parent f081d66 commit cb5414d

File tree

2 files changed

+2
-13
lines changed

2 files changed

+2
-13
lines changed

ios/RNPdfScannerManager.m

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
#import "DocumentScannerView.h"
44

55
@interface RNPdfScannerManager()
6-
@property (strong, nonatomic) DocumentScannerView *scannerView;
76
@end
87

98
@implementation RNPdfScannerManager
@@ -18,7 +17,6 @@ - (dispatch_queue_t)methodQueue
1817
RCT_EXPORT_VIEW_PROPERTY(onPictureTaken, RCTBubblingEventBlock)
1918
RCT_EXPORT_VIEW_PROPERTY(onRectangleDetect, RCTBubblingEventBlock)
2019

21-
2220
RCT_EXPORT_VIEW_PROPERTY(overlayColor, UIColor)
2321
RCT_EXPORT_VIEW_PROPERTY(enableTorch, BOOL)
2422
RCT_EXPORT_VIEW_PROPERTY(useFrontCam, BOOL)
@@ -33,14 +31,8 @@ - (dispatch_queue_t)methodQueue
3331
RCT_EXPORT_VIEW_PROPERTY(brightness, float)
3432
RCT_EXPORT_VIEW_PROPERTY(contrast, float)
3533

36-
RCT_EXPORT_METHOD(capture) {
37-
38-
[_scannerView capture];
39-
}
40-
4134
- (UIView*) view {
42-
_scannerView = [[DocumentScannerView alloc] init];
43-
return _scannerView;
35+
return [DocumentScannerView new];
4436
}
4537

4638
@end

src/index.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,6 @@ class PdfScanner extends React.Component<PdfScannerProps> {
9292
}
9393
}
9494

95-
capture () {
96-
CameraManager.capture()
97-
}
98-
9995
render () {
10096
return (
10197
<RNPdfScanner
@@ -108,6 +104,7 @@ class PdfScanner extends React.Component<PdfScannerProps> {
108104
contrast={this.props.contrast || 1}
109105
quality={this.getImageQuality()}
110106
detectionCountBeforeCapture={this.props.detectionCountBeforeCapture || 5}
107+
durationBetweenCaptures={this.props.durationBetweenCaptures || 0}
111108
detectionRefreshRateInMS={this.props.detectionRefreshRateInMS || 50}
112109
/>
113110
)

0 commit comments

Comments
 (0)