Socket
Book a DemoInstallSign in
Socket

@1ziton/react-native-scancode

Package Overview
Dependencies
Maintainers
4
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@1ziton/react-native-scancode

## PDA扫描插件

1.0.5
latest
Source
npmnpm
Version published
Weekly downloads
1
-75%
Maintainers
4
Weekly downloads
 
Created
Source

react-native-scancode

Getting started

$ npm install react-native-scancode --save

Mostly automatic installation

$ react-native link react-native-scancode

Manual installation

Android

  • Open up android/app/src/main/java/[...]/MainApplication.java
  • Add import com.xiaomo.ScancodePackage; to the imports at the top of the file
  • Add new ScancodePackage() to the list returned by the getPackages() method
  • Append the following lines to android/settings.gradle:

    include ':react-native-scancode'
    project(':react-native-scancode').projectDir = new File(rootProject.projectDir, 	'../node_modules/react-native-scancode/android')
    
  • Insert the following lines inside the dependencies block in android/app/build.gradle:

    compile project(':react-native-scancode')
    

Usage

// TODO: What to do with the module?
import { NativeModules } from "react-native";
const { WmsScanCode } = NativeModules;

//设置扫码选项(当PDA设备能通过广播进行设置的时候可用)
let obj={};
let list=[];
obj['key']='barcode_send_mode';
obj['value']='BROADCAST';
list.push(obj);
WmsScanCode.setBroadcastSetting('com.android.scanner.service_settings',list);

//广播和接收字段(接收的广播名和接收的字段名)
WmsScanCode.getCode('android.intent.action.SCANRESULT','value');

//接收扫描结果
import { DeviceEventEmitter } from "react-native";
componentWillMount() {
  if (this.searchListener) {
    this.searchListener.remove();
  }
  this.searchListener = DeviceEventEmitter.addListener("scannerCodeShow",e => {
    console.log(e.code)
    }
  )
}
//退出页面移除监听
componentWillUnmount() {
  if (this.searchListener) {
    DeviceEventEmitter.removeListener("scannerCodeShow");
    this.searchListener.remove();
    this.searchListener = null;
  }
}


Keywords

react-native

FAQs

Package last updated on 27 Sep 2019

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

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.