您的位置:首页 > Web前端 > React

[Wondgirl]从零开始学React Native之image(六)

2016-12-26 10:19 639 查看


上面的为网络图片,下面的为本地图片,

新建一个images文件夹用来存放本地图片



index.ios.js

/**
* Sample React Native App
* https://github.com/facebook/react-native * @flow
*/

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

export default class demo extends Component {
render() {
return (
<View>

<Image source={{uri: 'https://facebook.github.io/react/img/logo_og.png'}} style={{width: 400, height: 400}} />

<Image style={styles.image} source={require('./images/icon.png')} />

</View>
);
}
}

//样式
const styles = StyleSheet.create({
image:{

width:200,
height:200,
borderWidth:1,
marginLeft:50,

}

});

AppRegistry.registerComponent('demo', () => demo);
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  reactnativ RNimage