/**
* Sample React Native App
* https://github.com/facebook/react-native
* @flow
*/ import React, { Component } from 'react';
import {
AppRegistry,
StyleSheet,
Text,
View
} from 'react-native'; /*--------------------第一个示例程序------------------*/ class FlexBoxDemo extends Component {
render() {
return (
<View style={styles.container}>
<Text style = {{backgroundColor: 'red',height: }}>第一个</Text>
<Text style = {{backgroundColor: 'green',height: }}>第二个</Text>
<Text style = {{backgroundColor: 'yellow',height: }}>第三个</Text>
<Text style = {{backgroundColor: 'blue',height: }}>第四个</Text>
</View>
);
}
} const styles = StyleSheet.create({
container: { // 注意: 父视图的高度是随子视图而决定的 // 改变主轴的方向
flexDirection: 'row',
backgroundColor: 'purple',
// 距离顶部间距
marginTop:,
// 设置主轴的对齐方式
justifyContent:'center',
// 设置侧轴的对齐方式
alignItems: 'flex-end'
},
}); /*--------------------第二个示例程序------------------*/ class FlexBoxDemo1 extends Component {
render() {
return (
<View style={styles1.container}>
<Text style = {{backgroundColor: 'red',width: }}>第一个</Text>
<Text style = {{backgroundColor: 'green',width: }}>第二个</Text>
<Text style = {{backgroundColor: 'yellow',width: }}>第三个</Text>
<Text style = {{backgroundColor: 'blue',width: }}>第四个</Text>
</View>
);
}
} const styles1 = StyleSheet.create({ container: { // 注意: 父视图的高度是随子视图而决定的 // 改变主轴的方向
flexDirection: 'row',
backgroundColor: 'purple',
// 距离顶部间距
marginTop:,
// 设置主轴的对齐方式
justifyContent:'center',
// 设置侧轴的对齐方式
alignItems: 'flex-end',
// 设置图像换行显示,默认是不换行
flexWrap: 'wrap',
// 决定盒子的宽度 宽度 = 弹性宽度 * (flexGrow / 父View宽度)
flex: , },
}) /*--------------------第三个示例程序------------------*/ class FlexBoxDemo2 extends Component {
render() {
return (
<View style={styles2.container}> <Text style = {{backgroundColor: 'red',height: ,alignSelf: 'flex-start'}}>第一个</Text>
<Text style = {{backgroundColor: 'green',height: }}>第二个</Text>
<Text style = {{backgroundColor: 'yellow',height: }}>第三个</Text>
<Text style = {{backgroundColor: 'blue',height: }}>第四个</Text>
</View>
);
}
} const styles2 = StyleSheet.create({ container: { // 注意: 父视图的高度是随子视图而决定的 // 改变主轴的方向
flexDirection: 'row',
backgroundColor: 'purple',
// 距离顶部间距
marginTop:,
// 设置主轴的对齐方式
justifyContent:'center',
// 设置侧轴的对齐方式
alignItems: 'flex-start',
// 设置图像换行显示,默认是不换行
flexWrap: 'wrap',
// 决定盒子的宽度 宽度 = 弹性宽度 * (flexGrow / 父View宽度)
flex: ,
},
}) AppRegistry.registerComponent('FlexBoxDemo', () => FlexBoxDemo2);

最新文章

  1. Django 1.7 throws django.core.exceptions.AppRegistryNotReady: Models aren&#39;t loaded yet
  2. ASP.NET Core--条件处理程序中的依赖注入
  3. LeetCode-Search a 2D Matrix
  4. 关于Solr搜索标点与符号的中文分词你必须知道的(mmseg源码改造)
  5. nodejs的mysql模块学习(五)数据库连接配置之SSL
  6. hadoop-1.1.2集群搭建
  7. 【Hadoop代码笔记】Hadoop作业提交之Child启动reduce任务
  8. POI根据EXCEL模板,修改内容导出新EXCEL (只支持HSSF)
  9. BZOJ 2754: [SCOI2012]喵星球上的点名
  10. BaseAdapter导致notifyDataSetChanged()无效的三个原因及处理方法
  11. Java出现“Error configuring application listener of class...”类似的错误解决
  12. 老李分享: 并行计算基础&amp;编程模型与工具 1
  13. 前端打包文件在nginx上403的解决办法
  14. c# 反射小Demo
  15. 剑指offer 3. 链表 从尾到头打印链表
  16. 什么叫做API?看完你就理解了
  17. 【MOOC EXP】Linux内核分析实验六报告
  18. mysql三级连查,左连
  19. innobackup stream 压缩备份,解压后的qp文件
  20. mysql中的中文乱码解决方案, 全部是 这篇文章的内容: https://www.52jbj.com/jbdq/18755.html

热门文章

  1. 自动化测试环境搭建(appium+selenium+python)
  2. bzoj 1787 &amp;&amp; bzoj 1832: [Ahoi2008]Meet 紧急集合(倍增LCA)算法竞赛进阶指南
  3. 学习elasticsearch(一)linux环境搭建(3)——head插件安装
  4. 使用html2canvas在手机端独立实现h5页面转图片
  5. 00-c#与设计模式目录
  6. hdu 6141 I am your Father!
  7. ila核数据输出
  8. msyql round函数隐藏问题
  9. 北京清北 综合强化班 Day5
  10. Go中&amp;和*的区别