Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
react-native-barcode-scanner
Advanced tools
Readme
Implemented a barcode scanner with support of react native technology
npm install ReactNativeBarcodeScanner@latest --save
Libraries
➜ Add Files to [your project's name]
node_modules
➜ ReactNativeBarcodeScanner
and add ReactNativeBarcodeScanner.xcodeproj
libReactNativeBarcodeScanner.a
to your project's Build Phases
➜ Link Binary With Libraries
ReactNativeBarcodeScanner.xcodeproj
in the project navigator and go the Build Settings
tab. Make sure 'All' is toggled on (instead of 'Basic'). Look for Header Search Paths
and make sure it contains both $(SRCROOT)/../react-native/React
and $(SRCROOT)/../../React
- mark both as recursive
.Cmd+R
)All you need is to require
the BarcodeScanner
module and then use the <BarcodeScanner/>
tag.
var BarcodeScanner = require('./BarcodeScanner');
var {
AlertIOS,
AppRegistry,
Component,
NavigatorIOS,
StyleSheet,
Text,
TouchableHighlight,
View,
} = React;
var ReactNativeBarcodeScanner = React.createClass({
getInitialState: function() {
return {
value: ''
};
},
render: function() {
return (
<View style={styles.container}>
<TouchableHighlight onPress={this._switchCamera}>
<View>
<BarcodeScanner
ref="scanner"
aspect="Fill"
type="Back"
orientation="Portrait"
onScanned={this._onScannedResult}
style={styles.barcode}
/>
</View>
</TouchableHighlight>
<TouchableHighlight onPress={this._stopScaning}>
<Text>Stop Scaning</Text>
</TouchableHighlight>
<TouchableHighlight onPress={this._startScaning}>
<Text>Start Scaning</Text>
</TouchableHighlight>
</View>
);
},
_switchCamera: function() {
this.refs.scanner.switch();
},
_stopScaning: function() {
this.refs.scanner.stopScanning();
},
_startScaning: function() {
this.refs.scanner.startScanning();
},
_onScannedResult: function(data) {
console.log(data);
if (this.state.value === '') {
this.setState({value: data});
AlertIOS.alert(this.state.value);
}
this.props.navigator.pop();
}
});
Thanks to Loch Wansbrough (@lwansbrough) for the react-native-camera
module which provided me with a great example of how to set up this module.
FAQs
Barcode scanner for React Native
The npm package react-native-barcode-scanner receives a total of 11 weekly downloads. As such, react-native-barcode-scanner popularity was classified as not popular.
We found that react-native-barcode-scanner demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.