Last active
December 12, 2021 11:42
-
-
Save ravjotsandhu/a2c3de3a2fc7d9f8ed8020b469788eb5 to your computer and use it in GitHub Desktop.
This file contains 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
import React from 'react'; | |
import { | |
StyleSheet, | |
Text, | |
TouchableOpacity, | |
Linking, | |
Image, | |
ImageBackground, | |
View, | |
DeviceEventEmitter, | |
} from 'react-native'; | |
import QRCodeScanner from 'react-native-qrcode-scanner'; | |
import {RNCamera} from 'react-native-camera'; | |
const Scan = () => { | |
const onSuccess = e => { | |
alert(e.data); | |
}; | |
return ( | |
<View style={styles.container}> | |
<View | |
style={{ | |
backgroundColor: 'cyan', | |
flex: 0.1, | |
justifyContent: 'center', | |
}}> | |
<Text | |
style={{ | |
color: 'white', | |
fontWeight: 'bold', | |
textAlign: 'center', | |
fontSize: 20, | |
}}> | |
Scan QR Code | |
</Text> | |
</View> | |
<View style={{flex: 0.75}}> | |
<QRCodeScanner | |
cameraStyle={{width: '90%', alignSelf: 'center'}} | |
onRead={e => onSuccess(e)} | |
/> | |
</View> | |
<View style={{flex: 0.1, backgroundColor: 'cyan'}}></View> | |
</View> | |
); | |
}; | |
const styles = StyleSheet.create({ | |
container: { | |
flex: 1, | |
backgroundColor: 'white', | |
}, | |
}); | |
export default Scan; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment