diff --git a/local-cli/generator/index.js b/local-cli/generator/index.js index 04b410f12..43c327c5c 100644 --- a/local-cli/generator/index.js +++ b/local-cli/generator/index.js @@ -96,6 +96,17 @@ module.exports = yeoman.generators.NamedBase.extend({ return; } - this.npmInstall('react', { '--save': true }); + var reactNativePackageJson = require('../../package.json'); + var { peerDependencies } = reactNativePackageJson; + if (!peerDependencies) { + return; + } + + var reactVersion = peerDependencies.react; + if (!reactVersion) { + return; + } + + this.npmInstall(`react@${reactVersion}`, { '--save': true }); } });