React-Native plugin for the bluetooth ESC/POS & TSC printers.
If your are using this lib. The code example on file BluetoothConfig.js
can help you.
Install via NPM Check In NPM
npm install react-native-bluetooth-escpos-printer --save
Or install via github
npm install https://github.com/januslo/react-native-bluetooth-escpos-printer.git --save
Link the plugin to your RN project
react-native link react-native-bluetooth-escpos-printer
Refers to your JS files
import {BluetoothManager,BluetoothEscposPrinter,BluetoothTscPrinter} from 'react-native-bluetooth-escpos-printer';
If you need print in other screen in your project you need follow the sequence.
Connect on printer
Using BluetoothConfig.js
you scan devices and test print.
To print in others screens you need use the code:
import {
BluetoothEscposPrinter
} from 'react-native-bluetooth-escpos-printer';
.
.
.
// Something like
<Button
onPress={async () => {
await BluetoothEscposPrinter.printerInit();
await BluetoothEscposPrinter.printText("Test print success.!!!\r\n\r\n", {});
}} title="Test Print"/>