新的React Native项目与旧版本的本机反应 [英] New React Native project with old version of react native

查看:92
本文介绍了新的React Native项目与旧版本的本机反应的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试创建一个新的react本机项目,它应该使用旧版本的react-native。

I am trying to create a new react native project which should utilize an older version of react-native.

我想要的结果是做类似的事情: react-native init MyProject 但是它使用的react-native版本是 0.13.2

The result I would like would be to do something like: react-native init MyProject but have the version of react-native it uses be 0.13.2.

但是,似乎没有任何选项 react-native-cli 用于初始化旧版本的反应 - 原生。

However, there doesn't seem to be any options with react-native-cli for initializing with old versions of react-native.

执行 react-native init MyProject 然后在包中降级react-native .json 也不起作用,因为 init 命令会安装一堆用于构建应用程序的xcode模板,而且没有 dowgrade 命令将降级这些模板。 (有一个升级命令。)

Performing react-native init MyProject and then dowgrading react-native in package.json also does not work because the init command installs a bunch of xcode templates which are used to build the app and there is no dowgrade command which will dowgrade these templates. (There is an upgrade command.)

我尝试将我的react-native-cli版本降级为 0.1.4 当react-native 0.13 是最新的时,这是当前的,但这不起作用。从查看cli源代码来看,它似乎总是只用最新版本的react-native进行初始化。

I tried downgrading my version of react-native-cli to 0.1.4 which was current when react-native 0.13 was current, but this did not work. From looking at the cli source, it seems it always initializes with just the newest version of react-native.

我意识到想要开始一个新项目这很奇怪在一个旧版本,但我有一组奇怪的要求迫使这一点。

I realize this is pretty weird to want to start a new project at an old version, but I have a weird set of requirements that are forcing this.

推荐答案

rninit 替代 react-native init 允许您指定特定版本的react-native使用。

rninit is a replacement for react-native init that allows you to specify a particular version of react-native to use.

全局安装 rninit

npm install -g rninit

指定要使用的react-native版本:

Specify which version of react-native to use:

rninit init [Project Name] --source react-native@0.14.2

感谢@ vanson-wing-leung指示我 rninit

Thanks to @vanson-wing-leung for pointing me to rninit

这篇关于新的React Native项目与旧版本的本机反应的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