react native常用css

https://oblador.github.io/react-native-vector-icons/

npm install react-native-vector-icons --save

 

  • 控制物体并排还是分行显示:flex-direction
  • 垂直居中:alignItems: 'center'
  • 在行内的对齐方式,类似justifyContent,只是
  • 文本方向:textAlign:'left'
  • 水平:justifyContent
  • border:

    borderBottomWidth:1,

    borderBottomColor:"#eee"
  • react-native的css也是写在js文件内,如下示例:
import React from 'react';
import {
    StyleSheet
} from 'react-native';

export default StyleSheet.create(
    {
        totalbox:{
            display:"flex"
        }
    }
);

样式传递:(例如,上面文件名为Tab3Style.js,按照下面代码进行样式传递)

import React, { Component } from 'react';
import { View, Text} from 'react-native';
import Tab3Style from './Tab3Style'
class Tabnavigation3 extends Component {
  static navigationOptions = {
    headerTitle: "我"
  };
  render() {
    return (
      <View style={Tab3Style.totalbox}>
         <Text style={Tab3Style.title}>Inbox</Text>
      </View>
    );
  }
}
export default Tabnavigation3
  • iphonex中内容不会被刘海遮住
<SafeAreaView>
  <View>
    <Text>Hello World!</Text>
  </View>
</SafeAreaView>
  • 背景图片
<ImageBackground source={require("../img/weather.jpg")} style={{ width: '100%', height: '100%' }}>
    <SafeAreaView style={{ flex: 1 }}>
         <WeatherInfo />
    </SafeAreaView>
</ImageBackground>

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值