This project is forked from jeylabs/react-native-sunmi-v2-printer.
Offical Demos refer: https://github.com/shangmisunmi/SunmiPrinterDemo
Step 1.
Install from source
npm install https://github.com/kev-ac/react-native-sunmi-v2-printer.git --save
yarn add https://github.com/kev-ac/react-native-sunmi-v2-printer.git --save
Step 2: (For React-Native < 0.60)
Links this plugin to your project.
react-native link react-native-sunmi-v2-printer
or you may need to link manually
- modify settings.gradle
include ':react-native-sunmi-v2-printer'
project(':react-native-sunmi-v2-printer').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-sunmi-v2-printer/android')
- modify app/build.gradle,add dependenceie:
compile project(':react-native-sunmi-v2-printer')
- adds package references to MainPackage.java
import com.sunmi.v2.printer.SunmiV2PrinterPackage;
...
@Override
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage(),
new SunmiV2PrinterPackage()
);
}
Step 3:
Import in React-Native:
import SunmiV2Printer from 'react-native-sunmi-v2-printer';
Name | Type | Description |
---|---|---|
Constants | string | Printer's status |
hasPrinter | boolean | Is printer available |
printerVersion | string | Printer's version |
printerSerialNo | string | Printer's serial number |
printerModal | string | Printer's model |
Name | Description |
---|---|
OUT_OF_PAPER_ACTION | Printer of paper |
ERROR_ACTION | Printing error |
NORMAL_ACTION | Printing normal |
COVER_OPEN_ACTION | Printer's cover has open |
COVER_ERROR_ACTION | Printer's cover is unusal |
KNIFE_ERROR_1_ACTION | 切刀异常1-卡切刀 |
KNIFE_ERROR_2_ACTION | 切刀异常2-切刀修复 |
OVER_HEATING_ACITON | Printer is overheat |
FIRMWARE_UPDATING_ACITON | Upgrade printer's firmware |
Please check on example/
floder