reactjsreact-nativefadeoutreact-animated

React Native Animated opacity - does the item become transparent or is gone entirely?


Pardon me if this question is silly but I really want an explicit clarification and didn't have much luck finding one online. I chanced upon the Animated library and thought it would be useful in my project to animate a notification. However, I realised that upon fadeOut, certain buttons seemed to be blocked. Hence, can I clarify that when opacity is set to 0, will the notification box be entirely gone or does it simply become transparent? If so, is there any way to remove the notification box upon fadeOut?


Solution

  • it is still there as you've noticed. you can use pointerEvents prop to make it non-interactable.

    With animations, usually there is a callback you can provide to be executed when the animation completes. you can set some state which will cause your View to be removed in that callback.