From 2cb0546d15284efab5ffddbc011c554f6c0f156a Mon Sep 17 00:00:00 2001 From: Jarek Potiuk Date: Mon, 22 Jun 2015 03:12:35 -0700 Subject: [PATCH] Added support for React installed in the application via Cocoapods Summary: Similarly to npm-installed react, this change makes changes to the packager so that it understands that it's been installed via Cocoapods and determines the project and asset roots properly (from the main application directory). Closes https://github.com/facebook/react-native/pull/1568 Github Author: Jarek Potiuk Test Plan: Imported from GitHub, without a `Test Plan:` line. --- packager/packager.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packager/packager.js b/packager/packager.js index 7dd013c67..c719b8608 100644 --- a/packager/packager.js +++ b/packager/packager.js @@ -66,6 +66,9 @@ if (options.projectRoots) { if (__dirname.match(/node_modules\/react-native\/packager$/)) { // packager is running from node_modules of another project options.projectRoots = [path.resolve(__dirname, '../../..')]; + } else if (__dirname.match(/Pods\/React\/packager$/)) { + // packager is running from node_modules of another project + options.projectRoots = [path.resolve(__dirname, '../../..')]; } else { options.projectRoots = [path.resolve(__dirname, '..')]; } @@ -88,6 +91,8 @@ if (options.assetRoots) { } else { if (__dirname.match(/node_modules\/react-native\/packager$/)) { options.assetRoots = [path.resolve(__dirname, '../../..')]; + } else if (__dirname.match(/Pods\/React\/packager$/)) { + options.assetRoots = [path.resolve(__dirname, '../../..')]; } else { options.assetRoots = [path.resolve(__dirname, '..')]; }