react-native-modern-qrscanner
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -1,3 +0,3 @@ | ||
// index.js | ||
import QrcodeScanner from './src/QrcodeScanner'; | ||
export default QrcodeScanner; |
{ | ||
"name": "react-native-modern-qrscanner", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "A modern-designed and powerful QR code scanner for React Native with advanced features.", | ||
@@ -11,3 +11,3 @@ "main": "index.js", | ||
"type": "git", | ||
"url": "git+https://github.com/sanghyunj5958/react-native-modern-qrscanner.git" | ||
"url": "git+https://github.com/npmhub90/react-native-modern-qrscanner.git" | ||
}, | ||
@@ -39,5 +39,5 @@ "keywords": [ | ||
"bugs": { | ||
"url": "https://github.com/sanghyunj5958/react-native-modern-qrscanner/issues" | ||
"url": "https://github.com/npmhub90/react-native-modern-qrscanner/issues" | ||
}, | ||
"homepage": "https://github.com/sanghyunj5958/react-native-modern-qrscanner#readme" | ||
"homepage": "https://github.com/npmhub90/react-native-modern-qrscanner#readme" | ||
} |
import React, { Component } from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { View, Text, TouchableOpacity, TouchableNativeFeedback, ActivityIndicator, Platform, StyleSheet, Alert } from 'react-native'; | ||
import { View, StyleSheet, Alert } from 'react-native'; | ||
import { RNCamera } from 'react-native-camera'; | ||
class QrcodeScanner extends Component { | ||
onBarCodeRead = (e) => { | ||
if (this.props.onScan) { | ||
this.props.onScan(e); | ||
} | ||
}; | ||
render() { | ||
const { | ||
onPress, | ||
buttonStyle, | ||
type, | ||
title, | ||
titleStyle, | ||
loading, | ||
disabled, | ||
...attributes | ||
} = this.props; | ||
const { style, cameraProps } = this.props; | ||
const containerStyle = { | ||
...styles.button, | ||
...buttonStyle, | ||
backgroundColor: type === 'solid' ? 'blue' : 'transparent', | ||
opacity: disabled ? 0.5 : 1, | ||
}; | ||
const TouchableComponent = Platform.OS === 'android' ? TouchableNativeFeedback : TouchableOpacity; | ||
return ( | ||
<View style={containerStyle}> | ||
<TouchableComponent onPress={loading || disabled ? null : onPress} {...attributes}> | ||
{loading ? ( | ||
<ActivityIndicator size="small" color="#ffffff" /> | ||
) : ( | ||
<Text style={[styles.text, titleStyle]}>{title}</Text> | ||
)} | ||
</TouchableComponent> | ||
<View style={[styles.container, style]}> | ||
<RNCamera | ||
style={StyleSheet.absoluteFill} | ||
onBarCodeRead={this.onBarCodeRead} | ||
{...cameraProps} | ||
/> | ||
</View> | ||
@@ -42,30 +29,20 @@ ); | ||
const styles = StyleSheet.create({ | ||
button: { | ||
padding: 10, | ||
borderRadius: 5, | ||
container: { | ||
flex: 1, | ||
justifyContent: 'center', | ||
alignItems: 'center', | ||
}, | ||
text: { | ||
color: 'white', | ||
textAlign: 'center', | ||
}, | ||
}); | ||
QrcodeScanner.propTypes = { | ||
onPress: PropTypes.func, | ||
buttonStyle: PropTypes.object, | ||
title: PropTypes.string, | ||
titleStyle: PropTypes.object, | ||
loading: PropTypes.bool, | ||
disabled: PropTypes.bool, | ||
type: PropTypes.oneOf(['solid', 'clear']), | ||
onScan: PropTypes.func, | ||
style: PropTypes.object, | ||
cameraProps: PropTypes.object, | ||
}; | ||
QrcodeScanner.defaultProps = { | ||
type: 'solid', | ||
loading: false, | ||
disabled: false, | ||
style: {}, | ||
cameraProps: {}, | ||
}; | ||
export default QrcodeScanner; |
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
3422
6
1
62
44