react-native-scanbot-barcode-scanner-sdk 4.2.0 → 4.3.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/Libraries.txt +31 -31
  2. package/RNScanbotBarcodeSDK.podspec +1 -4
  3. package/android/build.gradle +6 -5
  4. package/android/src/main/java/io/scanbot/barcodesdk/plugin/reactnative/ScanbotBarcodeSdkPackage.kt +9 -7
  5. package/android/src/main/java/io/scanbot/barcodesdk/plugin/reactnative/components/barcode_scanner_view/ScanbotBarcodeScannerView.kt +114 -0
  6. package/android/src/main/java/io/scanbot/barcodesdk/plugin/reactnative/components/barcode_scanner_view/ScanbotBarcodeScannerViewEvents.kt +56 -0
  7. package/android/src/main/java/io/scanbot/barcodesdk/plugin/reactnative/components/barcode_scanner_view/ScanbotBarcodeScannerViewManager.kt +256 -0
  8. package/android/src/main/java/io/scanbot/barcodesdk/plugin/reactnative/extensions/JSONObject.kt +18 -2
  9. package/android/src/main/java/io/scanbot/barcodesdk/plugin/reactnative/extensions/ReadableMap.kt +3 -4
  10. package/android/src/newarch/ScanbotBarcodeScannerViewManagerSpec.kt +19 -0
  11. package/android/src/oldarch/ScanbotBarcodeScannerViewManagerSpec.kt +29 -0
  12. package/dist/components/barcode-camera-view/ScanbotBarcodeCameraView.d.ts +3 -0
  13. package/dist/components/barcode-camera-view/ScanbotBarcodeCameraView.js +122 -0
  14. package/dist/components/barcode-camera-view/ScanbotBarcodeCameraViewProperties.d.ts +89 -0
  15. package/dist/components/barcode-camera-view/ScanbotBarcodeCameraViewProperties.js +2 -0
  16. package/dist/components/spec/ScanbotBarcodeScannerViewNativeComponent.d.ts +54 -0
  17. package/dist/components/spec/ScanbotBarcodeScannerViewNativeComponent.js +12 -0
  18. package/dist/configurations.d.ts +241 -0
  19. package/dist/configurations.js +2 -0
  20. package/dist/customConfigurations.d.ts +94 -0
  21. package/dist/customConfigurations.js +2 -0
  22. package/dist/customResults.d.ts +5 -0
  23. package/dist/customResults.js +2 -0
  24. package/dist/customTypes.d.ts +7 -0
  25. package/dist/customTypes.js +2 -0
  26. package/dist/index.d.ts +26 -0
  27. package/dist/index.js +34 -0
  28. package/dist/results.d.ts +29 -0
  29. package/dist/results.js +2 -0
  30. package/dist/types.d.ts +1194 -0
  31. package/dist/types.js +2 -0
  32. package/ios/Components/BarcodeScannerView/RNScanbotBarcodeScannerLegacyView.h +25 -0
  33. package/ios/Components/BarcodeScannerView/RNScanbotBarcodeScannerLegacyView.m +194 -0
  34. package/ios/Components/BarcodeScannerView/RNScanbotBarcodeScannerView.h +20 -0
  35. package/ios/Components/BarcodeScannerView/RNScanbotBarcodeScannerView.mm +259 -0
  36. package/ios/Components/BarcodeScannerView/RNScanbotBarcodeScannerViewControllerWrapper.h +99 -0
  37. package/ios/Components/BarcodeScannerView/RNScanbotBarcodeScannerViewControllerWrapper.m +196 -0
  38. package/ios/Components/BarcodeScannerView/RNScanbotBarcodeScannerViewManager.mm +73 -0
  39. package/package.json +16 -21
  40. package/src/components/barcode-camera-view/ScanbotBarcodeCameraView.tsx +112 -0
  41. package/src/components/barcode-camera-view/ScanbotBarcodeCameraViewProperties.ts +106 -0
  42. package/src/components/spec/ScanbotBarcodeScannerViewNativeComponent.ts +59 -0
  43. package/src/index.ts +58 -0
  44. package/android/src/main/java/io/scanbot/barcodesdk/plugin/reactnative/components/barcodecameraview/ScanbotBarcodeCameraView.java +0 -401
  45. package/android/src/main/java/io/scanbot/barcodesdk/plugin/reactnative/components/base/communication/ScanbotEventEmitter.java +0 -78
  46. package/android/src/main/java/io/scanbot/barcodesdk/plugin/reactnative/components/base/communication/ScanbotEventReceiver.java +0 -119
  47. package/android/src/main/java/io/scanbot/barcodesdk/plugin/reactnative/components/base/ui/ScanbotViewWrapper.java +0 -26
  48. package/android/src/main/java/io/scanbot/barcodesdk/plugin/reactnative/utils/JSONUtils.kt +0 -24
  49. package/android/src/main/java/io/scanbot/barcodesdk/plugin/reactnative/utils/ScanbotViewUtils.java +0 -43
  50. package/android/src/new-architecture/io/scanbot/barcodesdk/plugin/reactnative/components/barcodecameraview/ScanbotBarcodeCameraViewManager.java +0 -125
  51. package/android/src/old-architecture/io/scanbot/barcodesdk/plugin/reactnative/components/barcodecameraview/ScanbotBarcodeCameraViewManager.java +0 -114
  52. package/index.d.ts +0 -42
  53. package/index.js +0 -20
  54. package/ios/Components/BarcodeCameraView/NewArchitecture/RTNScanbotBarcodeCameraView.h +0 -44
  55. package/ios/Components/BarcodeCameraView/NewArchitecture/RTNScanbotBarcodeCameraView.mm +0 -338
  56. package/ios/Components/BarcodeCameraView/NewArchitecture/RTNScanbotBarcodeCameraViewManager.mm +0 -71
  57. package/ios/Components/BarcodeCameraView/OldArchitecture/RNScanbotBarcodeCameraView.h +0 -36
  58. package/ios/Components/BarcodeCameraView/OldArchitecture/RNScanbotBarcodeCameraView.mm +0 -181
  59. package/ios/Components/BarcodeCameraView/OldArchitecture/RNScanbotBarcodeCameraViewManager.h +0 -28
  60. package/ios/Components/BarcodeCameraView/OldArchitecture/RNScanbotBarcodeCameraViewManager.mm +0 -89
  61. package/js/RTNScanbotBarcodeCameraViewNativeComponent.ts +0 -186
  62. package/src/components/barcode-camera-view/scanbot-barcode-camera-view-types.ts +0 -175
  63. package/src/components/barcode-camera-view/scanbot-barcode-camera-view.tsx +0 -270
  64. package/src/components/barcode-camera-view/scanbot-native-barcode-camera-view.ts +0 -7
