整合RN

2018-01-11  本文已影响144人  cocoaroger

官方文档地址: Integration with Existing Apps - React Native
中文文档:React Native 中文网
React-Native 开源App项目:GitHub - ReactNativeNews/React-Native-Apps: Curated List of Open Source React Native Apps

安装准备

安装 npm 、node、cocoapod、xcode、android studio

安装方法

方法1:create-react-native-app

npm install -g create-react-native-app
create-react-native-app 项目名
cd 项目名
yarn start
用 expo App 扫描运行后的二维码可以直接运行

方法2:react-native init

react-native init 项目名
cd 项目名
react-navtive run-ios
react-navtive run-android

react-navtive run-ios 卡在 Running script 'Install Third Party'

方法3:集成到已有iOS项目

按着文档做无法编译通过

{
  "name": "TestOCRN",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "start": "node node_modules/react-native/local-cli/cli.js start"
  },
  "dependencies": {
    "react": "16.0.0",
    "react-native": "0.50.0"
  }
}
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!

target 'TestOCRN' do
  pod 'React', 
  :path => './ReactNative/node_modules/react-native', 
  :subspecs => [
    'Core',
    'ART',
    'RCTActionSheet',
    'RCTGeolocation',
    'RCTImage',
    'RCTNetwork',
    'RCTPushNotification',
    'RCTSettings',
    'RCTText',
    'RCTVibration',
    'RCTWebSocket',
    'RCTLinkingIOS',
    'RCTAnimation',
  ]
  pod "yoga", :path => "./ReactNative/node_modules/react-native/ReactCommon/yoga"

end

问题描述 :‘fishhook/fishhook.h’ file not found

问题描述 :'RCTAnimation/RCTValueAnimatedNode.h' file not found

问题:"_JSNoBytecodeFileFormatVersion", referenced from:

集成到已有的Android

上一篇 下一篇

猜你喜欢

热点阅读