首页 > 其他 > 详细

Learn the Basics - RN2

时间:2019-03-21 13:43:19      阅读:134      评论:0      收藏:0      [点我收藏+]

使用Image

1. 引用

import { Image } from react-native;

2. 使用

    format:

    <Image source={{}} style{{}} />

例如:

<Image source={{uri: https://upload.wikimedia.org/wikipedia/commons/d/de/Bananavarieties.jpg}}
            style={{width: 193, height: 110}}/>

 

源代码:

App.js

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

export default class App extends React.Component {
  render() {
    return (
      <View style={styles.container}>
        <Text>Open up App.js to start working on your app!</Text>
        <Image source={{uri: https://upload.wikimedia.org/wikipedia/commons/d/de/Bananavarieties.jpg}}
            style={{width: 193, height: 110}}/>
      </View>
    );
  }
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: #fff,
    alignItems: center,
    justifyContent: center,
  },
});

 

Reference:

1. Learn the Basics - v0.59

 

Learn the Basics - RN2

原文:https://www.cnblogs.com/xiaobin-hlj80/p/10571070.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!