Skip to content

Commit

Permalink
fix: port of net printer should be number
Browse files Browse the repository at this point in the history
  • Loading branch information
HeligPfleigh committed Apr 7, 2021
1 parent 92adee4 commit 8c1b104
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion example/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export default function App() {
case "net":
await NetPrinter.connectPrinter(
selectedPrinter?.host || "",
selectedPrinter?.port || ""
selectedPrinter?.port || 9100
);
break;
case "usb":
Expand Down
2 changes: 1 addition & 1 deletion ios/RNNetPrinter.m
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ - (void)handleBLEPrinterConnectedNotification:(NSNotification*)notification
}

RCT_EXPORT_METHOD(connectPrinter:(NSString *)host
withPort:(NSString *)port
withPort:(NSNumber *)port
success:(RCTResponseSenderBlock)successCallback
fail:(RCTResponseSenderBlock)errorCallback) {
@try {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-native-thermal-receipt-printer",
"version": "1.1.5",
"version": "1.1.6-rc.1",
"description": "Fork of react-native-printer. A React Native Library to support USB/BLE/Net printer",
"main": "dist/index.js",
"source": "dist/index.js",
Expand Down
4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export interface IBLEPrinter {
export interface INetPrinter {
device_name: string;
host: string;
port: string;
port: number;
}

const textTo64Buffer = (text: string, opts: PrinterOptions) => {
Expand Down Expand Up @@ -213,7 +213,7 @@ export const NetPrinter = {
)
),

connectPrinter: (host: string, port: string): Promise<INetPrinter> =>
connectPrinter: (host: string, port: number): Promise<INetPrinter> =>
new Promise((resolve, reject) =>
RNNetPrinter.connectPrinter(
host,
Expand Down

0 comments on commit 8c1b104

Please sign in to comment.