Skip to content

Commit 696fb55

Browse files
committed
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: #28572 Differential Revision: D20945194 Pulled By: TheSavior fbshipit-source-id: 010f9754f2ed78ef62fd52f4d201f296f5af6d27
1 parent c7f2595 commit 696fb55

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

template/ios/Podfile

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,15 @@ require_relative '../node_modules/@react-native-community/cli-platform-ios/nativ
44
platform :ios, '10.0'
55

66
target 'HelloWorld' do
7-
# Pods for HelloWorld
8-
use_react_native!
7+
config = use_native_modules!
8+
9+
use_react_native!(:path => config["reactNativePath"])
910

1011
target 'HelloWorldTests' do
1112
inherit! :complete
1213
# Pods for testing
1314
end
1415

15-
use_native_modules!
16-
1716
# Enables Flipper.
1817
#
1918
# Note that if you have use_frameworks! enabled, Flipper will not work and

0 commit comments

Comments
 (0)