forked from KeanuTomatoMomotaro/react-native-barcode-reader
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.js
129 lines (113 loc) · 2.85 KB
/
App.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
117
118
119
120
121
122
123
124
125
126
127
128
129
import React, { Component } from 'react';
import {
Dimensions,
StyleSheet,
Text,
View,
TouchableOpacity,
} from 'react-native';
import Camera from 'react-native-camera'
import QRCode from 'react-native-qrcode';
export default class App extends Component {
//start generate qr code
render() {
return (
<View style={styles.container}>
<Text onPress={this.handleQrGenerate}>generateQrCode</Text>
</View>
);
};
handleQrGenerate(){
// console.log("hahahaha")
// this.renderBarcode('12345').bind(this)
// return(
// <QRCode
// value={"123456"}
// size={200}
// bgColor='black'
// fgColor='white'/>
// );
}
renderBarcode(tValue){
return(
<QRCode
value={tValue}
size={200}
bgColor='black'
fgColor='white'/>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: 'white',
alignItems: 'center',
justifyContent: 'center'
},
});
//end generate qr code
// constructor(props) {
// super(props);
// this.state = {
// barcode: ''
// }
// }
//render bagian readernya, diatas buat generate qr code
// render(){
// return(
// <View>
// <View style = {styles.cameraBorder}>
// <Camera
// ref={(cam)=>{
// this.camera = cam
// }}
// onBarCodeRead = {this.onBarCodeRead.bind(this)}
// style = {styles.preview}
// aspect = {Camera.constants.Aspect.fill}>
// {/* <Text style = {styles.capture} onPress = {this.takePicture.bind(this)}>[CAPTURE]</Text> */}
// <Text style={{
// backgroundColor: 'white'
// }}>{this.state.qrcode}{this.state.barcode}</Text>
// </Camera>
// </View>
// {/* <TouchableOpacity style = {{width:200, height:200, backgroundColor:'white'}} onPress = {this.generateQrCode.bind(this)}>generate Qr code</TouchableOpacity> */}
// </View>
// );
// }
// onBarCodeRead(e){
// console.log("Barcode FOUND!", "Type: "+e.type +"\nData: "+e.data)
// this.setState({barcode:e.data})
// }
// takePicture(){
// const options = {}
// this.camera.capture({metadata: options})
// .then((data)=>console.log(data))
// .catch(err=>console.error(err))
// }
// generateQrCode(){
// }
// }
// const styles = StyleSheet.create({
// container: {
// flex: 1,
// flexDirection: 'row',
// },
// cameraBorder: {
// width: 200,
// height:200
// },
// preview: {
// flex: 1,
// justifyContent: 'flex-end',
// alignItems: 'center'
// },
// capture: {
// flex: 0,
// backgroundColor: '#fff',
// borderRadius: 5,
// color: '#000',
// padding: 10,
// margin: 40
// }
// });