react-native icon indicating copy to clipboard operation
react-native copied to clipboard

[Image] White flickering when changing image

Open PhilippKrone opened this issue 11 years ago • 38 comments

Hi,

I just updated from RN 0.8 to the current master and I'm seeing the following behaviour.

I'm showing images from the local UserDefaultsDirectory and when loading such an image, I see a very fast white flickering (I think while loading the image). This was not the case in RN 0.8. I know that the loading happens async and thus, loading times might occur. But is there any option to not have this white flickering - knowing that perhaps for 1 or 2 FPS, the view is not updated (I would prefer having the old content shown for another 1 or 2 FPS than having old content -> white screen -> new content).

My background is the following: I'm having a card which I "flip" via the Animated API. After the animation is done, I actually have to re-render the screen as otherwise, Touchable buttons are not working correctly (due to still being on the "wrong side" of the card). And while re-rendering, I get a white flickering on the position of the image (although the actual image is the same all the time, I'm rendering it in another Image component that is on the other side of the card).

Thanks Philipp

PhilippKrone avatar Sep 06 '15 11:09 PhilippKrone

I encountered flickering when switching between tabs when upgrading from 0.9 to master as well. It may have to do with an optimization that removes off-screen images cc @a2

ide avatar Sep 06 '15 11:09 ide

Did anyone find a workaround for this?

jsierles avatar Sep 27 '15 06:09 jsierles

I see flickering when doing navigator.push to a new view. The images on the previous screen flicker once as the new view slides from the right. Any ideas how to fix this? My issue posted here: https://github.com/facebook/react-native/issues/3187

ghost avatar Oct 02 '15 04:10 ghost

@a2 Do you have any idea here?

PhilippKrone avatar Oct 08 '15 12:10 PhilippKrone

I can notice a similar behavior as described by @PhilippKrone

Purii avatar Oct 15 '15 21:10 Purii

I have image flickering when doing tab switching in TabBarIOS on 0.15, any fix yet?

IlyasM avatar Dec 04 '15 05:12 IlyasM

I'm using the images for background purposes and when switching to a new scene using the navigator, it starts rendering the image mid transition. This is unfortunate, and I wouldn't mind waiting 1-2 frames for the transition to start too.

Intellicode avatar Dec 23 '15 09:12 Intellicode

I think it would be better to at least fade in the images.

satya164 avatar Dec 24 '15 18:12 satya164

I wonder if the problem I'm having is related to this issue. Is there any successful workaround?

Thanks!

eduardoboucas avatar Mar 09 '16 21:03 eduardoboucas

This thread is closed in favour of #4869 and #4869 is closed in favour of this thread!

This is definitely an issue, I'm experiencing it with switching to any page in NavigatorIOS or Tab bar IOS and back to a page with a background image.

hasen6 avatar Mar 19 '16 01:03 hasen6

I'd like to note that resizeMode being set to 'cover' instead of 'contain' solved one flickering issue when the assets were being loaded for a second time.

However, I experience a flicker when switching between two images, on first load. I expect this is because the image is being decoded on the fly, can anyone think of a way we can decode assets before they are being rendered, so the user won't experience a flash?

gravitinos avatar Apr 20 '16 16:04 gravitinos

I'm experiencing flickering on rendering the same image. It re-renders when selected the image does not change. The previously selected image becomes deselected but also does not change image. Every time the image is deselected, it flickers, even though its position has not changed and the image is the same.

Is this every going to be fixed? Its been eight months now since this was raised and I feels its somewhat of a major issue. It makes apps look very unprofessional.

hasen6 avatar May 07 '16 08:05 hasen6

We are experiencing the same issue for navigation bar icons when switching between screens using Navigator.

roman01la avatar May 09 '16 13:05 roman01la

Just wondering if anything was in the works for this?

In the meantime, I have a somewhat hacky workaround component to switch between 2 images on highlight, which works with resizeMode=contain

Check it out!

MichaelDanielTom avatar May 20 '16 03:05 MichaelDanielTom

@MichaelDanielTom We have switched to SVGs. Didn't notice any problems so far.

roman01la avatar May 20 '16 10:05 roman01la

@roman01la That's not really a solution for all though.

hasen6 avatar May 20 '16 14:05 hasen6

@roman01la I wasn't aware that SVGs were supported, how are you using them exactly, just in an ?

MichaelDanielTom avatar May 22 '16 22:05 MichaelDanielTom

I use a background image for several sequential screens and did the following as a quick fix for each.

    componentWillMount() {
        // "Preload" static image
        (<Image source={require('./background.png')} />);
    }

I know it's another hacky fix, but it helps for the mean time.

@roman01la I'm curious also, how are you using svg?

blakeandrewwood avatar May 24 '16 11:05 blakeandrewwood

@MichaelDanielTom @blakeandrewwood We are using ReactNativeART package which is included into React Native. This article has examples of rendering SVG.

roman01la avatar May 24 '16 11:05 roman01la

@blakeandrewwood how are you rendering the Image inside the component after doing that with componentWillMount()? Thanks.

juanpujol avatar Aug 24 '16 12:08 juanpujol