yevheniionipko / react-native-apple-payment

Apple Pay for React Native
MIT License
15 stars 9 forks source link

Update ApplePay.m #3

Closed alzalabany closed 1 year ago

alzalabany commented 2 years ago

Hi! 👋

Firstly, thanks for your work on this project! 🙂

Today I used patch-package to patch react-native-apple-payment@1.1.1 for the project I'm working on.

to suppress WARN Module ApplePay requires main queue setup since it overridesinitbut doesn't implementrequiresMainQueueSetup. In a future release React Native will default to initializing all native modules on a background thread unless explicitly opted-out of. warning we need to add requiresMainQueueSetup

From React native docs [https://reactnative.dev/docs/0.63/native-modules-ios]

Here is the diff that solved my problem:

diff --git a/node_modules/react-native-apple-payment/ios/ApplePay.m b/node_modules/react-native-apple-payment/ios/ApplePay.m
index d9412ea..daf33db 100644
--- a/node_modules/react-native-apple-payment/ios/ApplePay.m
+++ b/node_modules/react-native-apple-payment/ios/ApplePay.m
@@ -10,5 +10,8 @@ @interface RCT_EXTERN_MODULE(ApplePay, NSObject)

 RCT_EXTERN_METHOD(canMakePayments:(RCTPromiseResolveBlock)resolve
                  withRejecter:(RCTPromiseRejectBlock)reject)
-
++ (BOOL)requiresMainQueueSetup
+{
+  return NO;
+}
 @end