react-native-exit-app icon indicating copy to clipboard operation
react-native-exit-app copied to clipboard

Patch for builing issues in RN 0.78

Open alexeyfof opened this issue 8 months ago • 5 comments

Hi! 👋

Firstly, thanks for your work on this project! 🙂

Today I used patch-package to patch [email protected] for the project I'm working on.

'React-Codegen/RNExitAppSpec/RNExitAppSpec.h' file not found

I faced this issue after upgraded RN to 0.78

Here is the diff that solved my problem:

diff --git a/node_modules/react-native-exit-app/ios/RNExitApp/RNExitApp.h b/node_modules/react-native-exit-app/ios/RNExitApp/RNExitApp.h
index 50a2135..4a598a3 100644
--- a/node_modules/react-native-exit-app/ios/RNExitApp/RNExitApp.h
+++ b/node_modules/react-native-exit-app/ios/RNExitApp/RNExitApp.h
@@ -7,7 +7,7 @@
 #endif
 
 #if RCT_NEW_ARCH_ENABLED
-#import <React-Codegen/RNExitAppSpec/RNExitAppSpec.h>
+#import <ReactCodegen/RNExitAppSpec/RNExitAppSpec.h>
 #endif
 
 @interface RNExitApp : NSObject <RCTBridgeModule>
diff --git a/node_modules/react-native-exit-app/ios/RNExitApp/RNExitApp.mm b/node_modules/react-native-exit-app/ios/RNExitApp/RNExitApp.mm
index bec5948..f2a8743 100644
--- a/node_modules/react-native-exit-app/ios/RNExitApp/RNExitApp.mm
+++ b/node_modules/react-native-exit-app/ios/RNExitApp/RNExitApp.mm
@@ -3,7 +3,7 @@
 #import "RNExitApp.h"
 
 #if RCT_NEW_ARCH_ENABLED
-#import <RNExitAppSpec/RNExitAppSpec.h>
+#import <ReactCodegen/RNExitAppSpec/RNExitAppSpec.h>
 #endif
 
 @implementation RNExitApp

This issue body was partially generated by patch-package.

alexeyfof avatar Apr 02 '25 12:04 alexeyfof

if you are working with RCT_NEW_ARCH_ENABLED = true

just remove this lines from : "node_modules/react-native-exit-app/ios/RNExitApp/RNExitApp.mm"

#if RCT_NEW_ARCH_ENABLED #import <RNExitAppSpec/RNExitAppSpec.h #endif

malekkbh avatar Apr 16 '25 19:04 malekkbh

Thanks!

joaquinvaz avatar Apr 21 '25 14:04 joaquinvaz

+1

AbdullahZareen avatar Apr 23 '25 03:04 AbdullahZareen

In my case, this patch didn't solve my problem; I kept getting the same error. I ended up having to update the podspec and iOS files differently to fix the problem.

This patch is working for me: // patches/react-native-exit-app+2.0.0.patch

diff --git a/node_modules/react-native-exit-app/RNExitApp.podspec b/node_modules/react-native-exit-app/RNExitApp.podspec
index 7290b50..8974588 100644
--- a/node_modules/react-native-exit-app/RNExitApp.podspec
+++ b/node_modules/react-native-exit-app/RNExitApp.podspec
@@ -1,6 +1,6 @@
 require 'json'
 
-packageJson = JSON.parse(File.read('package.json'))
+packageJson = JSON.parse(File.read(File.join(__dir__, "package.json")))
 version = packageJson["version"]
 description = packageJson["description"]
 homepage = packageJson["homepage"]
@@ -11,33 +11,23 @@ iqVersion = version.split('-').first
 
 Pod::Spec.new do |s|
 	s.name           = "RNExitApp"
+
 	s.version        = version
-	s.description    = description
-	s.homepage       = homepage
-	s.summary        = "Exit,close,kill,shutdown app completely for React Native"
 	s.license        = license
+	s.summary        = "Exit,close,kill,shutdown app completely for React Native"
 	s.authors        = author
-	s.source         = { :git => repository, :tag => version }
-	s.platforms      = { :ios => "9.0", :tvos => "11.0" }
-	s.preserve_paths = 'README.md', 'package.json', '*.js'
-	s.source_files   = 'ios/RNExitApp/**/*.{h,m,mm}'
+	s.homepage       = homepage
+	s.description    = description
 	
-	s.dependency 'React-Core'
+	s.platforms      = { :ios => "12.4", :tvos => "12.4" }
+	s.requires_arc = true
 
-	# Don't install the dependencies when we run `pod install` in the old architecture.
-	if ENV["RCT_NEW_ARCH_ENABLED"] == "1"
-	  s.compiler_flags = folly_flags + " -DRCT_NEW_ARCH_ENABLED=1"
-	  s.pod_target_xcconfig    = {
-		"HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\"",
-		"OTHER_CPLUSPLUSFLAGS" => "-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1",
-		"CLANG_CXX_LANGUAGE_STANDARD" => "c++17"
-	  }
+	s.source         = { :git => repository, :tag => version }
+	s.source_files   = 'ios/RNExitApp/**/*.{h,m,mm}'
   
-	  s.dependency "React-Codegen"
-	  s.dependency "React-RCTFabric"
-	  s.dependency "RCT-Folly"
-	  s.dependency "RCTRequired"
-	  s.dependency "RCTTypeSafety"
-	  s.dependency "ReactCommon/turbomodule/core"
-	end
+	if ENV['RCT_NEW_ARCH_ENABLED'] == '1' then
+    install_modules_dependencies(s)
+  else
+    s.dependency "React-Core"
+  end
 end
diff --git a/node_modules/react-native-exit-app/ios/RNExitApp/RNExitApp.h b/node_modules/react-native-exit-app/ios/RNExitApp/RNExitApp.h
index 50a2135..ef6dec4 100644
--- a/node_modules/react-native-exit-app/ios/RNExitApp/RNExitApp.h
+++ b/node_modules/react-native-exit-app/ios/RNExitApp/RNExitApp.h
@@ -1,19 +1,13 @@
-#if __has_include(<React/RCTBridgeModule.h>)
-#import <React/RCTBridgeModule.h>
-#elif __has_include("RCTBridgeModule.h")
-#import "RCTBridgeModule.h"
+#ifdef RCT_NEW_ARCH_ENABLED
+
+#import <RNExitAppSpec/RNExitAppSpec.h>
+@interface RNExitApp : NSObject <NativeRNExitAppSpec>
+
 #else
-#import "React/RCTBridgeModule.h"
-#endif
 
-#if RCT_NEW_ARCH_ENABLED
-#import <React-Codegen/RNExitAppSpec/RNExitAppSpec.h>
-#endif
+#import <React/RCTBridgeModule.h>
+@interface RNExitApp : NSObject <RCTBridgeModule>s
 
-@interface RNExitApp : NSObject <RCTBridgeModule>
-@end
+#endif
 
-#if RCT_NEW_ARCH_ENABLED
-@interface RNExitApp () <NativeRNExitAppSpec>
 @end
-#endif
diff --git a/node_modules/react-native-exit-app/ios/RNExitApp/RNExitApp.mm b/node_modules/react-native-exit-app/ios/RNExitApp/RNExitApp.mm
index bec5948..2199b8c 100644
--- a/node_modules/react-native-exit-app/ios/RNExitApp/RNExitApp.mm
+++ b/node_modules/react-native-exit-app/ios/RNExitApp/RNExitApp.mm
@@ -2,10 +2,6 @@
 
 #import "RNExitApp.h"
 
-#if RCT_NEW_ARCH_ENABLED
-#import <RNExitAppSpec/RNExitAppSpec.h>
-#endif
-
 @implementation RNExitApp
 
 RCT_EXPORT_MODULE();
@@ -17,11 +13,9 @@ @implementation RNExitApp
 
 # pragma mark - New Architecture
 
-#if RCT_NEW_ARCH_ENABLED
+#ifdef RCT_NEW_ARCH_ENABLED
 
