react-native-barcode-mask example usage

June 22, 2020 ยท View on GitHub

import React from "react"; import { Text, View, Item, Icon, Input, Button } from 'native-base'; import { KeyboardAvoidingView } from "react-native"; import { RNCamera } from 'react-native-camera'; import BarcodeMask from 'react-native-barcode-mask';

const styles = { root: { flex: 1, }, upperSection: { flex: 1 }, lowerSection: { paddingVertical: 30, paddingHorizontal: 20, backgroundColor: 'white', }, camera: { height: '100%', }, };

class ItemBarcodeScanContainer extends React.Component {

constructor(props) { super(props); this.state = { barcode: '' } }

onBarCodeRead = (scanResult) => { // scanResult.data will contain your scanned data }

onGetItemPress = () => { // do something with button press }

handleChange = () => { // handle user input }

render() { return ( {/* OR Use a simple instead of */} <RNCamera onBarCodeRead={this.onBarCodeRead} // ... other related props of RNCamera > <Icon type={"Ionicons"} active name='md-barcode' />
) }

}

export default ItemBarcodeScanContainer;