masked-view icon indicating copy to clipboard operation
masked-view copied to clipboard

Flickers while navigating (Android)

Open RajibKDey opened this issue 2 years ago • 11 comments

MaskedView flickers showing only the underlying color when navigating on android

https://user-images.githubusercontent.com/47169875/173815386-cea97586-bab6-4fbb-9758-e51e6a6dec38.mov

RajibKDey avatar Jun 15 '22 11:06 RajibKDey

I have the same problem. Any solutions?

erennyuksell avatar Jul 19 '22 22:07 erennyuksell

Struggling with the same problem, no solution so far.

Problem occurs only during StackNavigator's pop and replace actions, push and jumpTo (delegating to the nested BottomTabs) work fine.

I tried setting androidRenderingMode="software" and it didn't help.

    "@react-native-masked-view/masked-view": "0.2.7",

    "@react-navigation/bottom-tabs": "6.0.9",
    "@react-navigation/native": "6.0.6",
    "@react-navigation/native-stack": "6.2.5",
    "@react-navigation/stack": "6.0.11",

pkunat avatar Jul 20 '22 13:07 pkunat

i'm using React-native-navigation by wix and it happens when i call more than once setRoot action. @pkunat Problem appears on my side if maskedElement contains an animated component @unfernandito Can you help us please. Thank you.

erennyuksell avatar Jul 20 '22 14:07 erennyuksell

I think our problem is about this function ` private void updateBitmapMask() { if (this.mBitmapMask != null) { this.mBitmapMask.recycle(); }

View maskView = getChildAt(0);
if (maskView != null) {
  maskView.setVisibility(View.VISIBLE);
  this.mBitmapMask = getBitmapFromView(maskView);
  //maskView.setVisibility(View.INVISIBLE);
} else{
  this.mBitmapMask = null;
}

}`

erennyuksell avatar Jul 22 '22 12:07 erennyuksell

Hi guys, I hope you are well.

I'll check the library and try to find a fix for your problem.

Could you please post the steps to reproduce the issue and an example video?

Or even a piece of code to reproduce it could be useful.

Regards

unfernandito avatar Jul 22 '22 12:07 unfernandito

@unfernandito i found what is causing the problem in my scenario. Unmounting the view after the animation is done is causing the problem. More precisely, its re-rendering is causing problems. Like setting state etc. 1 2

erennyuksell avatar Jul 22 '22 13:07 erennyuksell

@erennyuksell In my case the masked element is an icon from FontAwesome, so no animations (except for the ones introduced by react-navigation). I'm using MaskedView to add gradient to the icons.

@unfernandito Sorry for the late response. Here's a minimalistic project that reproduces this bug: https://gitlab.com/pkunat/maskedview-react-native-navigation-bug-repro/-/tree/master I tried to do it in codesandbox, but it kept crashing, so I gave up. All the relevant code is in App.js https://gitlab.com/pkunat/maskedview-react-native-navigation-bug-repro/-/blob/master/App.js As for the video, it's basically what you see in @RajibKDey 's opening post - when the transition animation starts, maskElement disappears and the background element is shown for a brief moment (but only when going from view2 to view1)

pkunat avatar Jul 29 '22 12:07 pkunat

Thanks for the example code, I'll check it and come back with some kind of fix.

It looks like the method which removes sub-children has been executed one by one and It's not removing the entire masked view element at the same time.

unfernandito avatar Jul 29 '22 14:07 unfernandito

image

Yes, that's the issue.

The background element it's been unmounted after the maskedElement causing this strange behavior.

I'll keep looking for a fix.

unfernandito avatar Jul 29 '22 14:07 unfernandito

@unfernandito could you tell us what the progress is? Do you need any help with that?

michalgrzelak avatar Aug 16 '22 12:08 michalgrzelak

@unfernandito Hi, is there any development?

erennyuksell avatar Aug 31 '22 13:08 erennyuksell