support sdk and printer
npm install xprinter-core-moduleThis TurboModule provides a native interface for interacting with an x-printer in React Native applications.
```
npm install xprinter-core-module
``
yarn add xprinter-core-module
For React Native versions < 0.60, link the native module:
``
react-native link xprinter-core-module
For React Native 0.60 and above, the module should be auto-linked.
Import the module in your JavaScript code:
`javascript`
import {
connectInternet,
disconnect,
printText,
sendData,
printText,
} from 'xprinter-core-module';
Connects to the printer using the provided IP address.
Example:
`javascript`
try {
const result = await connectInternet('192.168.1.100');
console.log(result);
} catch (error) {
console.error('Connection failed:', error);
}
Disconnects from the currently connected printer.
Example:
`javascript`
try {
const result = await disconnect();
console.log(result);
} catch (error) {
console.error('Disconnection failed:', error);
}
Sends raw data to the printer.
Example:
`javascript`
try {
const result = await sendData('Raw printer data');
console.log(result);
} catch (error) {
console.error('Failed to send data:', error);
}
Prints text with specified formatting options.
Example:
`javascript``
try {
const result = await printText('Hello, Printer!', 1, 0, true, 12);
console.log(result);
} catch (error) {
console.error('Printing failed:', error);
}