New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More

react-native-zepra-scanner-1

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-zepra-scanner-1

react-native-zepra-scanner


Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created

react-native-zippra-scanner

Zebra scanner for react native ("https://www.zebra.com/us/en/support-downloads/software/developer-tools/scanner-sdk-for-android.html")

Installation

npm react-native-zepra-scanner-1

npx expo install react-native-zepra-scanner-1

Usage

import * as React from 'react';

import {
  StyleSheet,
  View,
  Button,
  DeviceEventEmitter,
  Text,
} from 'react-native';
import {
  findCabledScanner,
  findBluetoothScanner,
  requestBluethoothAccess,
  setupApi,
  getActiveScannersList,
  Listeners,
} from 'react-native-zippra-scanner';

export default function App() {
  const [code, setCode] = React.useState('');

  React.useEffect(() => {
    requestBluethoothAccess().then(setupApi);

    DeviceEventEmitter.addListener(Listeners.SCANNER_DISAPPEARED, () =>
      console.log('SCANNER_DISAPPEARED')
    );
    DeviceEventEmitter.addListener(Listeners.SCANNER_ESTABLISHED, () =>
      console.log('SCANNER_ESTABLISHED')
    );
    DeviceEventEmitter.addListener(Listeners.SESSION_TERMINATED, () =>
      console.log('SESSION_TERMINATED')
    );
    DeviceEventEmitter.addListener(
      Listeners.BARCODE_RECEIVED,
      (value: string) => setCode(value)
    );
  }, []);

  const getDevices = () => {
    getActiveScannersList().then((devices) => {
      console.log(JSON.stringify(devices));
    });
  };

  return (
    <View style={styles.container}>
      <Text>Result: {code}</Text>
      <Button
        style={styles.openButton}
        onPress={() => findBluetoothScanner('A4:C7:4B:3B:38:F5')}
        title={'Open bluetooth barcode'}
      />
      <Button
        style={styles.openButton}
        onPress={findCabledScanner}
        title={'Open usb barcode'}
      />
      <Button
        style={styles.openButton}
        onPress={getDevices}
        title={'Get Devices'}
      />
    </View>
  );
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    alignItems: 'center',
    justifyContent: 'space-around',
  },
  openButton: {
    width: 120,
    height: 60,
    backgroundColor: '#000000',
  },
});

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT


Made with create-react-native-library

FAQs

Package last updated on 20 Dec 2023

Did you know?

Socket

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.

Install

Related posts