dynamsoft-capture-vision-react-native 1.0.0 → 1.1.0
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.
- package/README.md +91 -60
- package/android/build.gradle +2 -2
- package/android/src/main/java/com/dynamsoft/reactlibrary/Constants.java +23 -0
- package/android/src/main/java/com/dynamsoft/reactlibrary/RNDCECameraView.java +5 -26
- package/android/src/main/java/com/dynamsoft/reactlibrary/RNDCECameraViewManager.java +94 -42
- package/android/src/main/java/com/dynamsoft/reactlibrary/RNDynamsoftBarcodeReaderModule.java +32 -3
- package/android/src/main/java/com/dynamsoft/reactlibrary/RNDynamsoftCaptrueVisionPackage.java +13 -2
- package/dynamsoft-capture-vision-react-native.podspec +2 -2
- package/ios/RNDynamsoftCaptureVision/DYSCameraView.h +30 -26
- package/ios/RNDynamsoftCaptureVision/DYSCameraView.m +113 -71
- package/ios/RNDynamsoftCaptureVision/DYSCameraViewManager.h +17 -17
- package/ios/RNDynamsoftCaptureVision/DYSCameraViewManager.m +89 -77
- package/ios/RNDynamsoftCaptureVision/RCTDynamsoftBarcodeReader.h +14 -14
- package/ios/RNDynamsoftCaptureVision/RCTDynamsoftBarcodeReader.m +223 -223
- package/ios/RNDynamsoftCaptureVision/StaticClass.h +26 -26
- package/ios/RNDynamsoftCaptureVision/StaticClass.m +21 -21
- package/js/BarcodeResult.d.ts +25 -0
- package/js/BarcodeResult.js +3 -0
- package/js/BarcodeSettings.d.ts +52 -100
- package/js/BarcodeSettings.js +55 -56
- package/js/BasicStructures.d.ts +20 -0
- package/js/BasicStructures.js +3 -0
- package/js/CameraSettings.d.ts +11 -0
- package/js/CameraSettings.js +9 -0
- package/js/DynamsoftBarcodeReader.d.ts +4 -3
- package/js/DynamsoftBarcodeReader.js +60 -59
- package/js/DynamsoftCameraView.d.ts +31 -7
- package/js/DynamsoftCameraView.js +90 -83
- package/js/index.d.ts +3 -0
- package/js/index.js +23 -3
- package/package.json +8 -1
|
@@ -1,107 +1,114 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
StyleSheet,
|
|
8
|
-
Platform, UIManager
|
|
9
|
-
} from 'react-native';
|
|
10
|
-
|
|
11
|
-
const propTypes = {
|
|
12
|
-
name: 'DYSCameraView',
|
|
13
|
-
propTypes: {
|
|
14
|
-
scanRegionVisible: PropTypes.bool,
|
|
15
|
-
overlayVisible: PropTypes.bool,
|
|
16
|
-
scanRegion: PropTypes.shape({
|
|
17
|
-
regionLeft: PropTypes.number,
|
|
18
|
-
regionRight: PropTypes.number,
|
|
19
|
-
regionTop: PropTypes.number,
|
|
20
|
-
regionBottom: PropTypes.number,
|
|
21
|
-
regionMeasuredByPercentage: PropTypes.bool
|
|
22
|
-
}),
|
|
23
|
-
...View.propTypes
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
24
7
|
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
25
24
|
};
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
this.open()
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
componentWillUnmount(){
|
|
39
|
-
if(Platform.OS === 'ios') {
|
|
40
|
-
this.close()
|
|
25
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
26
|
+
var t = {};
|
|
27
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
28
|
+
t[p] = s[p];
|
|
29
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
30
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
31
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
32
|
+
t[p[i]] = s[p[i]];
|
|
41
33
|
}
|
|
34
|
+
return t;
|
|
35
|
+
};
|
|
36
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
|
+
exports.DynamsoftCameraView = void 0;
|
|
38
|
+
const React = __importStar(require("react"));
|
|
39
|
+
const react_native_1 = require("react-native");
|
|
40
|
+
const DBRModule = react_native_1.NativeModules.RNDynamsoftBarcodeReader;
|
|
41
|
+
const DCEView = (0, react_native_1.requireNativeComponent)('DYSCameraView');
|
|
42
|
+
const mapValues = (input, mapper) => {
|
|
43
|
+
const result = {};
|
|
44
|
+
Object.entries(input).map(([key, value]) => {
|
|
45
|
+
result[key] = mapper(value, key);
|
|
46
|
+
});
|
|
47
|
+
return result;
|
|
48
|
+
};
|
|
49
|
+
class DynamsoftCameraView extends React.Component {
|
|
50
|
+
constructor(props) {
|
|
51
|
+
super(props);
|
|
42
52
|
}
|
|
43
|
-
|
|
44
|
-
renderChildren = () => {
|
|
45
|
-
return this.props.children
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
render() {
|
|
49
|
-
return (
|
|
50
|
-
<View style={this.props.style}>
|
|
51
|
-
<ReactDCEView
|
|
52
|
-
style={StyleSheet.absoluteFill}
|
|
53
|
-
ref={(ref) => {
|
|
54
|
-
this.references = ref
|
|
55
|
-
}}
|
|
56
|
-
overlayVisible={this.props.overlayVisible}
|
|
57
|
-
scanRegionVisible={this.props.scanRegionVisible}
|
|
58
|
-
scanRegion={this.props.scanRegion}
|
|
59
|
-
/>
|
|
60
|
-
{this.renderChildren()}
|
|
61
|
-
</View>
|
|
62
|
-
);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
53
|
open() {
|
|
66
54
|
this.dispatcher.open();
|
|
67
55
|
}
|
|
68
|
-
|
|
69
56
|
close() {
|
|
70
57
|
this.dispatcher.close();
|
|
71
58
|
}
|
|
72
|
-
|
|
59
|
+
componentDidMount() {
|
|
60
|
+
this.dispatcher = new CommandDispatcher((0, react_native_1.findNodeHandle)(this.references));
|
|
61
|
+
if (react_native_1.Platform.OS === 'ios') {
|
|
62
|
+
this.open();
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
componentWillUnmount() {
|
|
66
|
+
if (react_native_1.Platform.OS === 'ios') {
|
|
67
|
+
this.close();
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
convertNativeProps(_a) {
|
|
71
|
+
var { children } = _a, props = __rest(_a, ["children"]);
|
|
72
|
+
const newProps = mapValues(props, this.convertProp);
|
|
73
|
+
return newProps;
|
|
74
|
+
}
|
|
75
|
+
convertProp(value, key) {
|
|
76
|
+
if (typeof value === 'string' && DynamsoftCameraView.ConversionTables[key]) {
|
|
77
|
+
return DynamsoftCameraView.ConversionTables[key][value];
|
|
78
|
+
}
|
|
79
|
+
return value;
|
|
80
|
+
}
|
|
81
|
+
render() {
|
|
82
|
+
const _a = this.convertNativeProps(this.props), { style } = _a, nativeProps = __rest(_a, ["style"]);
|
|
83
|
+
return (React.createElement(react_native_1.View, { style: style },
|
|
84
|
+
React.createElement(DCEView, Object.assign({ style: react_native_1.StyleSheet.absoluteFill, ref: (ref) => { this.references = ref; } }, nativeProps)),
|
|
85
|
+
this.props.children));
|
|
86
|
+
}
|
|
73
87
|
}
|
|
74
|
-
|
|
88
|
+
exports.DynamsoftCameraView = DynamsoftCameraView;
|
|
89
|
+
DynamsoftCameraView.ConversionTables = {
|
|
90
|
+
torchState: DBRModule.TorchState
|
|
91
|
+
};
|
|
75
92
|
class CommandDispatcher {
|
|
76
|
-
dceViewHandle;
|
|
77
|
-
|
|
78
93
|
constructor(viewHandle) {
|
|
79
94
|
//console.log(viewHandle)
|
|
80
95
|
this.dceViewHandle = viewHandle;
|
|
81
96
|
}
|
|
82
|
-
|
|
83
97
|
getViewManagerConfig(viewManagerConfig) {
|
|
84
|
-
if (UIManager.getViewManagerConfig) {
|
|
85
|
-
return UIManager.getViewManagerConfig(viewManagerConfig);
|
|
86
|
-
}
|
|
87
|
-
|
|
98
|
+
if (react_native_1.UIManager.getViewManagerConfig) {
|
|
99
|
+
return react_native_1.UIManager.getViewManagerConfig(viewManagerConfig);
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
return react_native_1.UIManager[viewManagerConfig];
|
|
88
103
|
}
|
|
89
104
|
}
|
|
90
|
-
|
|
91
105
|
open() {
|
|
92
|
-
|
|
93
|
-
this.dceViewHandle,
|
|
94
|
-
|
|
95
|
-
null);
|
|
106
|
+
if (this.getViewManagerConfig('DYSCameraView')) {
|
|
107
|
+
react_native_1.UIManager.dispatchViewManagerCommand(this.dceViewHandle, this.getViewManagerConfig('DYSCameraView').Commands.open, undefined);
|
|
108
|
+
}
|
|
96
109
|
}
|
|
97
|
-
|
|
98
110
|
close() {
|
|
99
|
-
UIManager.dispatchViewManagerCommand(
|
|
100
|
-
this.dceViewHandle,
|
|
101
|
-
this.getViewManagerConfig('DYSCameraView').Commands.close,
|
|
102
|
-
null);
|
|
111
|
+
react_native_1.UIManager.dispatchViewManagerCommand(this.dceViewHandle, this.getViewManagerConfig('DYSCameraView').Commands.close, undefined);
|
|
103
112
|
}
|
|
104
|
-
|
|
105
113
|
}
|
|
106
|
-
|
|
107
|
-
|
|
114
|
+
//# sourceMappingURL=DynamsoftCameraView.js.map
|
package/js/index.d.ts
CHANGED
package/js/index.js
CHANGED
|
@@ -1,3 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./CameraSettings"), exports);
|
|
18
|
+
__exportStar(require("./BarcodeSettings"), exports);
|
|
19
|
+
__exportStar(require("./DynamsoftBarcodeReader"), exports);
|
|
20
|
+
__exportStar(require("./DynamsoftCameraView"), exports);
|
|
21
|
+
__exportStar(require("./BarcodeResult"), exports);
|
|
22
|
+
__exportStar(require("./BasicStructures"), exports);
|
|
23
|
+
//# sourceMappingURL=index.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dynamsoft-capture-vision-react-native",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.0",
|
|
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",
|
|
@@ -27,5 +27,12 @@
|
|
|
27
27
|
"name": "Dynamsoft",
|
|
28
28
|
"url": "https://www.dynamsoft.com",
|
|
29
29
|
"email": "support@dynamsoft.com"
|
|
30
|
+
},
|
|
31
|
+
"devDependencies": {
|
|
32
|
+
"@types/jest": "^28.1.3",
|
|
33
|
+
"@types/react": "^18.0.14",
|
|
34
|
+
"@types/react-native": "^0.68.0",
|
|
35
|
+
"@types/react-test-renderer": "^18.0.0",
|
|
36
|
+
"typescript": "^4.7.4"
|
|
30
37
|
}
|
|
31
38
|
}
|