官方文档:
https://reactnative.cn/docs/imagebackground/
https://reactnative.cn/docs/image/
代码复制即可使用
代码:
ImageBackgroundDemo.js
import React, {Component} from 'react';
import {Platform, StyleSheet, Text, View, Alert, Button, TouchableHighlight, ImageBackground,Image} from 'react-native';
/**
*
* ImageBackground 作为某个组建的背景
* Image 显示本地图片 显示网络图片
*
* https://reactnative.cn/docs/imagebackground/
* https://reactnative.cn/docs/image/
*
*
*/
export default class ImageBackgroundDemo extends Component {
//渲染数据
render() {
return (
<View>
<ImageBackground source={require('../img/poster.jpg')} style={styles.image1}>
<Text style={
{color: '#fff'}}>Inside</T