From 960271341bec335d6eb4bce9d2a56a2c1c97348c Mon Sep 17 00:00:00 2001 From: Phil Pluckthun Date: Fri, 19 Dec 2025 15:33:25 +0000 Subject: [PATCH] Resolve `use_react_native!(path)` param from pwd The `path` argument in `react_native_pods.rb` is not resolved but instead later joined using `File.join(relative_path_from_current, path)`. This doesn't actually resolve the path, meaning, if `path` is absolute it's appended to this first relative path. Instead, we should use `Pathname#join` and join the path to the pathname, guaranteeing it to be absolute, then construct relative paths (for the prefix) using `relative_path_from` against the installation root. --- packages/react-native/scripts/react_native_pods.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/react-native/scripts/react_native_pods.rb b/packages/react-native/scripts/react_native_pods.rb index 44dbd2e83fc480..aeb3ef9f967524 100644 --- a/packages/react-native/scripts/react_native_pods.rb +++ b/packages/react-native/scripts/react_native_pods.rb @@ -75,10 +75,13 @@ def use_react_native! ( error_if_try_to_use_jsc_from_core() warn_if_new_arch_disabled() + react_native_path = Pathname.pwd.join(path) + prefix = react_native_path.relative_path_from(Pod::Config.instance.installation_root) + hermes_enabled= true # Set the app_path as env variable so the podspecs can access it. ENV['APP_PATH'] = app_path - ENV['REACT_NATIVE_PATH'] = path + ENV['REACT_NATIVE_PATH'] = react_native_path.to_s # We set RCT_SKIP_CODEGEN to true, if the user wants to skip the running Codegen step from Cocoapods. # This is needed as part of our migration away from cocoapods @@ -102,16 +105,13 @@ def use_react_native! ( # We are relying on this flag also in third parties libraries to proper install dependencies. # Better to rely and enable this environment flag if the new architecture is turned on using flags. - relative_path_from_current = Pod::Config.instance.installation_root.relative_path_from(Pathname.pwd) - react_native_version = NewArchitectureHelper.extract_react_native_version(File.join(relative_path_from_current, path)) + react_native_version = NewArchitectureHelper.extract_react_native_version(react_native_path) fabric_enabled = true ENV['RCT_FABRIC_ENABLED'] = "1" ENV['RCT_AGGREGATE_PRIVACY_FILES'] = privacy_file_aggregation_enabled ? "1" : "0" ENV["RCT_NEW_ARCH_ENABLED"] = "1" - prefix = path - ReactNativePodsUtils.warn_if_not_on_arm64() # Update ReactNativeDependencies so that we can easily switch between source and prebuilt