react-native-xprinter-thermal-ble
v0.1.10
Published
Portable xprinter native module for react-native
Downloads
2
Maintainers
Readme
react-native-xprinter-thermal
Portable xprinter sdk for react native android only
Installation
yarn add react-native-xprinter-thermal-ble
Add service to AndroidManifest.xml
<activity
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">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<!-- Add service below -->
<service android:name="net.posprinter.service.PosprinterService" >
</service>
<!-- End -->
</application>
Usage
import { XprinterThermal } from "react-native-xprinter-thermal-ble";
// ...
// Interface for xprinter module
interface IXprinterThermal {
isConnected: () => Promise<boolean>;
rebindService: () => Promise<any>;
connectNet: (ip: string, port: number) => Promise<void>;
connectBle: (bleAddress: string) => Promise<void>;
disconnect: () => Promise<void>;
addEmptyLine: () => void;
addText: (content: string) => void;
addBarcode: (content: string, width?: number, height?: number) => void;
addQRcode: (content: string, width?: number) => void;
print: () => Promise<string>;
}
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