-
-
Notifications
You must be signed in to change notification settings - Fork 69
/
Copy pathreact-native-camera.tsx
87 lines (72 loc) · 1.48 KB
/
react-native-camera.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
// https://stackoverflow.com/a/41818992
/*import React from "react";
const constants = {
Aspect: {},
BarCodeType: {},
Type: {},
CaptureMode: {},
CaptureTarget: {},
CaptureQuality: {},
Orientation: {},
FlashMode: {},
TorchMode: {},
};
class Camera extends React.Component {
public static constants = constants;
public render() {
return null;
}
}
Camera.constants = constants;
export default Camera;
*/
import React from "react";
const timeout = (ms: number) => {
return new Promise((resolve) => setTimeout(resolve, ms));
};
export const Constants = {
BarCode: {},
CameraType: {},
Aspect: {},
BarCodeType: {},
Type: { back: "back", front: "front" },
CaptureMode: {},
CaptureTarget: {},
CaptureQuality: {},
Orientation: {},
FlashMode: {},
TorchMode: {},
};
export class RNCamera extends React.Component {
public static Constants = {
BarCode: {},
CameraType: {},
Aspect: {},
BarCodeType: {},
Type: { back: "back", front: "front" },
CaptureMode: {},
CaptureTarget: {},
CaptureQuality: {},
Orientation: {},
FlashMode: {},
TorchMode: {},
};
public takePictureAsync = async () => {
await timeout(2000);
return {
base64: "base64string",
};
}
public render() {
if (!this.props.children) {
return (<></>);
}
return (
this.props.children({
status: "AUTHORIZED",
})
);
}
}
export default RNCamera;
//export const {BarCode, CameraType} = Constants;