Open hoanganhnh2009 opened 2 years ago
Hi! π
Firstly, thanks for your work on this project! π
Today I used patch-package to patch react-native-thermal-receipt-printer@1.1.5 for the project I'm working on.
react-native-thermal-receipt-printer@1.1.5
Here is the diff that solved my problem:
diff --git a/node_modules/react-native-thermal-receipt-printer/android/src/androidTest/java/com/pinmi/react/printer/ExampleInstrumentedTest.java b/node_modules/react-native-thermal-receipt-printer/android/src/androidTest/java/com/pinmi/react/printer/ExampleInstrumentedTest.java index 11b3ec6..882c0cd 100644 --- a/node_modules/react-native-thermal-receipt-printer/android/src/androidTest/java/com/pinmi/react/printer/ExampleInstrumentedTest.java +++ b/node_modules/react-native-thermal-receipt-printer/android/src/androidTest/java/com/pinmi/react/printer/ExampleInstrumentedTest.java @@ -1,8 +1,8 @@ package com.pinmi.react.printer; import android.content.Context; -import android.support.test.InstrumentationRegistry; -import android.support.test.runner.AndroidJUnit4; +import androidx.test.InstrumentationRegistry; +import androidx.test.runner.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; diff --git a/node_modules/react-native-thermal-receipt-printer/ios/RNBLEPrinter.m b/node_modules/react-native-thermal-receipt-printer/ios/RNBLEPrinter.m index 76ca852..f7a746e 100644 --- a/node_modules/react-native-thermal-receipt-printer/ios/RNBLEPrinter.m +++ b/node_modules/react-native-thermal-receipt-printer/ios/RNBLEPrinter.m @@ -99,7 +99,7 @@ RCT_EXPORT_METHOD(printRawData:(NSString *)text bold ? [[PrinterSDK defaultPrinterSDK] sendHex:@"1B2108"] : [[PrinterSDK defaultPrinterSDK] sendHex:@"1B2100"]; alignCenter ? [[PrinterSDK defaultPrinterSDK] sendHex:@"1B6102"] : [[PrinterSDK defaultPrinterSDK] sendHex:@"1B6101"]; - [[PrinterSDK defaultPrinterSDK] printText:text]; + [[PrinterSDK defaultPrinterSDK] sendHex:text]; NSNumber* beepPtr = [options valueForKey:@"beep"]; NSNumber* cutPtr = [options valueForKey:@"cut"]; diff --git a/node_modules/react-native-thermal-receipt-printer/ios/RNNetPrinter.m b/node_modules/react-native-thermal-receipt-printer/ios/RNNetPrinter.m index d340456..8bbebaf 100644 --- a/node_modules/react-native-thermal-receipt-printer/ios/RNNetPrinter.m +++ b/node_modules/react-native-thermal-receipt-printer/ios/RNNetPrinter.m @@ -131,7 +131,7 @@ RCT_EXPORT_METHOD(getDeviceList:(RCTResponseSenderBlock)successCallback } RCT_EXPORT_METHOD(connectPrinter:(NSString *)host - withPort:(NSNumber *)port + withPort:(nonnull NSNumber *)port success:(RCTResponseSenderBlock)successCallback fail:(RCTResponseSenderBlock)errorCallback) { @try { @@ -160,7 +160,7 @@ RCT_EXPORT_METHOD(printRawData:(NSString *)text !connected_ip ? [NSException raise:@"Invalid connection" format:@"Can't connect to printer"] : nil; // [[PrinterSDK defaultPrinterSDK] printTestPaper]; - [[PrinterSDK defaultPrinterSDK] printText:text]; + [[PrinterSDK defaultPrinterSDK] sendHex:text]; beep ? [[PrinterSDK defaultPrinterSDK] beep] : nil; cut ? [[PrinterSDK defaultPrinterSDK] cutPaper] : nil; } @catch (NSException *exception) {
This issue body was partially generated by patch-package.
Hi! π
Firstly, thanks for your work on this project! π
Today I used patch-package to patch
react-native-thermal-receipt-printer@1.1.5
for the project I'm working on.Here is the diff that solved my problem:
This issue body was partially generated by patch-package.