From 696fb55881ff5cd08b22d15ca93bd225f422cf00 Mon Sep 17 00:00:00 2001 From: Mike Grabowski Date: Thu, 9 Apr 2020 10:27:12 -0700 Subject: [PATCH] Update default Podfile to not depend on a path (#28572) Summary: Recently, a default Podfile has been modified to not contain all the React Native pods, but use a helper method `use_react_native!`. While this is great, it assumes a hardcoded path of `../node_modules/react-native` to be always the correct location of the React Native. https://github.com/facebook/react-native/blob/d4d8887b5018782eeb3f26efa85125e6bbff73e4/scripts/autolink-ios.rb#L7-L9 Unfortunately, due to the way Ruby works, this completely hides the path away from the users. Before, they could have seen the wrong path explicitly in a Podfile and knew to update it to resolve path-related issues. With the current version in `master`, I can see a lot of issues where developers wonder how to resolve the path issues and how to pass the path itself. https://github.com/facebook/react-native/blob/4118d798265341061105f3a53550db83c66a71cb/template/ios/Podfile#L5-L10 This PR uses React Native CLI configuration (that is already used to link 3rd party dependencies) to explicitly define the correct path to the React Native. As a result, we don't have to change the paths here whether we're running monorepo or not. ## Changelog [IOS] [INTERNAL] - Always provide an explicit path to React Native Pull Request resolved: https://github.com/facebook/react-native/pull/28572 Differential Revision: D20945194 Pulled By: TheSavior fbshipit-source-id: 010f9754f2ed78ef62fd52f4d201f296f5af6d27 --- template/ios/Podfile | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/template/ios/Podfile b/template/ios/Podfile index d6f78d75e05171..6e1ebd6181167f 100644 --- a/template/ios/Podfile +++ b/template/ios/Podfile @@ -4,16 +4,15 @@ require_relative '../node_modules/@react-native-community/cli-platform-ios/nativ platform :ios, '10.0' target 'HelloWorld' do - # Pods for HelloWorld - use_react_native! + config = use_native_modules! + + use_react_native!(:path => config["reactNativePath"]) target 'HelloWorldTests' do inherit! :complete # Pods for testing end - use_native_modules! - # Enables Flipper. # # Note that if you have use_frameworks! enabled, Flipper will not work and