美文网首页
React-Native 引用样式的方式

React-Native 引用样式的方式

作者: json_jie | 来源:发表于2016-08-15 15:38 被阅读1403次

import React, { Component } from 'react';
import {
AppRegistry,
StyleSheet,
Text,
View
} from 'react-native';

class hello extends Component {
  render() {
   return (
  <View style={styles.container}>
    <View style = {[styles.viewStyle,{backgroundColor:'white'},{width:100,height:150}]}>
    <Text>1  第一种样式</Text>
    </View>
    <View style = {{backgroundColor:'yellow',height:120,width:100,marginLeft:10}}>
    <Text>2 第二种样式</Text>
    </View>
    <View style = {{backgroundColor:'white',height:190,width:100,marginLeft:10}}>
    <Text>3</Text>
    </View>

    <View style = {[styles.viewStyle,{backgroundColor:'white'},{width:100,height:100}]}>
    <Text>4  第三种样式</Text>
    </View>
    <View style = {{backgroundColor:'yellow',height:120,width:100,marginLeft:10}}>
    <Text>5</Text>
    </View>
    <View style = {{backgroundColor:'white',height:190,width:100,marginLeft:10,marginTop:10}}>
    <Text>6</Text>
    </View>
    <View style = {[styles.viewStyle,styles.viewStyleCon]}>
    <Text style = {{backgroundColor:'red'}}>reactView7  第四种样式</Text>
    </View>
  </View>
);
  }
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
    backgroundColor: 'red',
    flexDirection:'row',
    flexWrap:'wrap',
    alignItems:'center',
    justifyContent:'space-around',
    alignSelf:'stretch',
  },

  viewStyle:{
    backgroundColor:'green',
    height:100,
    width:100
  },
viewStyleCon:{
  alignItems:'center',
  justifyContent:'center'
},
  welcome: {
    fontSize: 20,
    textAlign: 'center',
    margin: 10,
  },
  instructions: {
    textAlign: 'center',
    color: '#333333',
    marginBottom: 5,
  },
});
AppRegistry.registerComponent('hello', () => hello);

相关文章

  • React-Native 引用样式的方式

    import React, { Component } from 'react';import {AppRegis...

  • React Native StryleSheet 实践总结

    1) 引入样式 2) 创建样式 3) 调用样式的几种方式 单个样式引用(对象) 多个样式引用(数组) 条件样式 ...

  • react-native-pg-style使用方法(以最简单的方

    react-native-pg-style 以最简单的方式编写样式代码,抛弃react-native标准的样式创建...

  • link和@import区别

    页面使用css的方式主要有3种,标签行内引用,页面头部样式引用,外部样式引用,其中外部样式引用有link和impo...

  • css引用方式 2018-07-12

    css引用方式 1 行间样式 2 内部样式 3 外部样式 通过link引入

  • 关于CSS

    CSS 加载方式 css引用方式分为以下三种: 外部样式 内部样式 内联样式 外部样式 外部式css样式就是把cs...

  • Day04 CSS补充

    1.CSS引用 有三种引用方式,分别为: 1.内部样式 2.内联样式 3.外部样式 1.1内部样式 CSS和HTM...

  • 1、样式有几种引入方式?link和@import有什么区别 有三种引入方式,分别是内部样式、内嵌样式和引用外部样式...

  • css样式

    CSS(Cascading Style Sheets) 是用来为网页添加样式的代码。 样式的三种引用方式 内联样式...

  • HTML2

    样式有几种引入方式? link和 @import有什么区别? 样式引入方式: 两种都是外部引用CSS的方式,差别在...

网友评论

      本文标题:React-Native 引用样式的方式

      本文链接:https://www.haomeiwen.com/subject/uipusttx.html