iOS在原有项目中使用react
来源:互联网 发布:上海mao livehouse知乎 编辑:程序博客网 时间:2024/05/21 03:24
代码下载地址: https://github.com/leicunjie/OCWithReact
0.使用Xcode创建项目
1. 在Podfile中添加:
pod 'React', :path => './node_modules/react-native', :subspecs => [
'Core',
'RCTImage',
'RCTNetwork',
'RCTText',
'RCTWebSocket',
# Add any other subspecs you want to use in your project
]
2.pod install
3.在根目录创建index.ios.js文件
/**
* Sample React Native App
* https://github.com/facebook/react-native
* @flow
*/
import React, { Component } from 'react';
import {
AppRegistry,
StyleSheet,
View,
Text,
} from 'react-native'
class OCWithReactDemo extends Component {
render() {
return (
<View style={styles.container}>
<Text style={styles.welcome}>
Welcome to React Native!
</Text>
<Text style={styles.instructions}>
To get started, edit index.android.js
</Text>
<Text style={styles.instructions}>
Shake or press menu button for dev menu
</Text>
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF',
},
welcome: {
fontSize: 20,
textAlign: 'center',
margin: 10,
},
instructions: {
textAlign: 'center',
color: '#333333',
marginBottom: 5,
},
});
AppRegistry.registerComponent('OCWithReactDemo', () => OCWithReactDemo);
3.在根目录执行命令 nam install react-native
4.在buildSetting 的 User Header Search Path中添加:
$(PODS_ROOT)/React/React 选择 recursive
5.启动react服务器,运行工程。
- iOS在原有项目中使用react
- react native集成到原有的项目中(iOS)
- android原有项目中集成react-native
- 如何在原有的iOS项目中添加cordova
- React Native 集成到原有Android项目中
- 在 React、Vue项目中使用 SVG
- 【React】在React项目中使用parallax.js
- 怎样在原有项目中,添加使用Ajax Control Toolkit控件功能?
- iOS在原生项目中插入React Native(最终版)
- [react-native] 导入原有的iOS项目报 Application XXX has not been registered错误
- React-native嵌入到原有Android项目
- IOS-React Native 使用CocoaPods集成到原生项目中
- 如何在原有Xcode项目中集成ReactNative模块
- 在React Native项目中使用第三方库
- 在OGRE中使用原有的D3D界面处理方式。。
- 在IOS项目中使用常量
- 在iOS项目中使用CorePlot框架
- iOS在项目中使用ASIHttpRequest
- Hadoop安装教程_单机/伪分布式配置_Hadoop2.6.0/Ubuntu14.04
- CodeIgniter框架源码笔记(1)——回忆:准备
- jq实现点击添加和删除一行
- 喝茶看书的时光
- 左侧固定,右侧是竖着的子菜单样式
- iOS在原有项目中使用react
- 内存解析(stack,heap,static)
- 树莓派(raspberry pi) Installing ROS Indigo on Raspberry Pi
- Linux下安装并破解StarUML
- 6. ZigZag Conversion
- mysql int(11)字段左边自动补零了
- js中利用jquery parseJSON来判断字符串string是否是json格式
- java多线程 主线程等子线程执行完毕
- 再谈iOS 7的手势滑动返回功能