Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
R
react-native-smart-barcode
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
放牛的园子
react-native-smart-barcode
Commits
f3e8f7a2
Commit
f3e8f7a2
authored
Oct 27, 2016
by
cyqresig
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed the bug: cannot restart barcode scan session
parent
b0d40d64
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
3 deletions
+11
-3
RCTBarcode.m
ios/RCTBarcode/RCTBarcode/RCTBarcode.m
+0
-3
RCTBarcodeManager.m
ios/RCTBarcode/RCTBarcode/RCTBarcodeManager.m
+11
-0
No files found.
ios/RCTBarcode/RCTBarcode/RCTBarcode.m
View file @
f3e8f7a2
...
...
@@ -52,9 +52,6 @@
{
// NSLog(@"removeFromSuperview...");
[
self
.
scanLineTimer
invalidate
];
self
.
scanLineTimer
=
nil
;
[
self
.
manager
endSession
];
[
super
removeFromSuperview
];
}
...
...
ios/RCTBarcode/RCTBarcode/RCTBarcodeManager.m
View file @
f3e8f7a2
...
...
@@ -61,6 +61,9 @@ RCT_CUSTOM_VIEW_PROPERTY(barCodeTypes, NSArray, RCTBarcode) {
}
-
(
void
)
initializeCaptureSessionInput
:
(
NSString
*
)
type
{
NSLog
(
@"initializeCaptureSessionInput..."
);
dispatch_async
(
self
.
sessionQueue
,
^
{
[
self
.
session
beginConfiguration
];
...
...
@@ -84,6 +87,9 @@ RCT_CUSTOM_VIEW_PROPERTY(barCodeTypes, NSArray, RCTBarcode) {
if
([
self
.
session
canAddInput
:
captureDeviceInput
])
{
NSLog
(
@"self.session canAddInput:captureDeviceInput..."
);
[
self
.
session
addInput
:
captureDeviceInput
];
self
.
videoCaptureDeviceInput
=
captureDeviceInput
;
...
...
@@ -107,6 +113,9 @@ RCT_EXPORT_METHOD(startSession) {
// NSLog(@"self.metadataOutput = %@", self.metadataOutput);
if
(
self
.
metadataOutput
==
nil
)
{
NSLog
(
@"self.metadataOutput = %@"
,
self
.
metadataOutput
);
AVCaptureMetadataOutput
*
metadataOutput
=
[[
AVCaptureMetadataOutput
alloc
]
init
];
self
.
metadataOutput
=
metadataOutput
;
...
...
@@ -171,6 +180,7 @@ RCT_EXPORT_METHOD(stopSession) {
[
self
.
session
commitConfiguration
];
[
self
.
session
stopRunning
];
[
self
.
barcode
.
scanLineTimer
invalidate
];
self
.
barcode
.
scanLineTimer
=
nil
;
for
(
AVCaptureInput
*
input
in
self
.
session
.
inputs
)
{
[
self
.
session
removeInput
:
input
];
}
...
...
@@ -178,6 +188,7 @@ RCT_EXPORT_METHOD(stopSession) {
for
(
AVCaptureOutput
*
output
in
self
.
session
.
outputs
)
{
[
self
.
session
removeOutput
:
output
];
}
self
.
metadataOutput
=
nil
;
});
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment