【发布时间】:2018-01-17 21:37:05
【问题描述】:
我想在背景图像的“前层”上渲染一个 svg 图像。
当视图加载时,只出现背景图像,我没有得到任何错误。图像是否甚至加载(在背景的背景下)?
这是我到目前为止所做的:
import React, { Component } from 'react';
import {
AppRegistry,
StyleSheet,
View,
Image,
} from 'react-native';
import SVGImage from 'react-native-svg-image';
export default class ShowScreen extends Component {
render() {
return (
<View style={styles.container}>
<Image
source={require('../img/image.jpg')}
style={styles.backgroundImage}
blurRadius={1}>
<View style={styles.content}>
<SVGImage
style={{ width: 80, height: 80 }}
source={{uri:'https://fluent-panda.appspot.com.storage.googleapis.com/dumbbell.svg'}}/>
</View>
</Image>
</View>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
},
backgroundImage: {
flex: 1,
alignSelf: 'stretch',
width: null,
justifyContent: 'center',
},
content: {
alignItems: 'center',
}
});
为什么图片没有出现?我正在使用 react-native。
【问题讨论】:
-
也许尝试添加 flex: 1;到styles.content
标签: image svg react-native background