You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is because of internal logic immediately rendering the defaultSource, while source is not rendered and always starts from IDLE state.
I've traced this back to refactoring the Image from class based to functional component, where we no longer add images to ImageUriCache (probably it was overlooked in the refactor?)
The flicker can be easily observer if we put a breakpoint in Image render's code
First render - no dom element added, loading state IDLE ❌
2nd render - loading state IDLE, dom element added, but empty ❌
3rd render - loading state LOADED, dom element updated with image content ✅
Since the image was already rendered and is available on screen it should be immediately rendered at step 1
Is there an existing issue for this?
Describe the issue
When we're (repeatedly) adding the same image on screen there's a small flicker happening the first time the component renders
For example the avatars of a chat app
Expected behavior
Adding the same image twice, should render instantly the 2nd time it's used
Steps to reproduce
Browser: Chrome
ENV: codesandbox
react-native-web: 0.18.12
Steps:
defaultSource(L34) and repeat the steps - no flicker occursScreen.Recording.2023-03-03.at.12.22.40.mov
Test case
https://codesandbox.io/s/rnw-image-flicker-bug-sample-obbhov
Additional comments
There's no such problem if we use both
defaultSourceandsourcewith the same sourceThis is because of internal logic immediately rendering the
defaultSource, whilesourceis not rendered and always starts from IDLE state.I've traced this back to refactoring the
Imagefrom class based to functional component, where we no longer add images toImageUriCache(probably it was overlooked in the refactor?)The flicker can be easily observer if we put a breakpoint in Image render's code
Since the image was already rendered and is available on screen it should be immediately rendered at step 1