Skip to content

Commit

Permalink
[PATCH] [RN][iOS][0.71] Fix flipper for Xcode 15.3
Browse files Browse the repository at this point in the history
  • Loading branch information
pxpeterxu committed Mar 9, 2024
1 parent 2cf8c0a commit 8417e41
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
3 changes: 3 additions & 0 deletions WanderlogPatches.md
Expand Up @@ -51,3 +51,6 @@ rebase on upstream's `main`
- Wrap NullPointerExceptions when thrown by native code called from JS for readability
- 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.
- Pull request: https://github.com/facebook/react-native/pull/38060
- Fix flipper for Xcode 15.3
- 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
- Pull request: https://github.com/facebook/react-native/pull/43345
21 changes: 21 additions & 0 deletions scripts/cocoapods/utils.rb
Expand Up @@ -131,6 +131,27 @@ def self.apply_mac_catalyst_patches(installer)
end
end

def self.fix_flipper_for_xcode_15_3(installer)
installer.pods_project.targets.each do |target|
if target.name == 'Flipper'
file_path = 'Pods/Flipper/xplat/Flipper/FlipperTransportTypes.h'
if !File.exist?(file_path)
return
end

contents = File.read(file_path)
if contents.include?('#include <functional>')
return
end
mod_content = contents.gsub("#pragma once", "#pragma once\n#include <functional>")
File.chmod(0755, file_path)
File.open(file_path, 'w') do |file|
file.puts(mod_content)
end
end
end
end

private

def self.fix_library_search_path(config)
Expand Down
1 change: 1 addition & 0 deletions scripts/react_native_pods.rb
Expand Up @@ -223,6 +223,7 @@ def react_native_post_install(installer, react_native_path = "../node_modules/re
ReactNativePodsUtils.exclude_i386_architecture_while_using_hermes(installer)
ReactNativePodsUtils.fix_library_search_paths(installer)
ReactNativePodsUtils.set_node_modules_user_settings(installer, react_native_path)
ReactNativePodsUtils.fix_flipper_for_xcode_15_3(installer)

NewArchitectureHelper.set_clang_cxx_language_standard_if_needed(installer)
is_new_arch_enabled = ENV['RCT_NEW_ARCH_ENABLED'] == "1"
Expand Down

0 comments on commit 8417e41

Please sign in to comment.