Replies: 2 comments 7 replies
-
I have the printer connected to the lan and I'm in the same network, is this the issue maybe? |
Beta Was this translation helpful? Give feedback.
7 replies
-
Resolved. The issue was in the running not on a real device. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm trying to write a simple script to print something but I can't connect to the printer.
Can anyone please help me?
I get the error: PrinterError: Failed to communicate with the devices within the specified time.
this is my code:
import React, {useState, useMemo} from 'react';
import {Button, Alert} from 'react-native';
import {Printer, PrinterConstants} from 'react-native-esc-pos-printer';
const PrintKitchenOrderButton = () => {
const [isLoading, setIsLoading] = useState(false);
const printerInstance = useMemo(
() =>
new Printer({
target: 'TCP:192.168.28.100',
deviceName: 'TM-T20III',
port: 8008,
}),
[],
);
// Function to print
const printReceipt = async () => {
try {
setIsLoading(true);
const connection = await printerInstance.connect();
console.log('connection', connection);
};
return (
<Button
title={isLoading ? 'Printing...' : 'Print Kitchen Order'}
onPress={printReceipt}
disabled={isLoading}
/>
);
};
export default PrintKitchenOrderButton;
Thanks a lot in advance
Beta Was this translation helpful? Give feedback.
All reactions