[Wondgirl]从零开始学React Native之View(四)
2016-12-23 15:04
423 查看
index.ios.js如下:
/** * Sample React Native App * https://github.com/facebook/react-native * @flow */ import React, { Component } from 'react'; import { AppRegistry, StyleSheet, Text, View, PixelRatio } from 'react-native'; export default class demo extends Component { render() { return ( <View style={styles.container}> <View style={[styles.item,styles.center]}> <Text style={styles.font}>机票</Text> </View> <View style={[styles.item,styles.lineLeftRight]}> <View style={[styles.center,{flex:1},styles.lineCenter]}> <Text style={styles.font}>火车票</Text> </View> <View style={[styles.center,{flex:1}]}> <Text style={styles.font}>接送机</Text> </View> </View> <View style={[styles.item,styles.lineLeftRight]}> <View style={[styles.center,{flex:1},styles.lineCenter]}> <Text style={styles.font}>汽车票</Text> </View> <View style={[styles.center,{flex:1}]}> <Text style={styles.font}>用车</Text> </View> </View> </View> ); } } //样式 const styles = StyleSheet.create({ item:{ flex:1, height:80, borderColor:'blue', borderWidth:1, backgroundColor:'#ff0067' }, container: { borderWidth:1, borderColor:'red', flexDirection:'row', marginTop:40, marginLeft:20, marginRight:20 }, font:{ color:'#fff', fontSize:16, fontWeight:'bold' }, center:{ justifyContent:'center', alignItems:'center' }, lineCenter:{ borderBottomWidth:1/PixelRatio.get(), borderColor:'#fff' }, lineLeftRight:{ borderLeftWidth:1/PixelRatio.get(), borderRightWidth:1/PixelRatio.get(), borderColor:'#fff' } }); AppRegistry.registerComponent('demo', () => demo);
相关文章推荐
- 使用C++实现JNI接口需要注意的事项
- Android IPC进程间通讯机制
- Android Manifest 用法
- [转载]Activity中ConfigChanges属性的用法
- Android之获取手机上的图片和视频缩略图thumbnails
- Android之使用Http协议实现文件上传功能
- Android学习笔记(二九):嵌入浏览器
- android string.xml文件中的整型和string型代替
- i-jetty环境搭配与编译
- android之定时器AlarmManager
- android wifi 无线调试
- Android Native 绘图方法
- Android java 与 javascript互访(相互调用)的方法例子
- android 代码实现控件之间的间距
- android FragmentPagerAdapter的“标准”配置
- Android"解决"onTouch和onClick的冲突问题
- android:installLocation简析