React-Native集成到已有项目过程及问题处理

先看搞清楚项目目录情况:

项目目录

第一层目录:项目根目录: iOS-2028-master/
第二层目录:原生项目根目录:iOS-2048-master/NumberTileGame/

另外假设已经全局安装好node、npm、cocoapods、react-native cli等工具,这些工具没有安装的,请先自行Google安装。

Packages Installation

  1. 进入项目根目录 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"
  }
}
  1. 在当前根目录 iOS-2028-master/ 下执行
$ npm install

React Native Framework

  1. 进入到原生项目根目录,通过pod 引入React Native Framework, 执行如下操作:
## In the directory where your native iOS code is located (e.g., where your `.xcodeproj` file is located)

$ pod init
  1. 在创建好的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 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值