Merge pull request #746 from superyarik/master

Add onBarCodeRead example
This commit is contained in:
Sibelius Seraphini 2017-12-07 10:39:49 -02:00 committed by GitHub
commit 6bc1de69d7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 0 deletions

View File

@ -132,6 +132,7 @@ class BadInstagramCloneApp extends Component {
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>
@ -139,6 +140,13 @@ class BadInstagramCloneApp extends Component {
</View>
);
}
onBarCodeRead(e) {
console.log(
"Barcode Found!",
"Type: " + e.type + "\nData: " + e.data
);
}
takePicture() {
const options = {};