From 2832b65f4e0ab1837892088e9bd7023e077385d2 Mon Sep 17 00:00:00 2001 From: bkaptijn Date: Tue, 14 Sep 2021 11:43:44 +0200 Subject: [PATCH] enable rescanning --- validator-frontend/screens/ScanScreen.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/validator-frontend/screens/ScanScreen.js b/validator-frontend/screens/ScanScreen.js index 86c8417..46ebd9c 100644 --- a/validator-frontend/screens/ScanScreen.js +++ b/validator-frontend/screens/ScanScreen.js @@ -108,6 +108,13 @@ class ScanScreen extends React.Component { async componentDidMount() { const { status } = await BarCodeScanner.requestPermissionsAsync(); this.setState({ hasCameraPermission: status === 'granted' }); + this._unsubscribe = this.props.navigation.addListener('focus', () => { + this.setState({scanned:false}); + }); + } + + componentWillUnmount() { + this._unsubscribe(); } render() { @@ -132,7 +139,6 @@ class ScanScreen extends React.Component { handleBarCodeScanned = ({ type, data }) => { this.setState({scanned:true}) - console.log('qrdata: '+data) this.props.navigation.navigate('Validating', {qrString: data}) } }