Portable xprinter native module for react-native
npm install react-native-xprinter-thermal-blesh
yarn add react-native-xprinter-thermal-ble
`
Add service to `AndroidManifest.xml`
`xml
android:name=".MainActivity"
android:label="@string/app_name"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|screenSize|smallestScreenSize|uiMode"
android:launchMode="singleTask"
android:windowSoftInputMode="adjustResize"
android:exported="true">
`
Usage
`ts
import { XprinterThermal } from "react-native-xprinter-thermal-ble";
// ...
// Interface for xprinter module
interface IXprinterThermal {
isConnected: () => Promise;
rebindService: () => Promise;
connectNet: (ip: string, port: number) => Promise;
connectBle: (bleAddress: string) => Promise;
disconnect: () => Promise;
addEmptyLine: () => void;
addText: (content: string) => void;
addBarcode: (content: string, width?: number, height?: number) => void;
addQRcode: (content: string, width?: number) => void;
print: () => Promise;
}
``