Closed thecodecafe closed 6 months ago
I've been able to detect what's causing the issue.
The connected_ip
attribute on the RNNetPrinter class does not reflect the change; even when you set its value to the host IP address it does not seem to update.
I know zilch about writing Objective-C so I'm not going to be able to send a good PR to fix that, I have however patched the library on my project to exclude that piece of code. I patched the library in the following way:
Note you will have to monitor on your own end to know when the printer has been connected to by just maintaining a variable you set to true or false since the patch comments out the code that does that for you from within the library.
When you attempt connecting with the NetPrinter it never connects, you do not get the connected printer's info (See connect code here), you instead get a string returned saying that it's "Connecting to Printer [the host IP address]". Then when I attempt printing I get an error saying the "Can't connect to printer".
What code are you running and what is happening?
Expected Behavior
I expect the printing functionality to work since the PrinterSDK used in the RNNetPrinter.m file did not fail to connect.
Also, the return type for the connectPrinter method should be an object with the printer's host, port, and name as the type suggests and not a string saying that it's connecting.
Although I'm curious has the NetPrinter ever worked in the past?
How to reproduce
NetPrinter.init()
.This returns undefined
Connecting to printer [host IP address]
.NetPrinter.printText("Hello")
. Logs a warning sayingCan't connect to printer
.Your Environment