SHARE
TWEET

Untitled

a guest Aug 19th, 2019 58 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. timer = null
  2.   ScanCode_Change_Event = (e) => {
  3.     clearTimeout(this.timer);
  4.     this.timer = setTimeout(() => { this.triggerChange() }, 500);
  5.   }
  6.   triggerChange = async () => {
  7.     await this._onSendSignature();
  8.   }
  9.  
  10. _onSendSignature = async () => {
  11.     const BarcodeNo = this.state.BarcodeNo;
  12.     const valueToHash = MerchantKey + BarcodeNo + Amount.replace('.', '').replace(',', '');
  13.     sha256(valueToHash).then( hash => {
  14.         // This can show the signature
  15.         ToastAndroid.show('Signature: ' + hash, ToastAndroid.LONG, ToastAndroid.BOTTOM);
  16.         this.setState({
  17.           hashSignature: hash
  18.         })
  19.       })
  20.     // This cannot show the signature
  21.     ToastAndroid.show('Signature: ' + this.state.hashSignature, ToastAndroid.LONG, ToastAndroid.BOTTOM);
  22. }
  23.      
  24. <Input style={{ color: 'brown' }}
  25.                     placeholder='Scan Barcode'
  26.                     placeholderTextColor='rgba(0, 0, 0, 0.3)'
  27.                     autoFocus={true}
  28.                     onChange={evt => this.ScanCode_Change_Event(evt)}
  29.                     onChangeText={(BarcodeNo) => this.setState({ BarcodeNo})}>{this.state.BarcodeNo}</Input>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top