question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Image with resizeMode=contain blinks on rerender (Android)

See original GitHub issue

Hey guys,

I’m trying to change the image of a button based on if the button is selected or not. However if the image has resizeMode set to ‘contain’, the image always blinks before changing. Other resizeModes do not blink. The image sources are local, included with require.

Here’s a barebones render method that should reproduce the issue:

render() {
    var source = this.props.isSelected ? require('./image1.png') : require('./image2.png')
    return (
        <TouchableNativeFeedback>
            <View>
                <Image style={{resizeMode: 'contain'}} source={source} />
            </View>
        </TouchableNativeFeedback>
    )
}

I’m using rn0.22.2 for Android, developing on a Mac. The issue occurs on both device and simulator, with debug mode both on and off.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:9 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
gugwadcommented, May 28, 2017

Any update on this, I am using react-native 0.43.4, issue still persists. Image with resizeMode='contain' flickers upon re-render in android.

0reactions
icazevedocommented, Jan 29, 2018

I have the same problem, it only works when I set the height and width manually and directly. RN@0.51.1 on Android

Read more comments on GitHub >

github_iconTop Results From Across the Web

resizeMode="contain" makes my images blinking on changin ...
I'm using resizeMode="contain" for my images and when I change view or update state they keep blinking on android devices. if I change...
Read more >
Image with resizeMode=contain blinks on rerender (Android)
Image with resizeMode=contain blinks on rerender (Android). mkonicek. Moved from https://github.com/facebook/react-native/issues/6971.
Read more >
5 Things to know about Images in React Native - Medium
You really need the image to be present locally in order to avoid any flickering effect when loading it. It also allows to...
Read more >
expo-splash-screen - npm
By using this resize mode your app will will leverage Android's ability to present a static bitmap while the application is starting up....
Read more >
Pains with FlatList re-rendering and causing images to re-load ...
includes( // prevProps.item.SK //) //Returning true, but I still have a refresh. return true; };. My item, which consists of a header, body...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found