Image blinking when changing remote image source
See original GitHub issueConsider the following case: display preview image from camera. Preview is refreshed every 2 seconds. We get image blinking every 2 seconds when replacing the image source:
class CameraPreview extends Component {
constructor(props) {
super(props);
this.refreshInterval = null;
this.state = {previewURL: 'http://via.placeholder.com/1280x720'};
}
componentDidMount() {
this.refreshInterval = setInterval(() => {
const timestamp = new Date().getTime();
this.setState({previewURL: `http://via.placeholder.com/1280x720?t=${timestamp}`});
}, 2000);
}
componentDidUnmount() {
clearInterval(this.refreshInterval);
this.refreshInterval = null;
}
render() {
return (<FastImage style={styles.previewImage}
source={{
uri: this.state.previewURL,
headers:{ Authorization: 'someAuthToken' },
}}
/>);
}
}
Issue Analytics
- State:
- Created 5 years ago
- Reactions:2
- Comments:5 (2 by maintainers)
Top Results From Across the Web
How do you remove the 'flicker' when switching img src on ...
The reason the flicker happens, by the way, is that changing the background image unloads the current one and then loads in the...
Read more >Images are flashing when updates by img.src[]=url in Firefox ...
Setting the src attribute of an <img > sporadically causes the blink whether or not the image is pre-cached. Creating two stacked img's...
Read more >Avoid layout flicker during image load - Mohammed Omer
Sometimes, when you load a web page you see some flickering in the page layout before the image is downloaded and rendered on...
Read more >371733 - background image flickers on image changes
Issue 371733: background image flickers on image changes · 1. create a div block · 2. using js setInterval() change the background image...
Read more >ILCE-7RM3 | Help Guide | Anti-flicker Shoot. (still image)
Detects flickering/blinking from artificial light sources such as fluorescent lighting and times the shooting of images to moments when flickering will have ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
+1
Hi there,
just checked out this library here, to get rid of this blinking issue using the built-in
<Image>
component, but… no success 😦 . The problem issued here still appears… on iOS and anroid. Any advices, thoughts?Thanks in advance.