Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
189 views
in Technique[技术] by (71.8m points)

ios - New React Native project with old version of react native

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

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.

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

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.)

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

There is a new parameter in react-native init that allows just this. Try:

react-native init --version="[email protected]" MyNewApp

Here my source. I have successfully tested it with react-native-cli 2.0.1.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...