2017-08-09 55 views
0

我想在背景圖像的「前層」上呈現svg圖像。如何在背景圖像的前面渲染一個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。

+0

也許嘗試添加柔性解決:1;到styles.content – lukaleli

回答

0

也有類似的問題,在地圖部件添加文本,並通過加入z-index: -1到後面元素(在這種情況下,地圖)