-- (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:
-    (const facebook::react::ObjCTurboModule::InitParams &)params
-{
+- (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:(const facebook::react::ObjCTurboModule::InitParams &)params {
     return std::make_shared<facebook::react::NativeRNExitAppSpecJSI>(params);
 }

ahc2806 avatar Apr 24 '25 06:04 ahc2806

@ahc2806 patch didn't work but base on his patch this one create with the help of AI worked for me.

"react-native-exit-app": "^2.0.0", // patches/react-native-exit-app+2.0.0.patch


diff --git a/node_modules/react-native-exit-app/RNExitApp.podspec b/node_modules/react-native-exit-app/RNExitApp.podspec
index 7290b50..f40520a 100644
--- a/node_modules/react-native-exit-app/RNExitApp.podspec
+++ b/node_modules/react-native-exit-app/RNExitApp.podspec
@@ -1,6 +1,6 @@
 require 'json'
 
-packageJson = JSON.parse(File.read('package.json'))
+packageJson = JSON.parse(File.read(File.join(__dir__, "package.json")))
 version = packageJson["version"]
 description = packageJson["description"]
 homepage = packageJson["homepage"]
@@ -17,27 +17,15 @@ Pod::Spec.new do |s|
 	s.summary        = "Exit,close,kill,shutdown app completely for React Native"
 	s.license        = license
 	s.authors        = author
+	s.platforms      = { :ios => "12.4", :tvos => "12.4" }
+	s.requires_arc = true
+
 	s.source         = { :git => repository, :tag => version }
-	s.platforms      = { :ios => "9.0", :tvos => "11.0" }
-	s.preserve_paths = 'README.md', 'package.json', '*.js'
 	s.source_files   = 'ios/RNExitApp/**/*.{h,m,mm}'
 
-	s.dependency 'React-Core'
-  
-	# Don't install the dependencies when we run `pod install` in the old architecture.
-	if ENV["RCT_NEW_ARCH_ENABLED"] == "1"
-	  s.compiler_flags = folly_flags + " -DRCT_NEW_ARCH_ENABLED=1"
-	  s.pod_target_xcconfig    = {
-		"HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\"",
-		"OTHER_CPLUSPLUSFLAGS" => "-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1",
-		"CLANG_CXX_LANGUAGE_STANDARD" => "c++17"
-	  }
-  
-	  s.dependency "React-Codegen"
-	  s.dependency "React-RCTFabric"
-	  s.dependency "RCT-Folly"
-	  s.dependency "RCTRequired"
-	  s.dependency "RCTTypeSafety"
-	  s.dependency "ReactCommon/turbomodule/core"
+	if ENV['RCT_NEW_ARCH_ENABLED'] == '1' then
+		install_modules_dependencies(s)
+	else
+		s.dependency "React-Core"
 	end
 end
diff --git a/node_modules/react-native-exit-app/ios/RNExitApp/RNExitApp.h b/node_modules/react-native-exit-app/ios/RNExitApp/RNExitApp.h
index 50a2135..e669051 100644
--- a/node_modules/react-native-exit-app/ios/RNExitApp/RNExitApp.h
+++ b/node_modules/react-native-exit-app/ios/RNExitApp/RNExitApp.h
@@ -1,19 +1,9 @@
-#if __has_include(<React/RCTBridgeModule.h>)
-#import <React/RCTBridgeModule.h>
-#elif __has_include("RCTBridgeModule.h")
-#import "RCTBridgeModule.h"
+#ifdef RCT_NEW_ARCH_ENABLED
+#import <RNExitAppSpec/RNExitAppSpec.h>
+@interface RNExitApp : NSObject <NativeRNExitAppSpec>
 #else
-#import "React/RCTBridgeModule.h"
-#endif
-
-#if RCT_NEW_ARCH_ENABLED
-#import <React-Codegen/RNExitAppSpec/RNExitAppSpec.h>
-#endif
-
+#import <React/RCTBridgeModule.h>
 @interface RNExitApp : NSObject <RCTBridgeModule>
-@end
+#endif
 
-#if RCT_NEW_ARCH_ENABLED
-@interface RNExitApp () <NativeRNExitAppSpec>
 @end
-#endif
diff --git a/node_modules/react-native-exit-app/ios/RNExitApp/RNExitApp.mm b/node_modules/react-native-exit-app/ios/RNExitApp/RNExitApp.mm
index bec5948..1cdb55b 100644
--- a/node_modules/react-native-exit-app/ios/RNExitApp/RNExitApp.mm
+++ b/node_modules/react-native-exit-app/ios/RNExitApp/RNExitApp.mm
@@ -2,7 +2,7 @@
 
 #import "RNExitApp.h"
 
-#if RCT_NEW_ARCH_ENABLED
+#ifdef RCT_NEW_ARCH_ENABLED
 #import <RNExitAppSpec/RNExitAppSpec.h>
 #endif
 
@@ -17,11 +17,9 @@ RCT_EXPORT_METHOD(exitApp)
 
 # pragma mark - New Architecture
 
-#if RCT_NEW_ARCH_ENABLED
+#ifdef RCT_NEW_ARCH_ENABLED
 
-- (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:
-    (const facebook::react::ObjCTurboModule::InitParams &)params
-{
+- (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:(const facebook::react::ObjCTurboModule::InitParams &)params {
     return std::make_shared<facebook::react::NativeRNExitAppSpecJSI>(params);
 } 

bk-software avatar Apr 29 '25 20:04 bk-software