Created
October 4, 2019 11:26
-
-
Save mdshadman/431435c6e2f22fe2528e36035ac0f95b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
return ( | |
<View style={styles.scrollViewStyle}> | |
<Fragment> | |
<StatusBar barStyle="dark-content" /> | |
<Text style={styles.textTitle}>Welcome To React-Native QR Code Tutorial !</Text> | |
{!scan && !ScanResult && | |
<View style={styles.cardView} > | |
<Text numberOfLines={8} style={styles.descText}>{desccription}</Text> | |
<TouchableOpacity onPress={this.activeQR} style={styles.buttonTouchable}> | |
<Text style={styles.buttonTextStyle}>Click to Scan !</Text> | |
</TouchableOpacity> | |
</View> | |
} | |
{ScanResult && | |
<Fragment> | |
<Text style={styles.textTitle1}>Result !</Text> | |
<View style={ScanResult ? styles.scanCardView : styles.cardView}> | |
<Text>Type : {result.type}</Text> | |
<Text>Result : {result.data}</Text> | |
<Text numberOfLines={1}>RawData: {result.rawData}</Text> | |
<TouchableOpacity onPress={this.scanAgain} style={styles.buttonTouchable}> | |
<Text style={styles.buttonTextStyle}>Click to Scan again!</Text> | |
</TouchableOpacity> | |
</View> | |
</Fragment> | |
} | |
{scan && | |
<QRCodeScanner | |
reactivate={true} | |
showMarker={true} | |
ref={(node) => { this.scanner = node }} | |
onRead={this.onSuccess} | |
topContent={ | |
<Text style={styles.centerText}> | |
Go to <Text style={styles.textBold}>wikipedia.org/wiki/QR_code</Text> on your computer and scan the QR code to test.</Text> | |
} | |
bottomContent={ | |
<View> | |
<TouchableOpacity style={styles.buttonTouchable} onPress={() => this.scanner.reactivate()}> | |
<Text style={styles.buttonTextStyle}>OK. Got it!</Text> | |
</TouchableOpacity> | |
<TouchableOpacity style={styles.buttonTouchable} onPress={() => this.setState({ scan: false })}> | |
<Text style={styles.buttonTextStyle}>Stop Scan</Text> | |
</TouchableOpacity> | |
</View> | |
} | |
/> | |
} | |
</Fragment> | |
</View> | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment