react-native-modern-qrscanner
Advanced tools
+1
| console.log('test'); |
+61
| # react-native-modern-qrscanner | ||
| A modern-designed and powerful QR code scanner for React Native with advanced features. | ||
| ## Features | ||
| - Modern and user-friendly interface | ||
| - Fast and efficient QR code scanning | ||
| - Customizable styles and themes | ||
| - Supports both Android and iOS devices | ||
| - Easy integration into React Native projects | ||
| ## Installation | ||
| ```bash | ||
| npm install react-native-modern-qrscanner | ||
| ``` | ||
| ## Usage | ||
| Import the `QRScanner` component in your React Native application: | ||
| ```javascript | ||
| import QRScanner from 'react-native-modern-qrscanner'; | ||
| ``` | ||
| Then, use the component in your app: | ||
| ```javascript | ||
| <QRScanner onScanSuccess={this.handleScanSuccess} /> | ||
| ``` | ||
| Define the callback function for successful scans: | ||
| ```javascript | ||
| handleScanSuccess = (data) => { | ||
| // Process the scanned data | ||
| console.log("Scanned QR Code:", data); | ||
| }; | ||
| ``` | ||
| ## Customization | ||
| You can customize the scanner's appearance and behavior using various props: | ||
| ```javascript | ||
| <QRScanner | ||
| onScanSuccess={this.handleScanSuccess} | ||
| cameraStyle={{ ... }} | ||
| scannerAreaStyle={{ ... }} | ||
| /> | ||
| ``` | ||
| ## Contributing | ||
| Contributions are welcome! Please open an issue or submit a pull request with any improvements or suggestions. | ||
| ## License | ||
| This project is licensed under the MIT License. |
+1
| console.log('testing 222'); |
+1
-1
@@ -1,3 +0,3 @@ | ||
| // index.js | ||
| import QrcodeScanner from './src/QrcodeScanner'; | ||
| export default QrcodeScanner; |
+4
-4
| { | ||
| "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" | ||
| } |
+22
-45
| 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
19.36%6
100%1
-50%62
Infinity%44
-32.31%