先看搞清楚项目目录情况:
第一层目录:项目根目录: iOS-2028-master/
第二层目录:原生项目根目录:iOS-2048-master/NumberTileGame/
另外假设已经全局安装好node、npm、cocoapods、react-native cli等工具,这些工具没有安装的,请先自行Google安装。
Packages Installation
- 进入项目根目录
iOS-2028-master/
,新建package.json
文件,在文件里输入如下内容:
{
"name": "NumberTileGame",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start"
},
"dependencies": {
"react": "15.0.2",
"react-native": "0.26.1"
}
}
- 在当前根目录
iOS-2028-master/
下执行
$ npm install
React Native Framework
- 进入到原生项目根目录,通过
pod
引入React Native Framework, 执行如下操作:
## In the directory where your native iOS code is located (e.g., where your `.xcodeproj` file is located)
$ pod init
- 在创建好的Podfile中输入如下内容:
# The target name is most likely the name of your project.
target 'NumberTileGame' do
# Your 'node_modules' directory is probably in the root of your project,
# but if