Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- timer = null
- ScanCode_Change_Event = (e) => {
- clearTimeout(this.timer);
- this.timer = setTimeout(() => { this.triggerChange() }, 500);
- }
- triggerChange = async () => {
- await this._onSendSignature();
- }
- _onSendSignature = async () => {
- const BarcodeNo = this.state.BarcodeNo;
- const valueToHash = MerchantKey + BarcodeNo + Amount.replace('.', '').replace(',', '');
- sha256(valueToHash).then( hash => {
- // This can show the signature
- ToastAndroid.show('Signature: ' + hash, ToastAndroid.LONG, ToastAndroid.BOTTOM);
- this.setState({
- hashSignature: hash
- })
- })
- // This cannot show the signature
- ToastAndroid.show('Signature: ' + this.state.hashSignature, ToastAndroid.LONG, ToastAndroid.BOTTOM);
- }
- <Input style={{ color: 'brown' }}
- placeholder='Scan Barcode'
- placeholderTextColor='rgba(0, 0, 0, 0.3)'
- autoFocus={true}
- onChange={evt => this.ScanCode_Change_Event(evt)}
- onChangeText={(BarcodeNo) => this.setState({ BarcodeNo})}>{this.state.BarcodeNo}</Input>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement