码迷,mamicode.com
首页 > 其他好文 > 详细

[Flexbox] Use Flex to Scale Background Image

时间:2016-10-25 07:43:00      阅读:225      评论:0      收藏:0      [点我收藏+]

标签:registry   jpg   reg   back   efault   imp   scale   creat   container   

In this lesson we will use Flexbox to scale a background image to fit on the screen of our React Native application.

 

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

export default class general extends Component {
  render() {
    return (
      <Image source={require("./cat.jpg")} style={styles.container}>
        <Text>A good looking cat</Text>
      </Image>
    );
  }
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    width: null,
    height: null,
    alignItems: "center",
    justifyContent: "center"
  }
})

AppRegistry.registerComponent(general, () => general);

 

[Flexbox] Use Flex to Scale Background Image

标签:registry   jpg   reg   back   efault   imp   scale   creat   container   

原文地址:http://www.cnblogs.com/Answer1215/p/5995283.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!