React-Native基础_3.Flex布局
Flex布局介绍
/**
* Sample React Native App
* https://github.com/facebook/react-native
* @flow
*/
'use strict'
import React, {Component} from 'react';
import {
AppRegistry,
StyleSheet,
Text,
View
} from 'react-native';
//import {AppRegistry,} from 'react-native';
//import Day0718 from './componets/Home'
export default class Day0718 extends Component {
render() {
return (
<View style={styles.Container}>
<View style={[styles.item ,styles.itemOne]}>
<Text style={styles.itemText}>1</Text>
</View>
<View style={[styles.item ,styles.itemTwo]}>
<Text style={styles.itemText}>2</Text>
</View>
<View style={[styles.item ,styles.itemThree]}>
<Text style={styles.itemText}>3</Text>
</View>
</View>
);
}
}
const styles = StyleSheet.create({
item:{
backgroundColor:'#fff',
borderWidth:1,
borderColor:'#6435c9',
margin:6,
flex:1,
},
itemOne:{
// alignSelf:'flex-start',
},
itemTwo:{
//alignSelf:'center',
},
itemThree:{
flex:2,
},
itemText:{
fontSize:33,
fontFamily:'Helvetica Neue',
fontWeight:'200',
color:'#6435c9',
padding:30,
},
Container: {
//alignItems:'flex-start',// flex-start 靠在左边显示 center 居中 flex-end 尾部
//
flexDirection:'column',//row column 方向
backgroundColor: '#eae7ff',
flex: 1,
//justifyContent:'center',//center ; 居中 flex-end 位于底部 space-between/space-around屏幕平均分配
},
Text: {
color: '#6435c9',
fontSize: 26,
textAlign: 'center',
fontStyle: 'italic',
letterSpacing: 2,
lineHeight: 33,
fontFamily: 'Helvetica Neue',
fontWeight: '300',
textDecorationLine: 'underline',
textDecorationStyle: 'dashed',
},
});
AppRegistry.registerComponent('Day0718', () => Day0718);
Flex布局是React-Native 中常用的布局语法。
React-Native基础_3.Flex布局的更多相关文章
- React Native基础&入门教程:初步使用Flexbox布局
在上篇中,笔者分享了部分安装并调试React Native应用过程里的一点经验,如果还没有看过的同学请点击<React Native基础&入门教程:调试React Native应用的一小 ...
- react native基础与入门
react native基础与入门 一.react native 的优点 1.跨平台(一才两用) 2.低投入高回报 (开发成本低.代码复用率高) 3.性能高:拥有独立的js渲染引擎,比传统的h5+ w ...
- React Native 中的 Flex Box 的用法(水平布局、垂直布局、水平居中、垂直居中、居中布局)
版权声明:本文仅供个人学习. CSS 中 Flex-Box 语法链接 http://www.ruanyifeng.com/blog/2015/07/flex-grammar.html Flex 是 ...
- 3、手把手教React Native实战之flexbox布局
flexbox是Flexible Box的缩写,弹性盒子布局 主流的浏览器都支持 flexbox布局是伸缩容器(container)和伸缩项目(item)组成 Flexbox布局的主体思想是元素可以 ...
- 跨平台框架与React Native基础
跨平台框架 什么是跨平台框架? 这里的多个平台一般是指 iOS 和 Android . 为什么需要跨平台框架? 目前,移动开发技术主要分为原生开发和跨平台开发两种.其中,原生应用是指在某个特定的移动平 ...
- React Native基础&入门教程:以一个To Do List小例子,看props和state
本文由葡萄城技术团队于博客园原创并首发 转载请注明出处:葡萄城官网,葡萄城为开发者提供专业的开发工具.解决方案和服务,赋能开发者. 在上篇中,我们介绍了什么是Flexbox布局,以及如何使用Flexb ...
- 4、手把手教React Native实战之flexbox布局(伸缩属性)
###伸缩项目的属性 1.order 定义项目的排列顺序,数值越小,排列越靠前,默认值为0,语法为:order:整数值 2.flex-grow 定义伸缩项目的放大比例,默认值为0,即表示如果存在剩余空 ...
- React Native基础&入门教程:调试React Native应用的一小步
React Native(以下简称RN)为传统前端开发者打开了一扇新的大门.其中,使用浏览器的调试工具去Debug移动端的代码,无疑是最吸引开发人员的特性之一. 试想一下,当你在手机屏幕按下一个按钮, ...
- React Native基础概念和基础认识
学习地址:https://github.com/vczero/react-native-lesson 当我们初始化一个RN项目的时候主要的是index.ios.js文件和index.android.j ...
随机推荐
- ubuntu 12.04及12.10无法安装 ia32-libs
administrator@ubuntu:~$ sudo apt-get install ia32-libs [sudo] password for administrator: 正在读取软件包列表 ...
- 关于JavaScript对象,你所不知道的事(一)- 先谈对象
这篇博文的主要目的是为了填坑,很久之前我发表了一篇名为关于JavaScript对象中的一切(一) - 对象属性的文章,想要谈一谈JavaScript对象,可那时只是贴了一张关于这个主题的思维导图,今天 ...
- Hive Shell常用操作
1.Hive非交互模式常用命令: 1) hive -e:从命令行执行指定的HQL,不需要分号: % hive -e 'select * from dummy' > a.txt 2) hive – ...
- python-作用域和装饰器
Python 作用域 学习的时机: 基本的数据类型 Python的运算 数字运算 + - * / // ** 逻辑运算 And or not 比较运算 > < == >= <= ...
- iOS开发进阶 - 自定义UICollectionViewLayout实现瀑布流布局
移动端访问不佳,请访问我的个人博客 最近项目中需要用到瀑布流的效果,但是用UICollectionViewFlowLayout又达不到效果,自己动手写了一个瀑布流的layout,下面是我的心路路程 先 ...
- Matrix_QP(A_2SeqSum)
hdu_4686 题目大意:给出an,bn的递推,求ai*bi(i=0,1,--n-1)的和(an=a(n-1)*Ax+Ay, bn=b(n-1)*Bx+By, a0=A0, b0=B0, Ax,Bx ...
- MapReduce实现共同朋友问题
答案: package com.duking.mapreduce; import java.io.IOException; import java.util.Set; import java.util ...
- POJ 1236 Network of School
http://poj.org/problem?id=1236 题意: 给出一个图,至少要选多少个点才能遍历全图和至少需要添加多少边使得整个图是强连通. 思路: 强连通计算连通分量后缩点,计算入度为0的 ...
- ANDROID教程目录
html5 如何打包成apk,将H5封装成android应用APK文件的几种方法
- 英语每日阅读---7、VOA慢速英语(翻译+字幕+讲解):卡梅伦呼吁女性移民学英语
英语每日阅读---7.VOA慢速英语(翻译+字幕+讲解):卡梅伦呼吁女性移民学英语 一.总结 一句话总结: a.learn English or be deported:British Prime M ...