@@ -1,71 +0,0 @@
1
- //
2
- // RNScanbotBarcodeCameraViewManager.mm
3
- // RNScanbotBarcodeSDK
4
- //
5
- // Created by Marco Saia on 28.08.23.
6
- //
7
-
8
- // We use this compilation pragma to expose this implementation for the NEW ARCHITECTURE only
9
- #ifdef RCT_NEW_ARCH_ENABLED
10
-
11
- #import <React/RCTLog.h>
12
- #import <React/RCTUIManager.h>
13
- #import <React/RCTViewManager.h>
14
- #import <Foundation/Foundation.h>
15
- #import "RTNScanbotBarcodeCameraView.h"
16
-
17
- typedef void (^NativeViewBlock)(RTNScanbotBarcodeCameraView* _Nonnull);
18
-
19
- @interface RTNScanbotBarcodeCameraViewManager : RCTViewManager
20
- @end
21
-
22
- @implementation RTNScanbotBarcodeCameraViewManager
23
-
24
- RCT_EXPORT_MODULE(RTNScanbotBarcodeCameraView)
25
- RCT_EXPORT_VIEW_PROPERTY(configuration, NSDictionary*)
26
- RCT_EXPORT_VIEW_PROPERTY(onNativeBarcodeScannerResult, RCTDirectEventBlock);
27
-
28
- // componentDidMount
29
- RCT_EXPORT_METHOD(componentDidMount:(nonnull NSNumber*) reactTag) {
30
- [self callNativeMethodWithReactTag: reactTag andBlock: ^void (RTNScanbotBarcodeCameraView* nativeView) {
31
- [nativeView componentDidMount];
32
- }];
33
- }
34
-
35
- // componentDidUpdate
36
- RCT_EXPORT_METHOD(componentDidUpdate:(nonnull NSNumber*) reactTag) {
37
- [self callNativeMethodWithReactTag: reactTag andBlock: ^void (RTNScanbotBarcodeCameraView* nativeView) {
38
- [nativeView componentDidUpdate];
39
- }];
40
- }
41
-
42
- // componentWillUnmount
43
- RCT_EXPORT_METHOD(componentWillUnmount:(nonnull NSNumber*) reactTag) {
44
- [self callNativeMethodWithReactTag: reactTag andBlock: ^void (RTNScanbotBarcodeCameraView* nativeView) {
45
- [nativeView componentWillUnmount];
46
- }];
47
- }
48
-
49
- // orientationChanged
50
- RCT_EXPORT_METHOD(orientationChanged:(nonnull NSNumber*) reactTag) {
51
- [self callNativeMethodWithReactTag: reactTag andBlock: ^void (RTNScanbotBarcodeCameraView* nativeView) {
52
- [nativeView orientationChanged];
53
- }];
54
- }
55
-
56
- - (void) callNativeMethodWithReactTag:(nonnull NSNumber*) reactTag andBlock:(NativeViewBlock)block {
57
- [self.bridge.uiManager addUIBlock:^(RCTUIManager *uiManager, NSDictionary<NSNumber *,UIView *> *viewRegistry) {
58
- RTNScanbotBarcodeCameraView* view = (RTNScanbotBarcodeCameraView*) viewRegistry[reactTag];
59
- if (!view || ![view isKindOfClass:[RTNScanbotBarcodeCameraView class]]) {
60
- RCTLogError(@"Cannot find native view with tag #%@", reactTag);
61
- return;
62
- }
63
- block(view);
64
- }];
65
- }
66
-
67
- @end
68
-
69
-
70
-
71
- #endif
@@ -1,36 +0,0 @@
1
- //
2
- // RNScanbotBarcodeCameraView.h
3
- // RNScanbotSDK
4
- //
5
- // Created by Marco Saia on 18.05.21.
6
- //
7
-
8
- // We use this compilation pragma to expose this implementation for the OLD ARCHITECTURE only
9
- #ifdef RCT_NEW_ARCH_ENABLED
10
- #else
11
-
12
- #ifndef RNScanbotCameraView_h
13
- #define RNScanbotCameraView_h
14
-
15
- #import <React/RCTComponent.h>
16
- #import <ScanbotBarcodeScannerSDK/ScanbotBarcodeScannerSDK.h>
17
-
18
- @interface RNScanbotBarcodeCameraView: UIView<SBSDKBarcodeScannerViewControllerDelegate>
19
-
20
- @property SBSDKBarcodeScannerViewController* _Nullable cameraViewController;
21
- @property (nonatomic, copy) RCTBubblingEventBlock _Nullable onNativeBarcodeScannerResult;
22
- @property (nonatomic, copy) RCTBubblingEventBlock _Nullable requestComponentReload;
23
-
24
- - (void) createCameraViewController;
25
- - (UIViewController* _Nullable) getParentViewController;
26
-
27
- - (void) componentDidMount;
28
- - (void) componentDidUpdate;
29
- - (void) componentWillUnmount;
30
- - (void) orientationChanged;
31
-
32
- @end
33
-
34
- #endif /* RNScanbotCameraView_h */
35
-
36
- #endif // ifdef RCT_NEW_ARCH_ENABLED
@@ -1,181 +0,0 @@
1
- //
2
- // RNScanbotCameraView.m
3
- // RNScanbotSDK
4
- //
5
- // Created by Marco Saia on 18.05.21.
6
- //
7
-
8
- // We use this compilation pragma to expose this implementation for the OLD ARCHITECTURE only
9
- #ifdef RCT_NEW_ARCH_ENABLED
10
- #else
11
-
12
- #import "RNScanbotBarcodeCameraView.h"
13
- #import <ScanbotBarcodeScannerSDK/ScanbotBarcodeScannerSDK.h>
14
- #import <Foundation/Foundation.h>
15
- #import <ScanbotBarcodeSDKWrapper/ScanbotBarcodeSDKWrapper-Swift.h>
16
-
17
- @interface RNScanbotBarcodeCameraView()
18
- @property(nonatomic, strong) SBSDKBarcodeScannerViewController* viewController;
19
- @property(nonatomic, strong) SBBWrapperBarcodeCameraViewConfiguration* mCameraViewConfiguration;
20
- @property(nonatomic) BOOL scanningEnabled;
21
- @end
22
-
23
- @implementation RNScanbotBarcodeCameraView
24
-
25
- - (instancetype)initWithFrame:(CGRect)frame {
26
- self = [super initWithFrame:frame];
27
- if (self) {
28
- _mCameraViewConfiguration = [[SBBWrapperBarcodeCameraViewConfiguration alloc] init];
29
- _scanningEnabled = true;
30
- }
31
- return self;
32
- }
33
-
34
- - (void)didMoveToWindow {
35
- [super didMoveToWindow];
36
- [self createCameraViewController];
37
- }
38
-
39
- - (void)createCameraViewController {
40
- UIViewController* parentViewController = [self getParentViewController];
41
- if (!parentViewController) {
42
- return;
43
- }
44
-
45
- if (!self.cameraViewController) {
46
- self.viewController = [[SBSDKBarcodeScannerViewController alloc] initWithParentViewController:parentViewController
47
- parentView:self
48
- delegate:self];
49
- self.cameraViewController = self.viewController;
50
-
51
- [self updateWithConfiguration];
52
- }
53
- }
54
-
55
- - (void)setConfiguration:(NSDictionary *)configuration {
56
- if (configuration == NULL) {
57
- return;
58
- }
59
-
60
- SBBWrapperBarcodeCameraViewConfiguration* cameraViewConfiguration = [SBBWrapperBarcodeCameraViewConfiguration fromDicitonary: configuration];
61
-
62
- if (cameraViewConfiguration == NULL) {
63
- return;
64
- }
65
-
66
- self.mCameraViewConfiguration = cameraViewConfiguration;
67
-
68
- if(self.viewController) {
69
- [self updateWithConfiguration];
70
- }
71
- }
72
-
73
- - (void)updateWithConfiguration {
74
-
75
- SBSDKBaseScannerViewFinderConfiguration *configuration = [[SBSDKBaseScannerViewFinderConfiguration alloc] init];
76
-
77
- configuration.lineWidth = self.mCameraViewConfiguration.finderLineWidth;
78
- configuration.lineColor = self.mCameraViewConfiguration.finderLineColorAsUIColor;
79
- configuration.backgroundColor = [self.mCameraViewConfiguration.finderBackgroundColorAsUIColor colorWithAlphaComponent:self.mCameraViewConfiguration.finderBackgroundOpacity];
80
- configuration.aspectRatio = [[SBSDKAspectRatio alloc] initWithWidth:self.mCameraViewConfiguration.finderAspectRatio.width andHeight:self.mCameraViewConfiguration.finderAspectRatio.height ];
81
-
82
- if (self.mCameraViewConfiguration.finderInset.insetsAreSet) {
83
- configuration.minimumInset = self.mCameraViewConfiguration.finderInset.insets;
84
- }
85
-
86
- configuration.viewFinderEnabled = self.mCameraViewConfiguration.shouldUseFinderView;
87
- self.viewController.viewFinderConfiguration = configuration;
88
-
89
- self.viewController.acceptedBarcodeTypes = self.mCameraViewConfiguration.acceptedBarcodeTypes;
90
- self.viewController.acceptedDocumentTypes = self.mCameraViewConfiguration.acceptedDocumentTypes;
91
-
92
- // Map Additional Parameters
93
- SBSDKBarcodeAdditionalParameters* additionalParameters = [[SBSDKBarcodeAdditionalParameters alloc] init];
94
-
95
- additionalParameters.gs1Handling = self.mCameraViewConfiguration.gs1Handling;
96
-
97
- if (self.mCameraViewConfiguration.maximumTextLength != -1) {
98
- additionalParameters.maximumTextLength = self.mCameraViewConfiguration.maximumTextLength;
99
- }
100
- if (self.mCameraViewConfiguration.minimumTextLength != -1) {
101
- additionalParameters.minimumTextLength = self.mCameraViewConfiguration.minimumTextLength;
102
- }
103
- if (self.mCameraViewConfiguration.minimum1DBarcodesQuietZone != -1) {
104
- additionalParameters.minimum1DBarcodesQuietZone = self.mCameraViewConfiguration.minimum1DBarcodesQuietZone;
105
- }
106
-
107
- additionalParameters.msiPlesseyChecksumAlgorithm = self.mCameraViewConfiguration.msiPlesseyChecksumAlgorithm;
108
-
109
- additionalParameters.stripCheckDigits =self.mCameraViewConfiguration.stripCheckDigits;
110
-
111
- additionalParameters.codeDensity = self.mCameraViewConfiguration.codeDensity;
112
-
113
- self.viewController.additionalDetectionParameters = additionalParameters;
114
-
115
- if (self.mCameraViewConfiguration.cameraZoomFactor != -1) {
116
- self.viewController.cameraZoomFactor = self.mCameraViewConfiguration.cameraZoomFactor;
117
- }
118
-
119
- self.viewController.engineMode = self.mCameraViewConfiguration.engineMode;
120
- self.viewController.flashLightEnabled = self.mCameraViewConfiguration.flashEnabled;
121
- self.viewController.extensionFilter = self.mCameraViewConfiguration.barcodesExtensionFilter;
122
-
123
- _scanningEnabled = self.mCameraViewConfiguration.scanningEnabled;
124
- }
125
-
126
-
127
- - (UIViewController* _Nullable)getParentViewController {
128
- UIResponder* parentResponder = self;
129
- while (parentResponder) {
130
- parentResponder = parentResponder.nextResponder;
131
- if (parentResponder && [parentResponder isKindOfClass:[UIViewController class]]) {
132
- return (UIViewController*) parentResponder;
133
- }
134
- }
135
- return NULL;
136
- }
137
-
138
- - (void)sendScanResults:(NSArray<SBSDKBarcodeScannerResult*>*) results {
139
- if(!self.onNativeBarcodeScannerResult) {
140
- return;
141
- }
142
-
143
- if(!results || results.count == 0) {
144
- return;
145
- }
146
-
147
- NSDictionary* _Nullable result = [SBBWrapperBarcodeScannerResult nativeResultsToDictionary:results];
148
-
149
- if(result != NULL) {
150
- self.onNativeBarcodeScannerResult(@{
151
- @"result": result
152
- });
153
- }
154
- }
155
-
156
- // MARK: - React Native Lifecycle
157
- - (void)componentDidMount {}
158
- - (void)componentDidUpdate {}
159
- - (void)componentWillUnmount {}
160
- - (void)orientationChanged {}
161
-
162
- // MARK: - SBSDKBarcodeScannerViewControllerDelegate
163
-
164
- - (void)barcodeScannerController:(SBSDKBarcodeScannerViewController *)controller
165
- didDetectBarcodes:(NSArray<SBSDKBarcodeScannerResult *> *)codes
166
- onImage:(nonnull UIImage *)image {
167
-
168
- [self sendScanResults:codes];
169
- }
170
-
171
- - (BOOL)barcodeScannerControllerShouldDetectBarcodes:(SBSDKBarcodeScannerViewController *)controller {
172
- return _scanningEnabled;
173
- }
174
-
175
- - (void)barcodeScannerController:(nonnull SBSDKBarcodeScannerViewController *)controller didDetectBarcodes:(nonnull NSArray<SBSDKBarcodeScannerResult *> *)codes {
176
- [self sendScanResults:codes];
177
- }
178
-
179
- @end
180
-
181
- #endif // ifdef RCT_NEW_ARCH_ENABLED
@@ -1,28 +0,0 @@
1
- //
2
- // RNScanbotBarcodeCameraViewManager.h
3
- // Pods
4
- //
5
- // Created by Marco Saia on 17.05.21.
6
- //
7
-
8
- // We use this compilation pragma to expose this implementation for the OLD ARCHITECTURE only
9
- #if defined(RCT_NEW_ARCH_ENABLED) && RCT_NEW_ARCH_ENABLED==1
10
- #else
11
-
12
- #ifndef RNScanbotClassicComponents_h
13
- #define RNScanbotClassicComponents_h
14
-
15
- #import <React/RCTViewManager.h>
16
- #import "RNScanbotBarcodeCameraView.h"
17
-
18
- typedef void (^NativeViewBlock)(RNScanbotBarcodeCameraView* _Nonnull);
19
-
20
- @interface RNScanbotBarcodeCameraViewManager: RCTViewManager
21
-
22
- - (void) callNativeMethodWithReactTag:(nonnull NSNumber*) reactTag andBlock:(nonnull NativeViewBlock)block;
23
-
24
- @end
25
-
26
- #endif /* RNScanbotClassicComponents_h */
27
-
28
- #endif // ifdef RCT_NEW_ARCH_ENABLED
@@ -1,89 +0,0 @@
1
- //
2
- // RNScanbotBarcodeCameraViewManager.m
3
- // RNScanbotSDK
4
- //
5
- // Created by Marco Saia on 17.05.21.
6
- //
7
-
8
- // We use this compilation pragma to expose this implementation for the OLD ARCHITECTURE only
9
- #if defined(RCT_NEW_ARCH_ENABLED) && RCT_NEW_ARCH_ENABLED==1
10
- #else
11
-
12
- #import <Foundation/Foundation.h>
13
- #import "RNScanbotBarcodeCameraViewManager.h"
14
- #import "RNScanbotBarcodeCameraView.h"
15
- #import <React/RCTViewManager.h>
16
- #import <React/RCTUIManager.h>
17
-
18
- #import <React/RCTDefines.h>
19
- #import <React/RCTJSThread.h>
20
- #import <React/RCTBundleManager.h>
21
-
22
- #import <UIKit/UIKit.h>
23
- #import <ScanbotBarcodeScannerSDK/ScanbotBarcodeScannerSDK.h>
24
-
25
- RCT_EXTERN void RCTRegisterModule(Class);
26
-
27
- @implementation RNScanbotBarcodeCameraViewManager
28
-
29
- RCT_EXPORT_VIEW_PROPERTY(onNativeBarcodeScannerResult, RCTBubblingEventBlock)
30
- RCT_EXPORT_VIEW_PROPERTY(requestComponentReload, RCTBubblingEventBlock)
31
- RCT_EXPORT_VIEW_PROPERTY(configuration, NSDictionary*)
32
-
33
- - (UIView *) view
34
- {
35
- return [[RNScanbotBarcodeCameraView alloc] init];
36
- }
37
-
38
- + (NSString *)moduleName {
39
- return @"RTNScanbotBarcodeCameraView";
40
- }
41
-
42
- + (void)load {
43
- RCTRegisterModule(self);
44
- }
45
-
46
-
47
- // componentDidMount
48
- RCT_EXPORT_METHOD(componentDidMount:(nonnull NSNumber*) reactTag) {
49
- [self callNativeMethodWithReactTag: reactTag andBlock: ^void (RNScanbotBarcodeCameraView* nativeView) {
50
- [nativeView componentDidMount];
51
- }];
52
- }
53
-
54
- // componentDidUpdate
55
- RCT_EXPORT_METHOD(componentDidUpdate:(nonnull NSNumber*) reactTag) {
56
- [self callNativeMethodWithReactTag: reactTag andBlock: ^void (RNScanbotBarcodeCameraView* nativeView) {
57
- [nativeView componentDidUpdate];
58
- }];
59
- }
60
-
61
- // componentWillUnmount
62
- RCT_EXPORT_METHOD(componentWillUnmount:(nonnull NSNumber*) reactTag) {
63
- [self callNativeMethodWithReactTag: reactTag andBlock: ^void (RNScanbotBarcodeCameraView* nativeView) {
64
- [nativeView componentWillUnmount];
65
- }];
66
- }
67
-
68
- // orientationChanged
69
- RCT_EXPORT_METHOD(orientationChanged:(nonnull NSNumber*) reactTag) {
70
- [self callNativeMethodWithReactTag: reactTag andBlock: ^void (RNScanbotBarcodeCameraView* nativeView) {
71
- [nativeView orientationChanged];
72
- }];
73
- }
74
-
75
-
76
- - (void) callNativeMethodWithReactTag:(nonnull NSNumber*) reactTag andBlock:(NativeViewBlock)block {
77
- [self.bridge.uiManager addUIBlock:^(RCTUIManager *uiManager, NSDictionary<NSNumber *,UIView *> *viewRegistry) {
78
- RNScanbotBarcodeCameraView* view = (RNScanbotBarcodeCameraView*) viewRegistry[reactTag];
79
- if (!view || ![view isKindOfClass:[RNScanbotBarcodeCameraView class]]) {
80
- RCTLogError(@"Cannot find native view with tag #%@", reactTag);
81
- return;
82
- }
83
- block(view);
84
- }];
85
- }
86
-
87
- @end
88
-
89
- #endif // ifdef RCT_NEW_ARCH_ENABLED
@@ -1,186 +0,0 @@
1
- import { ComponentType } from 'react';
2
- import type {HostComponent, ViewProps} from 'react-native';
3
- import { BubblingEventHandler, DirectEventHandler, Float, Int32 } from 'react-native/Libraries/Types/CodegenTypes';
4
- import codegenNativeCommands from 'react-native/Libraries/Utilities/codegenNativeCommands';
5
- import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
6
-
7
- export interface NativeProps extends ViewProps {
8
- configuration?: ScanbotBarcodeCameraViewConfiguration;
9
- // Lifecycle methods
10
- onComponentDidUpdate: DirectEventHandler<Readonly<{}>>;
11
- onComponentDidMount: DirectEventHandler<Readonly<{}>>;
12
- onComponentWillUnmount: DirectEventHandler<Readonly<{}>>;
13
- onOrientationChanged: DirectEventHandler<Readonly<{}>>;
14
- onNativeBarcodeScannerResult: BubblingEventHandler<Readonly<{jsonResult: string}>>;
15
- }
16
-
17
- export default codegenNativeComponent<NativeProps>(
18
- 'RTNScanbotBarcodeCameraView',
19
- ) as HostComponent<NativeProps>;
20
-
21
- interface NativeCommands {
22
- componentDidUpdate: (viewRef: React.ElementRef<ComponentType>) => void;
23
- componentDidMount: (viewRef: React.ElementRef<ComponentType>) => void;
24
- componentWillUnmount: (viewRef: React.ElementRef<ComponentType>) => void;
25
- orientationChanged: (viewRef: React.ElementRef<ComponentType>) => void;
26
- }
27
- // Execute codegeNativeCommands function with proper supportedCommands
28
- // as shown below and export it
29
- export const Commands: NativeCommands = codegenNativeCommands<NativeCommands>({
30
- supportedCommands: ['componentDidUpdate', 'componentDidMount', 'componentWillUnmount', 'orientationChanged'],
31
- });
32
-
33
- /**
34
- * This class contians all the configurations needed for Scanbot Barcode Camera View.
35
- */
36
- export interface ScanbotBarcodeCameraViewConfiguration extends FinderConfig, BarcodeAdditionalParameters {
37
- /**
38
- * Whether flash is toggled on or off.
39
- */
40
- flashEnabled?: boolean;
41
- /**
42
- * List of accepted Barcode Formats; any formats that are not included in this
43
- * list will not be detected by the `BarcodeCameraView`. By default, the list
44
- * includes all supported barcode types.
45
- */
46
- barcodeFormats?: string[]; // TODO: Should be BarcodeFormat[]
47
- /**
48
- * An optional array of barcode document formats that acts as a detection filter.
49
- * By default all supported document formats will be detected.
50
- */
51
- acceptedDocumentFormats?: string[]; // TODO: Should be BarcodeDocumentFormat[]
52
- /**
53
- * The engine mode of the barcode recognizer. Defaults to NEXT_GEN.
54
- * To use legacy recognizer, please specify LEGACY
55
- */
56
- engineMode?: string; // TODO: Should be EngineMode
57
- /**
58
- * The relative initial zoom level of the camera in the range [0,1], where 0 is zoomed out and 1 is zoomed in.
59
- * The default value is 0.-
60
- */
61
- cameraZoomFactor?: Float;
62
- /**
63
- * Use a filter to determine which type of barcode can be detected; see `BarcodesExtensionFilter`
64
- */
65
- barcodesExtensionFilter?: string; // TODO: Should be BarcodesExtensionFilter
66
- /**
67
- * Enable or disable barcode detection. If disabled, the camera preview is active but no barcodes will be detected.
68
- * Default is enabled.
69
- */
70
- scanningEnabled?: boolean;
71
- }
72
-
73
- /**
74
- * An interface that contains additional parameters for barcodes detection and filtering.
75
- */
76
- export interface BarcodeAdditionalParameters {
77
- /**
78
- * If `true`, enables the mode which slightly decreases the scanning quality and the energy consumption, thus increasing the scanning speed.
79
- * The default is `false`.
80
- * Android only.
81
- */
82
- lowPowerMode?: boolean;
83
- /**
84
- * Optional minimum required text length of the detected barcode.
85
- * The default is 0 (setting is turned off).
86
- * NOTE: This feature works on ITF and MSI Plessey barcodes only.
87
- */
88
- minimumTextLength?: Int32;
89
- /**
90
- * Optional maximum required text length of the detected barcode.
91
- * The default is 0 (setting is turned off).
92
- * NOTE: This feature works on ITF and MSI Plessey barcodes only.
93
- */
94
- maximumTextLength?: Int32;
95
- /**
96
- * Optional minimum required quiet zone on the barcode.
97
- * Measured in modules (the size of narrowest bar in the barcode).
98
- * The default is 10.
99
- * NOTE: This feature works on ITF and MSI Plessey barcodes only.
100
- */
101
- minimum1DBarcodesQuietZone?: Int32;
102
- /**
103
- * With this option enabled, the scanner removes check digits for UPC, EAN and MSI Plessey codes.
104
- * Has no effect if both single and double digit MSI Plessey checksums are enabled.
105
- * The default is `false`.
106
- */
107
- stripCheckDigits?: boolean;
108
- /** The GS1 handling mode. The default value is PARSE. */
109
- gs1HandlingMode?: string; // TODO: Should be Gs1HandlingMode;
110
- /**
111
- * The checksum algorithm for MSI Plessey barcodes.
112
- * The default value is [MSIPlesseyChecksumAlgorithm.Mod10].
113
- */
114
- msiPlesseyChecksumAlgorithm?: string; // TODO: Should be MSIPlesseyChecksumAlgorithm
115
- /**
116
- * Low density. Finds up to 6 QR codes in one image or video frame. This is the default value.
117
- * High density. Finds up to 24 QR codes in one image or video frame.
118
- */
119
- codeDensity?: string; // TODO: Should be CodeDensity
120
- }
121
-
122
- /**
123
- * This class contains all the finder configurations.
124
- */
125
- export interface FinderConfig {
126
-
127
- /**
128
- * The finder view is a rectangular overlay view that clips the camera view,
129
- * so that the detection will focus just a specific area. You can specify
130
- * the size and positioning, as well as other UI properties.
131
- * Set this property to `true` if you want to use the Finder View, `false` otherwise (default: false)
132
- */
133
- shouldUseFinderView?: boolean;
134
- /**
135
- * The finder view rectangular overlay border width
136
- */
137
- finderLineWidth?: Int32;
138
- /**
139
- * The finder view rectangular overlay border color
140
- */
141
- finderLineColor?: string;
142
- /**
143
- * The overlay background color, around the finder view rectangle
144
- */
145
- finderBackgroundColor?: string;
146
- /**
147
- * The overlay background color opacity, around the finder view rectangle
148
- */
149
- finderBackgroundOpacity?: Float;
150
- /**
151
- * The finder view rectangle aspect ratio
152
- */
153
- finderAspectRatio?: AspectRatio;
154
- /**
155
- * Set the finderInsets left, top, bottom, right
156
- */
157
- finderInset?: FinderInset
158
- }
159
-
160
- /**
161
- * This class contains properties to Set the finder insets for the finder view.
162
- */
163
- export interface FinderInset {
164
-
165
- /**
166
- * Set the left inset
167
- */
168
- left: Float;
169
- /**
170
- * Set the top inset
171
- */
172
- top: Float;
173
- /**
174
- * Set the bottom inset
175
- */
176
- bottom: Float;
177
- /**
178
- * Set the right inset
179
- */
180
- right: Float;
181
- }
182
-
183
- export interface AspectRatio {
184
- width: Int32;
185
- height: Int32;
186
- }