I'm using the ImageBackground component, imported from react-native
, but no image is showing. It's just a white screen in the background
constructor(props){
super(props)
this.backgroundImage = {image: {uri: "https://i.myImage.com"}}
}
......
<ImageBackground style={styles.container} resizeMode="stretch" source={this.backgroundImage} onError={this.onError.bind(this)}>
<AdUnit style={styles.bannerAd} />
<Board />
</ImageBackground>
I've tried changing this.backgroundImage
to {image: require('../assets/images/default_seal.jpg')}
I tried using the resizeMode property specified by this answer but it didn't work.
Edited answer after having a look at the source code. Make your constructor like this:
And your ImageBackground component like this: