@getyoti/react-native-yoti-face-capture 3.0.0 → 4.0.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.
Files changed (35) hide show
  1. package/README.md +4 -4
  2. package/android/build.gradle +34 -30
  3. package/android/gradle/wrapper/gradle-wrapper.properties +1 -1
  4. package/android/src/main/java/com/yoti/reactnative/facecapture/YotiFaceCaptureEvent.java +34 -0
  5. package/android/src/main/java/com/yoti/reactnative/facecapture/YotiFaceCaptureModule.java +55 -56
  6. package/android/src/main/java/com/yoti/reactnative/facecapture/YotiFaceCapturePackage.java +5 -2
  7. package/android/src/main/java/com/yoti/reactnative/facecapture/YotiFaceCaptureView.java +129 -73
  8. package/android/src/main/java/com/yoti/reactnative/facecapture/YotiFaceCaptureViewManager.java +10 -1
  9. package/android/src/main/res/layout/yotifacecapture.xml +3 -9
  10. package/lib/commonjs/RNYotiCapture.android.js +63 -94
  11. package/lib/commonjs/RNYotiCapture.android.js.map +1 -1
  12. package/lib/commonjs/RNYotiCapture.ios.js +77 -84
  13. package/lib/commonjs/RNYotiCapture.ios.js.map +1 -1
  14. package/lib/commonjs/RNYotiCaptureTypes.js +9 -17
  15. package/lib/commonjs/RNYotiCaptureTypes.js.map +1 -1
  16. package/lib/commonjs/index.js +21 -6
  17. package/lib/commonjs/index.js.map +1 -1
  18. package/lib/module/RNYotiCapture.android.js +62 -85
  19. package/lib/module/RNYotiCapture.android.js.map +1 -1
  20. package/lib/module/RNYotiCapture.ios.js +76 -75
  21. package/lib/module/RNYotiCapture.ios.js.map +1 -1
  22. package/lib/module/RNYotiCaptureTypes.js +5 -7
  23. package/lib/module/RNYotiCaptureTypes.js.map +1 -1
  24. package/lib/module/index.js +1 -0
  25. package/lib/module/index.js.map +1 -1
  26. package/lib/typescript/RNYotiCapture.android.d.ts +7 -46
  27. package/lib/typescript/RNYotiCapture.ios.d.ts +7 -9
  28. package/lib/typescript/RNYotiCaptureTypes.d.ts +6 -6
  29. package/lib/typescript/index.d.ts +1 -0
  30. package/package.json +6 -8
  31. package/react-native-yoti-face-capture.podspec +1 -1
  32. package/src/RNYotiCapture.android.tsx +128 -115
  33. package/src/RNYotiCapture.ios.tsx +107 -80
  34. package/src/index.tsx +6 -0
  35. package/CHANGELOG.md +0 -29
@@ -8,7 +8,7 @@ export declare enum IMAGE_QUALITY {
8
8
  IMAGE_QUALITY_MEDIUM = 1,
9
9
  IMAGE_QUALITY_LOW = 2
10
10
  }
