-
Notifications
You must be signed in to change notification settings - Fork 623
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The modal emits a "flash" when used with useNativeDriver=true #92
Comments
I found that react-native-modal didn't clear all the content view when you want to close it. it will apparently show a flash view when you use
|
Hey @Versus2017 , thanks for submitting the issue. I don't know if it can be useful to you but I'm using this modal in some applications with huge lists and heavy renders and my approach is almost always to hide the content of the Modal before setting its visibility to false/true. Regarding your suggestion: unfortunately currenly using the React-Native built in Modal is the only way for showing your content on top of the screen (without using it at root level). |
Yeah, thanks for replying, I just noticed that we can only use Modal to show our content on the top of the screen. |
@Versus2017 I have the same problem you’ve described. As you’ve probably found, the flash goes away if the native driver is not used. The content of my modals isn’t very complex, though, so using the JS thread for animation isn’t an issue for me. With debug builds, using the JS thread makes the animation seem very laggy w/ all the debugging tools running. On a release build, though, it’s very smooth. |
I'm experiencing this as well and can confirm that the issue goes away if I set Basically after |
@mmerickel yes, you and me have the same problem now, and if I set I just tried what the author said that hide the content of the Modal before setting its visibility to false. It did solved my problem, the quick flash almost disappear (sometimes it still shows, but it better than before), but the bad news is the closing animation is gone. the content just disappeared directly without any animationOut animation |
@mmazzarolo I think your idea is the solution. but why can't we do that in your react-native-modal code. I just tried in your code. it's perfectly worked and without any flash again, and the animationOut is still exist. I just add a state prop here is what I do : https://github.com/Versus2017/react-native-modal |
Thanks everyone for the discussion!
What's your opinion on the subject guys? @Versus2017 @mmerickel @wkoutre |
On the one hand, I think your concern about that is right, it may actually confuses newcomers, and most of users may never meet the problem which happend to me. On the other hand, It is necessary for developers who need more higher performance of animation, and has more complex content with heavy render, just like me. It is big problem for them.Here is our logic:
Here is our question :Is it necessary to add this new feature in react-native-modal ? For example:
|
May be related to oblador/react-native-animatable#122 |
I agree with @Versus2017 when he writes:
I don't see how it would create any side effects if this is the standard, implicit functionality when using |
The issue I can see is that this solution would hide the content of the modal for the entire duration of the animations. This could lead to nasty visual effects, especially if the user sets an high animation timing. |
I think you should have a try with The problem which I want to fix is:
The Code is here:
I guess the reason why we set useNativeDriver to true and the Modal will shows a quick flash when visible is false is useNativeDriver has some effects on Modal. So it will shows the quick animation of Modal disappear though the animationType is 'none', finally it becomes the quick flash of what you saw. |
What happens when changing:
to
I guess my question here is: Are you certain the flash happens when |
@RichardLindhout I test it with a high animation timing, I found it happen when animation finished, so I don't think that it is react-native problem. you also can have a try, the problem you can see is modal disappear without animation |
Hmm.. I still think it's a react-native problem since it's a difference in result when using the nativeDriver. https://facebook.github.io/react-native/docs/animated.html But there's no doubt that there will be a work-around to fix this nasty effect. If I have some spare time I'll dig in to it. |
Interesting issue: facebook/react-native#14219 |
Same issue: oblador/react-native-animatable#148 Seems to be a problem which can be tracked down to react-native-animatable and probably react-native. |
@RichardLindhout Have you tried adding |
I could not reproduce this flash bug when making a simple modal with react-native and the native driver.
|
@RichardLindhout I agree with you about that maybe it is react-native animated problem. but I have fix this issue in my own code, I removed the content after animation, so I think it is not the main problem about react-native Animated animation. here is my code https://github.com/Versus2017/react-native-modal. There will be no more flash again. |
@Versus2017 Thanks for your repository. We wil probably switch branches. |
@Versus2017 @RichardLindhout @wkoutre sorry guys but I've been super busy lately, I hope to take a closer inspection at the issue during my xmas holiday. |
@Versus2017 I keep getting the same flash with your repository |
@RichardLindhout I don't get the flash any more with my repository for now, maybe I am still not solve the problem, and maybe it's actually related to React-Native animation, I will continue to follow this problem. Thanks for your feedback. |
@Versus2017 You're right, I used https://github.com/mmazzarolo/react-native-modal-datetime-picker and this library has another dependency so I'm probably going to fork that one ;) |
@Versus2017 Done: https://github.com/profects/react-native-modal-datetime-picker. Works like a charm! Thanks ;) |
Released as beta: |
I confirm that #116 fixes the flash isssue on iOS for me. |
Unfortunately, i still have the flash issue on iOS 😞 |
Unfortunately, i still have the flash issue on iOS too. But I found the frequency of flash is decreased. |
Did you set |
@mmazzarolo I think nope. Should I set it? |
It does work now with |
@mmazzarolo May I ask how to use it? It doesn't listed on document. Do I just add |
@wellyshen sure! I'm adding it to the README.md too 👍 Let me know if it works for you. |
I also updated the README by adding a FAQ and the prop description. |
@mmazzarolo Thanks man, It works. |
Nice! |
If anybody is experiencing similar flicking issue on Android adding the renderToHardwareTextureAndroid prop helped me.
<Dialog.Container
visible={this.state.dialogVisible}
onBackButtonPress={this.toggleDialog}
renderToHardwareTextureAndroid>
<Dialog.Title>title</Dialog.Title>
<Text>blah</Text>
<Dialog.Button label="OK" onPress={this.toggleDialog} />
</Dialog.Container> |
Don't know what i am doing wrong, but the flickering exists when using "slideInDown" opening and "slideOutUp" closing animations. Here are my props
Using useNativeDriver={false} also didn't help. |
Hello there i've used a <Modal
isVisible={modalInput.isModalVisible}
avoidKeyboard
useNativeDriver={Platform.OS === "android"}
hideModalContentWhileAnimating
backdropTransitionOutTiming={0} // <- the trick
backdropOpacity={1}
animationIn="slideInUp"
animationOut="slideOutDown"
/> |
|
When reporting a bug, please be sure to check if the issue still persists with react-native original modal:
Under the hood
react-native-modal
uses react-native original Modal component.Before reporting a bug, try swapping
react-native-modal
with react-native original Modal component to check if the problem persists.When reporting a bug, please be sure to include the following:
react-native-modal
swap described abovereact-native-modal
you're using, and the platform(s) you're running it on (iOS, Android, device)When you open an issue for a feature request, please add as much detail as possible:
Please note by far the quickest way to get a new feature is to file a Pull Request.
The text was updated successfully, but these errors were encountered: