@momo-kits/camerakit 0.0.61-beta.1 → 0.0.61-beta.2

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 (2) hide show
  1. package/CameraKit.js +7 -13
  2. package/package.json +3 -3
package/CameraKit.js CHANGED
@@ -34,14 +34,12 @@ class CameraKit extends React.Component {
34
34
  };
35
35
 
36
36
  async capture(options) {
37
+ const { onImageCaptured } = this.props;
37
38
  try {
38
39
  const data = await this.camera?.capture(options);
39
- const { onImageCaptured } = this.props;
40
- if (typeof onImageCaptured === 'function') {
41
- onImageCaptured({ ...data, url: data.uri });
42
- }
40
+ onImageCaptured?.({ ...data, url: data.uri });
43
41
  } catch (e) {
44
- console.warn(e);
42
+ onImageCaptured?.({ error: e.message });
45
43
  }
46
44
  }
47
45
 
@@ -52,18 +50,14 @@ class CameraKit extends React.Component {
52
50
  return;
53
51
  }
54
52
  const { onBarCodeRead } = this.props;
55
- if (typeof onBarCodeRead === 'function') {
56
- onBarCodeRead({ data: nativeEvent?.codeStringValue });
57
- this.lastEvent = value;
58
- this.lastEventTime = new Date();
59
- }
53
+ onBarCodeRead?.({ data: nativeEvent?.codeStringValue });
54
+ this.lastEvent = value;
55
+ this.lastEventTime = new Date();
60
56
  };
61
57
 
62
58
  onOpenCamera = ({ nativeEvent }) => {
63
59
  const { onOpenCamera } = this.props;
64
- if (typeof onOpenCamera === 'function') {
65
- onOpenCamera(nativeEvent);
66
- }
60
+ onOpenCamera?.(nativeEvent);
67
61
  };
68
62
 
69
63
  render() {
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@momo-kits/camerakit",
3
- "version": "0.0.61-beta.1",
3
+ "version": "0.0.61-beta.2",
4
4
  "private": false,
5
5
  "main": "index.js",
6
6
  "dependencies": {
7
- "camerakit": "git+https://gitlab.mservice.com.vn/momo-platform/react-native-camera-kit.git#v1.4"
7
+ "camerakit": "git+https://gitlab.mservice.com.vn/momo-platform/react-native-camera-kit.git#v1.6"
8
8
  },
9
9
  "peerDependencies": {
10
10
  "react": "16.9.0",
@@ -12,4 +12,4 @@
12
12
  },
13
13
  "devDependencies": {},
14
14
  "license": "MoMo"
15
- }
15
+ }