vbea há 3 anos atrás
pai
commit
cd4fcc1db0
1 ficheiros alterados com 13 adições e 16 exclusões
  1. 13 16
      Strides-APP/app/pages/chargeV2/QRScan.js

+ 13 - 16
Strides-APP/app/pages/chargeV2/QRScan.js

@@ -3,10 +3,9 @@
  * @邠心vbe on 2021/03/24
  */
 import React, { Component } from 'react'
-import { Image, StyleSheet, Text, View } from 'react-native'
+import { StyleSheet, View } from 'react-native'
 import QRCodeScanner from 'react-native-qrcode-scanner';
 import { RNCamera } from 'react-native-camera';
-import { Styles } from '../../components/Toolbar';
 import apiCharge from '../../api/apiCharge';
 import { PageList } from '../Router';
 import Dialog from '../../components/Dialog';
@@ -84,15 +83,12 @@ export default class QRScan extends Component {
 
   componentDidMount() {
     //console.log(this.state.params);
-    setTimeout(() => {
-      this.setState({
-        isResult: false
-      });
-    }, 300);
     this.props.navigation.addListener('focus', () => {
-      this.setState({
-        isResult: false
-      });
+      setTimeout(() => {
+        this.setState({
+          isResult: false
+        });
+      }, 200);
     });
     this.props.navigation.addListener('beforeRemove', (e) => {
       if (!this.state.isResult) {
@@ -157,10 +153,11 @@ export default class QRScan extends Component {
         message: err,
         showCancel: false,
         callback: (e) => {
-        this.setState({
-          isResult: false
-        });
-      }});
+          this.setState({
+            isResult: false
+          });
+        }
+      });
     })
   }
 
@@ -169,7 +166,7 @@ export default class QRScan extends Component {
       <View style={styles.container}>
         { !this.state.isResult
           ? <QRCodeScanner
-              fadeIn={false}
+              fadeIn={true}
               onRead={this.scanResult}
               reactivate={false}
               reactivateTimeout={1000}
@@ -191,7 +188,7 @@ const styles = StyleSheet.create({
   container: {
     alignItems: 'center',
     justifyContent: 'center',
-    backgroundColor: '#242B32',
+    backgroundColor: '#000',
     ...StyleSheet.absoluteFillObject
   }
 })