Ubuntu进行 React-Native 的开发
来源:互联网 发布:看图软件acdsee9.0 编辑:程序博客网 时间:2024/05/21 11:18
尝试在 Ubuntu 14.04
上面进行 react-native 的开发, 安装官方文档进行配置,记录配置流程
安装 node.js
在官网下载源码安装即可, 安装后查看版本
$ node -v
安装 watchman
文档
安装依赖
$ sudo apt-get install autoconf automake python-dev
安装 watchman, 如果出错, 查看安装依赖的详细文档
$ git clone https://github.com/facebook/watchman.git$ cd watchman$ git checkout v4.3.0 # the latest stable release$ ./autogen.sh$ ./configure$ make$ sudo make install
安装 react-native
$ npm install -g react-native-cli
创建react-native 项目
$ react-native init AwesomeProject
运行
启动 server, 如果没有启动server , 会报错 React Native: ReferenceError: Can't find variable: require (line 1 in the generated bundle)
$ react-native start
编译apk,并运行到模拟器, 需要配置好Android开发的环境变量(ANDROID_HOME, GRADLE_HOME )
$ react-native run-android
做一些修改
/** * Sample React Native App * https://github.com/facebook/react-native */'use strict';var React = require('react-native');var { AppRegistry, StyleSheet, Text, View,} = React;var AwesomeProject = React.createClass({ render: function() { return ( <View style={styles.container}> <Text style={styles.welcome}> Hanks, Welcome to React Native! </Text> <Text style={styles.instructions}> To get started, edit index.android.js </Text> <Text style={styles.reply}> Yep, I do! </Text> <Text style={styles.instructions}> Shake or press menu button for dev menu </Text> </View> ); }});var 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, }, // 添加style reply:{ color: '#e8801b', fontSize: 20 }});AppRegistry.registerComponent('AwesomeProject', () => AwesomeProject);
再次reload js, 可以通过菜单调出选项
>文章出处: http://hanks.xyz
0 0
- Ubuntu进行 React-Native 的开发
- 【React Native开发】React Native进行签名打包成Apk
- 【React Native开发】React Native进行签名打包成Apk
- 【React Native开发】- React Navigation的使用
- React Native开发学习记录(我的开发环境是ubuntu)
- React Native开发学习记录2(我的开发环境是ubuntu)
- 使用react-native进行android App开发过程所遇到的问题集锦
- 【React Native开发】React Native进行签名打包成Apk(5)
- 【React Native开发】React Native进行签名打包成Apk(5)
- React Native 二:在ubuntu MATE 16.04 下搭建React Native 开发环境
- React Native开发的通讯录应用
- React Native开发环境的配置(一)
- React Native开发的仿美团小demo
- React Native开发之按钮的使用
- react native 开发环境的配置
- react native开发的个人看法
- 配置React Native的开发环境
- React native开发中常见的错误
- writing idiomatic python 读书笔记(7)
- 用Python和OpenCV实现RootSIFT--Implementing RootSIFT in Python and OpenCV
- 音乐播放器之--MediaPlayer状态机(1)
- [LeetCode]Scramble String
- C++11随机数发生器 VS rand()
- Ubuntu进行 React-Native 的开发
- python可视化--matplotlib
- writing idiomatic python 读书笔记(8)
- 运行React-Native例子UIExplorer
- 最常用的Java设计之一 观察者模式 在android中的实例 ListView Adapter机制
- C:\WINDOWS\Installer文件夹的安全清理
- Android 为应用创建多个桌面快捷方式,可在卸载时自动删除桌面快捷方式
- React-Native中的布局
- iOS 给app添加启动图