Skip to content

Commit 8417e41

Browse files
committed
[PATCH] [RN][iOS][0.71] Fix flipper for Xcode 15.3
react#43345
1 parent 2cf8c0a commit 8417e41

3 files changed

Lines changed: 25 additions & 0 deletions

File tree

WanderlogPatches.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,3 +51,6 @@ rebase on upstream's `main`
5151
- Wrap NullPointerExceptions when thrown by native code called from JS for readability
5252
- Summary: These crashing exceptions were really hard to debug in Bugsnag since they don't print the method name. We wrap it and add that.
5353
- Pull request: https://github.com/facebook/react-native/pull/38060
54+
- Fix flipper for Xcode 15.3
55+
- Summary: Official upstream patch: Xcode 15.3 requires us to add a new import of #include <functional> to ios/Pods/Flipper/xplat/Flipper/FlipperTransportTypes.h
56+
- Pull request: https://github.com/facebook/react-native/pull/43345

scripts/cocoapods/utils.rb

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,27 @@ def self.apply_mac_catalyst_patches(installer)
131131
end
132132
end
133133

134+
def self.fix_flipper_for_xcode_15_3(installer)
135+
installer.pods_project.targets.each do |target|
136+
if target.name == 'Flipper'
137+
file_path = 'Pods/Flipper/xplat/Flipper/FlipperTransportTypes.h'
138+
if !File.exist?(file_path)
139+
return
140+
end
141+
142+
contents = File.read(file_path)
143+
if contents.include?('#include <functional>')
144+
return
145+
end
146+
mod_content = contents.gsub("#pragma once", "#pragma once\n#include <functional>")
147+
File.chmod(0755, file_path)
148+
File.open(file_path, 'w') do |file|
149+
file.puts(mod_content)
150+
end
151+
end
152+
end
153+
end
154+
134155
private
135156

136157
def self.fix_library_search_path(config)

scripts/react_native_pods.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,7 @@ def react_native_post_install(installer, react_native_path = "../node_modules/re
223223
ReactNativePodsUtils.exclude_i386_architecture_while_using_hermes(installer)
224224
ReactNativePodsUtils.fix_library_search_paths(installer)
225225
ReactNativePodsUtils.set_node_modules_user_settings(installer, react_native_path)
226+
ReactNativePodsUtils.fix_flipper_for_xcode_15_3(installer)
226227

227228
NewArchitectureHelper.set_clang_cxx_language_standard_if_needed(installer)
228229
is_new_arch_enabled = ENV['RCT_NEW_ARCH_ENABLED'] == "1"

0 commit comments

Comments
 (0)