Skip to content

Commit

Permalink
Update default Podfile to not depend on a path (#28572)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
grabbou authored and facebook-github-bot committed Apr 9, 2020
1 parent c7f2595 commit cd13c99
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions template/ios/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit cd13c99

Please sign in to comment.