Socket
Socket
Sign inDemoInstall

react-native-modern-qrscanner

Package Overview
Dependencies
0
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.0 to 1.0.1

main.js

2

index.js

@@ -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;
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc