MinaSamir11 / react-native-in-app-review

The Google Play In-App Review API, App store rating API lets you prompt users to submit Play Store or App store ratings and reviews without the inconvenience of leaving your app or game.
MIT License
647 stars 57 forks source link

Error on iOS build with Expo SDK 44 - duplicate interface definition for class 'RCTModuleRegistry' #106

Closed DenianFossatti closed 2 years ago

DenianFossatti commented 2 years ago

Hi! 👋

Firstly, thanks for your work on this project! 🙂

Today I used patch-package to patch react-native-in-app-review@3.3.2 for the project I'm working on.

Started after install expo and expo-updates.

References from same error with suggested fix:

https://github.com/ibitcy/react-native-hole-view/issues/12 https://github.com/expo/expo/pull/15626 https://github.com/LinusU/react-native-get-random-values/pull/33/files https://github.com/expo/expo/issues/15622#issuecomment-997225774 https://github.com/expo/expo/pull/15626

------------------- LOG -----------------------

❌ (/ios/Pods/Headers/Public/React-Core/React/RCTBridgeModule.h:415:1)

413 | A class that allows NativeModules and TurboModules to look up one another. 414 | /

415 | @interface RCTModuleRegistry : NSObject | ^ duplicate interface definition for class 'RCTModuleRegistry' 416 | - (void)setBridge:(RCTBridge *)bridge; 417 | - (void)setTurboModuleRegistry:(id)turboModuleRegistry; 418 |

❌ (/ios/Pods/Headers/Public/React-Core/React/RCTBridgeModule.h:429:1)

427 | A class that allows NativeModules/TurboModules to read/write the bundleURL, with or without the bridge. 428 | /

429 | @interface RCTBundleManager : NSObject | ^ duplicate interface definition for class 'RCTBundleManager' 430 | - (void)setBridge:(RCTBridge *)bridge; 431 | - (void)setBridgelessBundleURLGetter:(RCTBridgelessBundleURLGetter)getter 432 | andSetter:(RCTBridgelessBundleURLSetter)setter

❌ (/ios/Pods/Headers/Public/React-Core/React/RCTBridgeModule.h:435:18)

433 | andDefaultGetter:(RCTBridgelessBundleURLGetter)defaultGetter; 434 | - (void)resetBundleURL;

435 | @property NSURL bundleURL; | ^ property has a previous declaration 436 | @end 437 | 438 | typedef UIView (^RCTBridgelessComponentViewProvider)(NSNumber *);

❌ (/ios/Pods/Headers/Public/React-Core/React/RCTBridgeModule.h:443:1)

441 | A class that allows NativeModules to query for views, given React Tags. 442 | /

443 | @interface RCTViewRegistry : NSObject | ^ duplicate interface definition for class 'RCTViewRegistry' 444 | - (void)setBridge:(RCTBridge *)bridge; 445 | - (void)setBridgelessComponentViewProvider:(RCTBridgelessComponentViewProvider)bridgelessComponentViewProvider; 446 |

❌ (/ios/Pods/Headers/Public/React-Core/React/RCTBridgeModule.h:460:1)

458 | as callable with React Native. 459 | /

460 | @interface RCTCallableJSModules : NSObject | ^ duplicate interface definition for class 'RCTCallableJSModules' 461 | - (void)setBridge:(RCTBridge *)bridge; 462 | - (void)setBridgelessJSModuleMethodInvoker:(RCTBridgelessJSModuleMethodInvoker)bridgelessJSModuleMethodInvoker; 463 |

› Compiling » ExpoModulesProvider.swift › Executing react-native-config Pods/react-native-config » [CP-User] Config codegen › Compiling react-native-reanimated Pods/RNReanimated » FrozenObject.cpp › Compiling react-native-reanimated Pods/RNReanimated » NativeProxy.mm › Compiling react-native-reanimated Pods/RNReanimated » EventHandlerRegistry.cpp › Compiling expo-updates Pods/EXUpdates » EXUpdatesUtils.m › Compiling expo-updates Pods/EXUpdates » EXUpdatesUpdate.m › Compiling react-native-screens Pods/RNScreens » UIViewController+RNScreens.m

› 5 error(s), and 0 warning(s)

Failed to build iOS project. "xcodebuild" exited with error code 65. error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

------------------- END LOG ------------------

Here is the diff that solved my problem:

diff --git a/node_modules/react-native-in-app-review/ios/RNInAppReviewIOS-Bridging-Header.h b/node_modules/react-native-in-app-review/ios/RNInAppReviewIOS-Bridging-Header.h
index 129af5f..279ad57 100755
--- a/node_modules/react-native-in-app-review/ios/RNInAppReviewIOS-Bridging-Header.h
+++ b/node_modules/react-native-in-app-review/ios/RNInAppReviewIOS-Bridging-Header.h
@@ -1,5 +1 @@
-#if __has_include("RCTBridgeModule.h")
-#import "RCTBridgeModule.h"
-#else
 #import <React/RCTBridgeModule.h>
-#endif
diff --git a/node_modules/react-native-in-app-review/ios/RNInAppReviewIOS.m b/node_modules/react-native-in-app-review/ios/RNInAppReviewIOS.m
index 5055e2e..3f158e8 100755
--- a/node_modules/react-native-in-app-review/ios/RNInAppReviewIOS.m
+++ b/node_modules/react-native-in-app-review/ios/RNInAppReviewIOS.m
@@ -1,7 +1,7 @@
 #import <Foundation/Foundation.h>
 #import <StoreKit/SKStoreReviewController.h>
 #import <UIKit/UIKit.h>
-#import "RCTBridgeModule.h"
+#import <React/RCTBridgeModule.h>

 @interface RCT_EXTERN_MODULE(RNInAppReviewIOS, NSObject)

This issue body was partially generated by patch-package.

DenianFossatti commented 2 years ago

I create a pull request also:

https://github.com/MinaSamir11/react-native-in-app-review/pull/107

MinaSamir11 commented 2 years ago

PR Merged also update available on npm.

thanks a lot