亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定

react native 樣式初學~(一)

標簽:

最近看到了一个新技术~~react native~~
貌似国内还很少~~于是我就也来学学~~
这篇一类文章记录我学习react native的过程


安装react native很简单~~貌似网上这个教程还是蛮多的~~
自己去找就好了,如果实在不会留言给我,我再写写装的过程~~


react native的第一个hello world代码很简单~~
贴出如下

/**
 * Sample React Native App
 * https://github.com/facebook/react-native
 */
'use strict';
import React, {
  AppRegistry,
  Component,
  StyleSheet,
  Text,
  View
} from 'react-native';

class hellodk extends Component {
  render() {
    return (
      <View style={styles.container}>
        <Text style={styles.titlem}>
          测试01!
        </Text>
        <Text style={styles.instructions}>
          这是ios测试
        </Text>
        <Text style={styles.instructions}>
          第一次写react native见谅
        </Text>
      </View>
    );
  }
}
// 创建一个样式表
const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
    backgroundColor: '#F5FCFF',
    borderRadius: 4,
    borderWidth: 0.5,
    borderColor: '#d6d7da',
  },
  titlem: {
    fontSize: 20,
    textAlign: 'center',
    fontWeight: 'bold',//加粗
    margin: 10,
  },
  instructions: {
    textAlign: 'center',
    color: '#333333',
    marginBottom: 5,
  },
});

AppRegistry.registerComponent('hellodk', () => hellodk);

如上代码中包含了两个组件一个是view,一个是text
首先是view的样式
在这个网址里react native
简单说一下 view可以用里面的那些样式来控制~
text的样式如下~~也是可以用view的一些样式~~写控件的时候可以翻看一下

//text的样式如下
color string
fontFamily string
fontSize number
fontStyle enum('normal', 'italic')
fontWeight enum("normal", 'bold', '100', '200', '300', '400', '500', '600', '700', '800', '900')
letterSpacing number
lineHeight number
textAlign enum("auto", 'left', 'right', 'center', 'justify')
textDecorationLine enum("none", 'underline', 'line-through', 'underline line-through')
textDecorationStyle enum("solid", 'double', 'dotted', 'dashed')
textDecorationColor string
writingDirection enum("auto", 'ltr', 'rtl')

如上样式可以配置到样式表中~~

點擊查看更多內容
15人點贊

若覺得本文不錯,就分享一下吧!

評論

作者其他優質文章

正在加載中
移動開發工程師
手記
粉絲
81
獲贊與收藏
3604

關注作者,訂閱最新文章

閱讀免費教程

感謝您的支持,我會繼續努力的~
掃碼打賞,你說多少就多少
贊賞金額會直接到老師賬戶
支付方式
打開微信掃一掃,即可進行掃碼打賞哦
今天注冊有機會得

100積分直接送

付費專欄免費學

大額優惠券免費領

立即參與 放棄機會
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號

舉報

0/150
提交
取消