Skip to content

Instantly share code, notes, and snippets.

@ravjotsandhu
Last active December 12, 2021 11:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ravjotsandhu/a2c3de3a2fc7d9f8ed8020b469788eb5 to your computer and use it in GitHub Desktop.
Save ravjotsandhu/a2c3de3a2fc7d9f8ed8020b469788eb5 to your computer and use it in GitHub Desktop.
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