11
- export declare type FaceCaptureResult = {
11
+ export type FaceCaptureResult = {
12
12
  croppedImage: string;
13
13
  croppedFaceBoundingBox: {
14
14
  x: number;
@@ -24,14 +24,14 @@ export declare type FaceCaptureResult = {
24
24
  };
25
25
  originalImage: string;
26
26
  };
27
- export declare type ANALYSIS_FAILURE_CAUSE = 'FaceCaptureAnalysisErrorFaceTooBig' | 'FaceCaptureAnalysisErrorEyesNotOpen' | 'FaceCaptureAnalysisErrorFaceTooSmall' | 'FaceCaptureAnalysisErrorFaceNotStable' | 'FaceCaptureAnalysisErrorNoFaceDetected' | 'FaceCaptureAnalysisErrorFaceNotCentered' | 'FaceCaptureAnalysisErrorFaceNotStraight' | 'FaceCaptureAnalysisErrorEnvironmentTooDark' | 'FaceCaptureAnalysisErrorFaceAnalysisFailed' | 'FaceCaptureAnalysisErrorMultipleFaces';
28
- export declare type FaceCaptureAnalysisFailure = {
27
+ export type ANALYSIS_FAILURE_CAUSE = 'FaceCaptureAnalysisErrorFaceTooBig' | 'FaceCaptureAnalysisErrorEyesNotOpen' | 'FaceCaptureAnalysisErrorFaceTooSmall' | 'FaceCaptureAnalysisErrorFaceNotStable' | 'FaceCaptureAnalysisErrorNoFaceDetected' | 'FaceCaptureAnalysisErrorFaceNotCentered' | 'FaceCaptureAnalysisErrorFaceNotStraight' | 'FaceCaptureAnalysisErrorEnvironmentTooDark' | 'FaceCaptureAnalysisErrorFaceAnalysisFailed' | 'FaceCaptureAnalysisErrorMultipleFaces';
28
+ export type FaceCaptureAnalysisFailure = {
29
29
  cause: ANALYSIS_FAILURE_CAUSE;
30
30
  originalImage: string;
31
31
  };
32
- export declare type FaceCaptureSuccessState = 'FaceCaptureStateAnalyzing' | 'FaceCaptureStateCameraReady' | 'FaceCaptureStateCameraStopped';
33
- export declare type FaceCaptureFailureState = 'FaceCaptureStateErrorCameraInitializingError' | 'FaceCaptureStateErrorInvalidState' | 'FaceCaptureStateErrorCameraNotAccessible';
34
- export declare type ComponentProps = {
32
+ export type FaceCaptureSuccessState = 'FaceCaptureStateAnalyzing' | 'FaceCaptureStateCameraReady' | 'FaceCaptureStateCameraStopped';
33
+ export type FaceCaptureFailureState = 'FaceCaptureStateErrorCameraInitializingError' | 'FaceCaptureStateErrorInvalidState' | 'FaceCaptureStateErrorCameraNotAccessible';
34
+ export type ComponentProps = {
35
35
  requireEyesOpen?: boolean;
36
36
  requireValidAngle?: boolean;
37
37
  requiredStableFrames?: number;
@@ -1,2 +1,3 @@
1
1
  import RNYotiCapture from './RNYotiCapture';
2
+ export { IMAGE_QUALITY_LOW, IMAGE_QUALITY_MEDIUM, IMAGE_QUALITY_HIGH, } from './RNYotiCaptureTypes';
2
3
  export default RNYotiCapture;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getyoti/react-native-yoti-face-capture",
3
- "version": "3.0.0",
3
+ "version": "4.0.0",
4
4
  "description": "An easy to use face detection component for React Native from Yoti.",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -53,9 +53,8 @@
53
53
  "@commitlint/config-conventional": "^11.0.0",
54
54
  "@react-native-community/eslint-config": "^2.0.0",
55
55
  "@release-it/conventional-changelog": "^2.0.0",
56
- "@types/jest": "^26.0.0",
57
- "@types/react": "^16.9.19",
58
- "@types/react-native": "0.62.13",
56
+ "@types/jest": "^29.5.3",
57
+ "@types/react": "^19.1.0",
59
58
  "commitlint": "^11.0.0",
60
59
  "eslint": "^7.2.0",
61
60
  "eslint-config-prettier": "^7.0.0",
@@ -64,8 +63,8 @@
64
63
  "jest": "^26.0.1",
65
64
  "pod-install": "^0.1.0",
66
65
  "prettier": "^2.0.5",
67
- "react": "16.13.1",
68
- "react-native": "0.63.4",
66
+ "react": "19.1.0",
67
+ "react-native": "0.80.3",
69
68
  "react-native-builder-bob": "^0.18.0",
70
69
  "release-it": "^14.2.2",
71
70
  "typescript": "^4.1.3"
@@ -152,6 +151,5 @@
152
151
  }
153
152
  ]
154
153
  ]
155
- },
156
- "dependencies": {}
154
+ }
157
155
  }
@@ -11,7 +11,7 @@ Pod::Spec.new do |s|
11
11
  s.authors = package["author"]
12
12
  s.homepage = 'https://github.com/getyoti/react-native-yoti-face-capture'
13
13
  s.source = { :git => "https://github.com/getyoti/react-native-yoti-face-capture.git", :tag => "#{s.version}" }
14
- s.platforms = { :ios => "13.0" }
14
+ s.platforms = { :ios => "15.1" }
15
15
 
16
16
  s.source_files = "ios/**/*.{h,m,mm}"
17
17
 
@@ -1,4 +1,9 @@
1
- import React from 'react';
1
+ import React, {
2
+ forwardRef,
3
+ useCallback,
4
+ useImperativeHandle,
5
+ useRef,
6
+ } from 'react';
2
7
  import {
3
8
  findNodeHandle,
4
9
  requireNativeComponent,
@@ -103,136 +108,144 @@ const FACE_CAPTURE_FAILURE_RENAMING: FailureRenaming = {
103
108
  MultipleFacesDetected: 'FaceCaptureAnalysisErrorMultipleFaces',
104
109
  };
105
110
 
106
- export default class RNYotiCapture extends React.Component<ComponentProps> {
107
- _faceCaptureHandle: number | null;
108
-
109
- constructor(props: ComponentProps) {
110
- super(props);
111
- this._faceCaptureHandle = null;
112
- }
113
-
114
- _setReference = (ref: any) => {
115
- if (ref) {
116
- this._faceCaptureHandle = findNodeHandle(ref);
117
- } else {
118
- this._faceCaptureHandle = null;
119
- }
120
- };
121
-
122
- startAnalyzing() {
123
- YotiFaceCaptureModule.startAnalyzing(this._faceCaptureHandle);
124
- }
125
-
126
- stopAnalyzing() {
127
- YotiFaceCaptureModule.stopAnalyzing(this._faceCaptureHandle);
128
- }
129
-
130
- startCamera() {
131
- YotiFaceCaptureModule.startCamera(this._faceCaptureHandle);
132
- }
133
-
134
- stopCamera() {
135
- YotiFaceCaptureModule.stopCamera(this._faceCaptureHandle);
136
- }
137
-
138
- onCameraStateChange(
139
- cameraState: NativeFaceCaptureState | NativeFaceCaptureStateFailure
140
- ) {
141
- let state = cameraState.nativeEvent.state;
142
-
143
- switch (state) {
144
- case 'Analyzing':
145
- this.props.onFaceCaptureStateChanged('FaceCaptureStateAnalyzing');
146
- break;
147
-
148
- case 'CameraReady':
149
- this.props.onFaceCaptureStateChanged('FaceCaptureStateCameraReady');
150
- break;
151
-
152
- case 'CameraStopped':
153
- this.props.onFaceCaptureStateChanged('FaceCaptureStateCameraStopped');
154
- break;
155
-
156
- case 'CameraInitializationError':
157
- this.props.onFaceCaptureStateFailed(
158
- 'FaceCaptureStateErrorCameraInitializingError'
159
- );
160
- break;
161
-
162
- case 'MissingPermissions':
163
- this.props.onFaceCaptureStateFailed(
164
- 'FaceCaptureStateErrorCameraNotAccessible'
165
- );
166
- break;
167
- }
168
- }
169
-
170
- onFaceCaptureResult(faceCaptureResult: NativeCaptureResult) {
171
- const {
172
- cause: nativeCause,
173
- croppedImage,
174
- croppedFaceBoundingBox,
175
- faceBoundingBox,
176
- originalImage,
177
- state,
178
- } = faceCaptureResult.nativeEvent;
179
-
180
- if (
181
- state === 'ValidFace' &&
182
- croppedImage != null &&
183
- croppedFaceBoundingBox != null &&
184
- faceBoundingBox != null &&
185
- originalImage != null
186
- ) {
187
- this.props.onFaceCaptureAnalyzedImage({
188
- croppedImage,
189
- croppedFaceBoundingBox,
190
- faceBoundingBox,
191
- originalImage,
192
- });
193
- return;
194
- }
195
- if (nativeCause === undefined || originalImage === undefined) {
196
- return;
197
- }
198
-
199
- let cause = FACE_CAPTURE_FAILURE_RENAMING[nativeCause];
200
- if (cause === undefined) {
201
- cause = 'FaceCaptureAnalysisErrorFaceAnalysisFailed';
202
- }
203
-
204
- this.props.onFaceCaptureImageAnalysisFailed({
205
- cause,
206
- originalImage,
207
- });
208
- }
111
+ export type RNYotiCaptureRef = {
112
+ startAnalyzing: () => void;
113
+ stopAnalyzing: () => void;
114
+ startCamera: () => void;
115
+ stopCamera: () => void;
116
+ };
209
117
 
210
- render() {
118
+ const RNYotiCapture = forwardRef<RNYotiCaptureRef, ComponentProps>(
119
+ (props, ref) => {
211
120
  const {
212
121
  requireEyesOpen = false,
213
122
  requireBrightEnvironment = true,
214
123
  requireValidAngle = false,
215
124
  requiredStableFrames = 3,
216
125
  imageQuality = IMAGE_QUALITY_MEDIUM,
217
- faceCenter = [
218
- 0.5,
219
- 0.5
220
- ],
221
- } = this.props;
126
+ faceCenter = [0.5, 0.5],
127
+ onFaceCaptureStateChanged,
128
+ onFaceCaptureStateFailed,
129
+ onFaceCaptureAnalyzedImage,
130
+ onFaceCaptureImageAnalysisFailed,
131
+ } = props;
132
+
133
+ const faceCaptureHandleRef = useRef<number | null>(null);
134
+
135
+ const setReference = useCallback((nativeRef: any) => {
136
+ if (nativeRef) {
137
+ faceCaptureHandleRef.current = findNodeHandle(nativeRef);
138
+ } else {
139
+ faceCaptureHandleRef.current = null;
140
+ }
141
+ }, []);
142
+
143
+ useImperativeHandle(ref, () => ({
144
+ startAnalyzing: () => {
145
+ YotiFaceCaptureModule.startAnalyzing(faceCaptureHandleRef.current);
146
+ },
147
+ stopAnalyzing: () => {
148
+ YotiFaceCaptureModule.stopAnalyzing(faceCaptureHandleRef.current);
149
+ },
150
+ startCamera: () => {
151
+ YotiFaceCaptureModule.startCamera(faceCaptureHandleRef.current);
152
+ },
153
+ stopCamera: () => {
154
+ YotiFaceCaptureModule.stopCamera(faceCaptureHandleRef.current);
155
+ },
156
+ }));
157
+
158
+ const handleCameraStateChange = useCallback(
159
+ (cameraState: NativeFaceCaptureState | NativeFaceCaptureStateFailure) => {
160
+ const state = cameraState.nativeEvent.state;
161
+
162
+ switch (state) {
163
+ case 'Analyzing':
164
+ onFaceCaptureStateChanged('FaceCaptureStateAnalyzing');
165
+ break;
166
+
167
+ case 'CameraReady':
168
+ onFaceCaptureStateChanged('FaceCaptureStateCameraReady');
169
+ break;
170
+
171
+ case 'CameraStopped':
172
+ onFaceCaptureStateChanged('FaceCaptureStateCameraStopped');
173
+ break;
174
+
175
+ case 'CameraInitializationError':
176
+ onFaceCaptureStateFailed(
177
+ 'FaceCaptureStateErrorCameraInitializingError'
178
+ );
179
+ break;
180
+
181
+ case 'MissingPermissions':
182
+ onFaceCaptureStateFailed(
183
+ 'FaceCaptureStateErrorCameraNotAccessible'
184
+ );
185
+ break;
186
+ }
187
+ },
188
+ [onFaceCaptureStateChanged, onFaceCaptureStateFailed]
189
+ );
190
+
191
+ const handleFaceCaptureResult = useCallback(
192
+ (faceCaptureResult: NativeCaptureResult) => {
193
+ const {
194
+ cause: nativeCause,
195
+ croppedImage,
196
+ croppedFaceBoundingBox,
197
+ faceBoundingBox,
198
+ originalImage,
199
+ state,
200
+ } = faceCaptureResult.nativeEvent;
201
+
202
+ if (
203
+ state === 'ValidFace' &&
204
+ croppedImage != null &&
205
+ croppedFaceBoundingBox != null &&
206
+ faceBoundingBox != null &&
207
+ originalImage != null
208
+ ) {
209
+ onFaceCaptureAnalyzedImage({
210
+ croppedImage,
211
+ croppedFaceBoundingBox,
212
+ faceBoundingBox,
213
+ originalImage,
214
+ });
215
+ return;
216
+ }
217
+ if (nativeCause === undefined || originalImage === undefined) {
218
+ return;
219
+ }
220
+
221
+ let cause = FACE_CAPTURE_FAILURE_RENAMING[nativeCause];
222
+ if (cause === undefined) {
223
+ cause = 'FaceCaptureAnalysisErrorFaceAnalysisFailed';
224
+ }
225
+
226
+ onFaceCaptureImageAnalysisFailed({
227
+ cause,
228
+ originalImage,
229
+ });
230
+ },
231
+ [onFaceCaptureAnalyzedImage, onFaceCaptureImageAnalysisFailed]
232
+ );
222
233
 
223
234
  return (
224
235
  <YotiFaceCaptureView
225
- {...this.props}
236
+ {...props}
226
237
  requireEyesOpen={requireEyesOpen}
227
238
  requireValidAngle={requireValidAngle}
228
239
  requiredStableFrames={requiredStableFrames}
229
240
  requireBrightEnvironment={requireBrightEnvironment}
230
241
  imageQuality={imageQuality}
231
242
  faceCenter={faceCenter}
232
- ref={this._setReference}
233
- onCameraStateChange={this.onCameraStateChange.bind(this)}
234
- onFaceCaptureResult={this.onFaceCaptureResult.bind(this)}
243
+ ref={setReference}
244
+ onCameraStateChange={handleCameraStateChange}
245
+ onFaceCaptureResult={handleFaceCaptureResult}
235
246
  />
236
247
  );
237
248
  }
238
- }
249
+ );
250
+
251
+ export default RNYotiCapture;
@@ -1,4 +1,9 @@
1
- import React from 'react';
1
+ import React, {
2
+ forwardRef,
3
+ useCallback,
4
+ useImperativeHandle,
5
+ useRef,
6
+ } from 'react';
2
7
  import {
3
8
  findNodeHandle,
4
9
  requireNativeComponent,
@@ -62,102 +67,124 @@ const YotiFaceCaptureView = requireNativeComponent<NativeFaceCaptureViewIOS>(
62
67
  'YotiFaceCaptureView'
63
68
  );
64
69
 
65
- export default class RNYotiCapture extends React.Component<ComponentProps> {
66
- _faceCaptureHandle: number | null;
67
-
68
- constructor(props: ComponentProps) {
69
- super(props);
70
- this._faceCaptureHandle = null;
71
- }
72
-
73
- _setReference = (ref: any) => {
74
- if (ref) {
75
- this._faceCaptureHandle = findNodeHandle(ref);
76
- } else {
77
- this._faceCaptureHandle = null;
78
- }
79
- };
70
+ export type RNYotiCaptureRef = {
71
+ startAnalyzing: () => void;
72
+ stopAnalyzing: () => void;
73
+ startCamera: () => void;
74
+ stopCamera: () => void;
75
+ };
80
76
 
81
- startAnalyzing() {
82
- UIManager.dispatchViewManagerCommand(
83
- findNodeHandle(this),
84
- UIManager.getViewManagerConfig('YotiFaceCaptureView').Commands
85
- .startAnalyzing,
86
- []
77
+ const RNYotiCapture = forwardRef<RNYotiCaptureRef, ComponentProps>(
78
+ (props, ref) => {
79
+ const {
80
+ requireEyesOpen = false,
81
+ requireValidAngle = false,
82
+ requiredStableFrames = 3,
83
+ requireBrightEnvironment = true,
84
+ imageQuality = IMAGE_QUALITY_MEDIUM,
85
+ faceCenter = [0.5, 0.5],
86
+ onFaceCaptureAnalyzedImage,
87
+ onFaceCaptureImageAnalysisFailed,
88
+ onFaceCaptureStateChanged,
89
+ onFaceCaptureStateFailed,
90
+ } = props;
91
+
92
+ const faceCaptureHandleRef = useRef<number | null>(null);
93
+
94
+ const setReference = useCallback((nativeRef: any) => {
95
+ if (nativeRef) {
96
+ faceCaptureHandleRef.current = findNodeHandle(nativeRef);
97
+ } else {
98
+ faceCaptureHandleRef.current = null;
99
+ }
100
+ }, []);
101
+
102
+ useImperativeHandle(ref, () => ({
103
+ startAnalyzing: () => {
104
+ UIManager.dispatchViewManagerCommand(
105
+ faceCaptureHandleRef.current,
106
+ UIManager.getViewManagerConfig('YotiFaceCaptureView').Commands
107
+ .startAnalyzing,
108
+ []
109
+ );
110
+ },
111
+ stopAnalyzing: () => {
112
+ UIManager.dispatchViewManagerCommand(
113
+ faceCaptureHandleRef.current,
114
+ UIManager.getViewManagerConfig('YotiFaceCaptureView').Commands
115
+ .stopAnalyzing,
116
+ []
117
+ );
118
+ },
119
+ startCamera: () => {
120
+ UIManager.dispatchViewManagerCommand(
121
+ faceCaptureHandleRef.current,
122
+ UIManager.getViewManagerConfig('YotiFaceCaptureView').Commands
123
+ .startCamera,
124
+ []
125
+ );
126
+ },
127
+ stopCamera: () => {
128
+ UIManager.dispatchViewManagerCommand(
129
+ faceCaptureHandleRef.current,
130
+ UIManager.getViewManagerConfig('YotiFaceCaptureView').Commands
131
+ .stopCamera,
132
+ []
133
+ );
134
+ },
135
+ }));
136
+
137
+ const handleFaceCaptureAnalyzedImage = useCallback(
138
+ ({ nativeEvent: faceCaptureResult }: NativeFaceCaptureResult) => {
139
+ onFaceCaptureAnalyzedImage(faceCaptureResult);
140
+ },
141
+ [onFaceCaptureAnalyzedImage]
87
142
  );
88
- }
89
143
 
90
- stopAnalyzing() {
91
- UIManager.dispatchViewManagerCommand(
92
- findNodeHandle(this),
93
- UIManager.getViewManagerConfig('YotiFaceCaptureView').Commands
94
- .stopAnalyzing,
95
- []
144
+ const handleFaceCaptureImageAnalysisFailed = useCallback(
145
+ ({
146
+ nativeEvent: faceCaptureAnalysisFailure,
147
+ }: NativeFaceCaptureAnalysisFailure) => {
148
+ onFaceCaptureImageAnalysisFailed(faceCaptureAnalysisFailure);
149
+ },
150
+ [onFaceCaptureImageAnalysisFailed]
96
151
  );
97
- }
98
152
 
99
- public startCamera = () => {
100
- UIManager.dispatchViewManagerCommand(
101
- findNodeHandle(this._faceCaptureHandle),
102
- UIManager.getViewManagerConfig('YotiFaceCaptureView').Commands
103
- .startCamera,
104
- []
153
+ const handleFaceCaptureStateChanged = useCallback(
154
+ ({
155
+ nativeEvent: { state: faceCaptureState },
156
+ }: NativeFaceCaptureState) => {
157
+ onFaceCaptureStateChanged(faceCaptureState);
158
+ },
159
+ [onFaceCaptureStateChanged]
105
160
  );
106
- };
107
161
 
108
- stopCamera() {
109
- UIManager.dispatchViewManagerCommand(
110
- findNodeHandle(this._faceCaptureHandle),
111
- UIManager.getViewManagerConfig('YotiFaceCaptureView').Commands.stopCamera,
112
- []
162
+ const handleFaceCaptureStateFailed = useCallback(
163
+ ({
164
+ nativeEvent: { state: faceCaptureStateFailure },
165
+ }: NativeFaceCaptureStateFailure) => {
166
+ onFaceCaptureStateFailed(faceCaptureStateFailure);
167
+ },
168
+ [onFaceCaptureStateFailed]
113
169
  );
114
- }
115
170
 
116
- render() {
117
- const {
118
- requireEyesOpen = false,
119
- requireValidAngle = false,
120
- requiredStableFrames = 3,
121
- requireBrightEnvironment = true,
122
- imageQuality = IMAGE_QUALITY_MEDIUM,
123
- faceCenter = [
124
- 0.5,
125
- 0.5
126
- ],
127
- } = this.props;
128
171
  return (
129
172
  <YotiFaceCaptureView
130
- {...this.props}
173
+ {...props}
131
174
  requireEyesOpen={requireEyesOpen}
132
175
  requireValidAngle={requireValidAngle}
133
176
  requiredStableFrames={requiredStableFrames}
134
177
  requireBrightEnvironment={requireBrightEnvironment}
135
178
  imageQuality={imageQuality}
136
179
  faceCenter={faceCenter}
137
- onFaceCaptureAnalyzedImage={({
138
- nativeEvent: faceCaptureResult,
139
- }: NativeFaceCaptureResult) =>
140
- this.props.onFaceCaptureAnalyzedImage(faceCaptureResult)
141
- }
142
- onFaceCaptureImageAnalysisFailed={({
143
- nativeEvent: faceCaptureAnalysisFailure,
144
- }: NativeFaceCaptureAnalysisFailure) =>
145
- this.props.onFaceCaptureImageAnalysisFailed(
146
- faceCaptureAnalysisFailure
147
- )
148
- }
149
- onFaceCaptureStateChanged={({
150
- nativeEvent: { state: faceCaptureState },
151
- }: NativeFaceCaptureState) =>
152
- this.props.onFaceCaptureStateChanged(faceCaptureState)
153
- }
154
- onFaceCaptureStateFailed={({
155
- nativeEvent: { state: faceCaptureStateFailure },
156
- }: NativeFaceCaptureStateFailure) =>
157
- this.props.onFaceCaptureStateFailed(faceCaptureStateFailure)
158
- }
159
- ref={this._setReference}
180
+ onFaceCaptureAnalyzedImage={handleFaceCaptureAnalyzedImage}
181
+ onFaceCaptureImageAnalysisFailed={handleFaceCaptureImageAnalysisFailed}
182
+ onFaceCaptureStateChanged={handleFaceCaptureStateChanged}
183
+ onFaceCaptureStateFailed={handleFaceCaptureStateFailed}
184
+ ref={setReference}
160
185
  />
161
186
  );
162
187
  }
163
- }
188
+ );
189
+
190
+ export default RNYotiCapture;
package/src/index.tsx CHANGED
@@ -1,4 +1,10 @@
1
1
  // @ts-ignore
2
2
  import RNYotiCapture from './RNYotiCapture';
3
3
 
4
+ export {
5
+ IMAGE_QUALITY_LOW,
6
+ IMAGE_QUALITY_MEDIUM,
7
+ IMAGE_QUALITY_HIGH,
8
+ } from './RNYotiCaptureTypes';
9
+
4
10
  export default RNYotiCapture;
package/CHANGELOG.md DELETED
@@ -1,29 +0,0 @@
1
- # ChangeLog
2
- ## Version 3.0.0
3
- BREAKING CHANGE: New configuration requirements
4
-
5
- The configuration has been updated and expects a `faceCenter` representing the expected center of the captured face.
6
- This parameter is a percentage value (x, y). E.g.: (0,0) - top left; (0.5, 0.5) - center of the screen; (1,1) - bottom right;
7
-
8
- Please, check [README.md](https://github.com/getyoti/react-native-yoti-face-capture/blob/main/README.md) for more details.
9
-
10
- ## Version 2.0.1
11
-
12
- Contains a couple of bug fixes on the iOS side of the SDK:
13
- - Solves the discrepancy between the required screen units that needs to be used for Android and iOS. Now, both platforms will be expecting pixels when defining the scanning area.
14
- - Fixes a crash when the component was used inside of a react-navigation react-stack screen.
15
-
16
- ## Version 2.0.0
17
-
18
- BREAKING CHANGE: Low light detection
19
-
20
- New configurable property `requireBrightEnvironment` has been added to the SDK entry point. If it is activated, the SDK will require a bright environment to take the selfie. To migrate from previous versions, it is needed to include this paremeter on the SDK setup.
21
- Please, check [README.md](https://github.com/getyoti/react-native-yoti-face-capture/blob/main/README.md) for more details.
22
-
23
- ## Version 1.1.0
24
-
25
- Fix: README.md
26
-
27
- ## Version 1.0.0
28
-
29
- Face capture first release