react-native 學習之Image篇

來源:互聯網
上載者:User

標籤:

/** * Sample React Native App * https://github.com/facebook/react-native */‘use strict‘;import React, {  AppRegistry,  Component,  StyleSheet,  Text,  View,  Image} from ‘react-native‘;class machaoProject extends Component {  render() {    return (      <View style={styles.container}>        <View style={ styles.topBgView}>                      <View style={styles.unitView} >            <Image                 source={require(‘./Images/001.png‘)}                style={styles.imageStyle}                />             <Text style = {styles.textStyle}>             美食             </Text>        </View>                <View style={styles.unitView} >            <Image                 source={require(‘./Images/002.png‘)}                style={styles.imageStyle}                />             <Text style = {styles.textStyle}>             電影             </Text>        </View>                <View style={styles.unitView} >            <Image                 source={require(‘./Images/003.png‘)}                style={styles.imageStyle}                />             <Text style = {styles.textStyle}>             酒店             </Text>        </View>                <View style={styles.unitView} >            <Image                 source={require(‘./Images/004.png‘)}                style={styles.imageStyle}                />             <Text style = {styles.textStyle}>             KTV             </Text>        </View>        </View>                        <View style = {styles.topBgView}>                 <View style={styles.unitView} >            <Image                 source={require(‘./Images/005.png‘)}                style={styles.imageStyle}                />             <Text style = {styles.textStyle}>             外賣             </Text>        </View>                 <View style={styles.unitView} >            <Image                 source={require(‘./Images/006.png‘)}                style={styles.imageStyle}                />             <Text style = {styles.textStyle}>             優惠買單             </Text>        </View>                 <View style={styles.unitView} >            <Image                 source={require(‘./Images/007.png‘)}                style={styles.imageStyle}                />             <Text style = {styles.textStyle}>             你說呢             </Text>        </View>                </View>                                </View>    );  }}const styles = StyleSheet.create({  container: {    marginLeft: 5,    marginTop: 20,    marginRight: 5,  },  topBgView: {    flexDirection: ‘row‘,    backgroundColor: ‘red‘,    marginTop: 10,  },  unitView: {      width: 70 ,    },  imageStyle: {     alignSelf: ‘center‘,     width: 45,     height: 45,   },  textStyle: {      marginTop: 0,      textAlign: ‘center‘,      fontSize: 15,      color: ‘#555555‘  }});AppRegistry.registerComponent(‘machaoProject‘, () => machaoProject);

react-native 學習之Image篇

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.