5

I am building an app using react native and I want to achieve a background image with repeat resize mode like this.

        <View 
            style   = {style.container}>
            <ImageBackground 
                source={require('../../assets/images/background.png')}
                resizeMode="repeat"
                style={style.imageBackground}
                >
                    ...
            </ImageBackground>
        </View>

Styles:

imageBackground: {
    width: '100%', 
    height: '100%', 
    resizeMode: 'repeat',
    justifyContent:'center'
},
container: {
    marginTop: Platform.OS === 'ios' ? 0 : StatusBar.currentHeight + 30,
    flex: 1,
    backgroundColor: COLORS.BACKGROUND,
    justifyContent: 'center',
},

On iOS it works perfectly. But when I open Android it looks like this:

What am I doing wrong?

Jeff Gu Kang
  • 4,749
  • 2
  • 36
  • 44

1 Answers1

0

Your image has been cached, rename the static file or add query string to dynamic file:

source={require('../../assets/images/background_new.png')}

source={{uri: "link/image.jpg?v=1.1" }}
Mohamad
  • 36
  • 4