dynamsoft-capture-vision-react-native 1.1.0 → 1.1.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.
@@ -16,8 +16,8 @@
16
16
  package com.dynamsoft.reactlibrary;
17
17
 
18
18
  public interface Constants {
19
- int TORCH_ON = 0;
20
- int TORCH_OFF = 1;
19
+ int TORCH_OFF = 0;
20
+ int TORCH_ON = 1;
21
21
  // int FLASH_TORCH = 2;
22
22
  // int FLASH_AUTO = 3;
23
23
  }
@@ -31,12 +31,15 @@ public class RNDCECameraViewManager extends ViewGroupManager<RNDCECameraView> {
31
31
 
32
32
  ReactApplicationContext mReactApplicationContext;
33
33
  CameraEnhancer mCamera;
34
-
34
+ RNDynamsoftBarcodeReaderModule mDbrModule;
35
35
 
36
36
  public RNDCECameraViewManager(ReactApplicationContext reactContext, RNDynamsoftBarcodeReaderModule dbrModule) {
37
37
  mReactApplicationContext = reactContext;
38
- mCamera = new CameraEnhancer(dbrModule.getActivity());
39
- dbrModule.mCamera = mCamera;
38
+ mDbrModule = dbrModule;
39
+ if (dbrModule.getActivity() != null) {
40
+ mCamera = new CameraEnhancer(dbrModule.getActivity());
41
+ dbrModule.mCamera = mCamera;
42
+ }
40
43
  }
41
44
 
42
45
  private static final String REACT_CLASS = "DYSCameraView";
@@ -48,6 +51,10 @@ public class RNDCECameraViewManager extends ViewGroupManager<RNDCECameraView> {
48
51
 
49
52
  @Override
50
53
  protected RNDCECameraView createViewInstance(ThemedReactContext reactContext) {
54
+ if (mCamera == null) {
55
+ mCamera = new CameraEnhancer(mDbrModule.getActivity());
56
+ mDbrModule.mCamera = mCamera;
57
+ }
51
58
  return new RNDCECameraView(reactContext, mReactApplicationContext, mCamera);
52
59
  }
53
60
 
@@ -81,11 +88,11 @@ public class RNDCECameraViewManager extends ViewGroupManager<RNDCECameraView> {
81
88
  if (location != null) {
82
89
  int x = (location.hasKey("x") && !location.isNull("x")) ? location.getInt("x") : 25;
83
90
  int y = (location.hasKey("y") && !location.isNull("y")) ? location.getInt("y") : 100;
84
- startPoint = new Point(x,y);
91
+ startPoint = new Point(x, y);
85
92
  width = (location.hasKey("width") && !location.isNull("width")) ? location.getInt("width") : 45;
86
93
  height = (location.hasKey("height") && !location.isNull("height")) ? location.getInt("height") : 45;
87
94
  } else {
88
- //Default location. Unit is dp.
95
+ // Default location. Unit is dp.
89
96
  startPoint = new Point(25, 100);
90
97
  width = 45;
91
98
  height = 45;
@@ -132,13 +139,6 @@ public class RNDCECameraViewManager extends ViewGroupManager<RNDCECameraView> {
132
139
  }
133
140
  }
134
141
 
135
- // @Nullable
136
- // @Override
137
- // public Map<String, Object> getExportedViewConstants() {
138
- // return super.getExportedViewConstants();
139
- // }
140
-
141
-
142
142
  @ReactProp(name = "scanRegionVisible")
143
143
  public void setScanRegionVisible(RNDCECameraView view, boolean isVisible) {
144
144
  mCamera.setScanRegionVisible(isVisible);
@@ -44,9 +44,9 @@
44
44
  }
45
45
 
46
46
  - (void)setTorchState:(int)torchState{
47
- if (torchState == 0) {
47
+ if (torchState == 1) {
48
48
  [[StaticClass instance].dce turnOnTorch];
49
- }else if (torchState == 1){
49
+ }else if (torchState == 0){
50
50
  [[StaticClass instance].dce turnOffTorch];
51
51
  }
52
52
  }
@@ -33,16 +33,6 @@ RCT_EXPORT_MODULE(DYSCameraView)
33
33
  return [[DYSCameraView alloc] init];
34
34
  }
35
35
 
36
- - (NSDictionary *)constantsToExport
37
- {
38
- return @{
39
- @"TorchState": @{
40
- @"off": @1,
41
- @"on": @0
42
- },
43
- };
44
- }
45
-
46
36
  RCT_EXPORT_VIEW_PROPERTY(scanRegionVisible, BOOL)
47
37
  RCT_EXPORT_VIEW_PROPERTY(overlayVisible, BOOL)
48
38
  RCT_EXPORT_VIEW_PROPERTY(torchState, int)
@@ -32,6 +32,16 @@
32
32
  return YES;
33
33
  }
34
34
 
35
+ - (NSDictionary *)constantsToExport
36
+ {
37
+ return @{
38
+ @"TorchState": @{
39
+ @"off": @0,
40
+ @"on": @1
41
+ },
42
+ };
43
+ }
44
+
35
45
  - (NSArray<NSString *> *)supportedEvents
36
46
  {
37
47
  return @[@"resultEvent"];
@@ -6,6 +6,6 @@ export interface TorchButton {
6
6
  torchOffImageBase64: string;
7
7
  }
8
8
  export declare enum EnumTorchState {
9
- ON = 0,
10
- OFF = 1
9
+ OFF = 0,
10
+ ON = 1
11
11
  }
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.EnumTorchState = void 0;
4
4
  var EnumTorchState;
5
5
  (function (EnumTorchState) {
6
- EnumTorchState[EnumTorchState["ON"] = 0] = "ON";
7
- EnumTorchState[EnumTorchState["OFF"] = 1] = "OFF";
6
+ EnumTorchState[EnumTorchState["OFF"] = 0] = "OFF";
7
+ EnumTorchState[EnumTorchState["ON"] = 1] = "ON";
8
8
  })(EnumTorchState = exports.EnumTorchState || (exports.EnumTorchState = {}));
9
9
  //# sourceMappingURL=CameraSettings.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dynamsoft-capture-vision-react-native",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "description": "Dynamsoft Capture Vision React Native SDK",
5
5
  "homepage": "https://www.dynamsoft.com/capture-vision/docs/introduction",
6
6
  "main": "./js/index.js",