forked from fbacker/react-native-camera
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbarcode-finder.js
116 lines (110 loc) · 2.38 KB
/
barcode-finder.js
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
import React, {
Component,
PropTypes,
} from 'react';
import {
Platform,
StyleSheet,
View,
} from 'react-native';
class BarcodeFinder extends Component {
constructor(props) {
super(props);
}
getSizeStyles() {
return ({
width: this.props.width,
height: this.props.height
});
}
render() {
return (
<View style={[styles.container]}>
<View style={[styles.finder, this.getSizeStyles()]}>
<View style={[
{borderColor: this.props.borderColor},
styles.topLeftEdge,
{
borderLeftWidth: this.props.borderWidth,
borderTopWidth: this.props.borderWidth,
}
]} />
<View style={[
{borderColor: this.props.borderColor},
styles.topRightEdge,
{
borderRightWidth: this.props.borderWidth,
borderTopWidth: this.props.borderWidth,
}
]} />
<View style={[
{borderColor: this.props.borderColor},
styles.bottomLeftEdge,
{
borderLeftWidth: this.props.borderWidth,
borderBottomWidth: this.props.borderWidth,
}
]} />
<View style={[
{borderColor: this.props.borderColor},
styles.bottomRightEdge,
{
borderRightWidth: this.props.borderWidth,
borderBottomWidth: this.props.borderWidth,
}
]} />
</View>
</View>
);
}
};
BarcodeFinder.propTypes = {
borderWidth: PropTypes.number,
borderColor: PropTypes.string,
width: PropTypes.number,
height: PropTypes.number
};
var styles = StyleSheet.create({
container: {
alignItems: 'center',
justifyContent: 'center',
position: 'absolute',
top: 0,
right: 0,
bottom: 0,
left: 0,
},
finder: {
alignItems: 'center',
justifyContent: 'center',
},
topLeftEdge: {
position: 'absolute',
top: 0,
left: 0,
width: 40,
height: 20,
},
topRightEdge: {
position: 'absolute',
top: 0,
right: 0,
width: 40,
height: 20,
},
bottomLeftEdge: {
position: 'absolute',
bottom: 0,
left: 0,
width: 40,
height: 20,
},
bottomRightEdge: {
position: 'absolute',
bottom: 0,
right: 0,
width: 40,
height: 20,
},
});
module.exports = BarcodeFinder;