-
Notifications
You must be signed in to change notification settings - Fork 24.3k
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
Elevation does not animate when it is inside a view which animates its opacity (Android P) #23090
Comments
It looks like you are using an older version of React Native. Please update to the latest release, v0.58 and verify if the issue still exists. The "⏪Old Version" label will be removed automatically once you edit your original post with the results of running |
I've been running into the same issue for awhile now. Seems to be happening as well for |
+1 |
I am closing this issue because it does not appear to have been verified on the latest release, and there has been no followup in a while. If you found this thread after encountering the same issue in the latest release, please feel free to create a new issue with up-to-date information by clicking here. |
I experience this issue too |
I added a repo with |
Hi i'm experiencing this issue as well on Android Pie only (earlier versions are fine), any suggestions on work arounds? |
I'm experiencing this issue too. Does anybody found a workaround for this issue? |
Is anyone working on this? We are facing the same issue |
Also facing this issue, any solution? |
damn this is bad, never thought it would be like that , for now I can't use elevation because it leave the shadow for a little while , when the opacity goes to 0 |
I'm also facing this issue. Does anyone know any workaround? Especially annoying when I'm trying to animate a box with several buttons inside it, the shadows appear before the buttons do. |
@fabriziobertoglio1987 The child needs to have elevation.
This is the easiest way to reproduce |
happening on 0.62.2 |
I experienced it a few times in different react-native version, also in react-native For example
|
@CyxouD Thank you for the workaround, i will keep it in mind for when shadows are a necessity. It's such a pity, Neumorphism employs shadows a lot and i'm facing such a scenario but i will keep it in mind. The main issue is with react-navigation to be honest but what can you do : / |
@CyxouD I believe it can be edited in the |
My issue: On android, setting a view's opacity will render artifacts when child views have elevation. So I've investigated this issue and came to the conclusion, that this is an android intended behavior. Background: <View style={{opacity: 0.5}}>
<View style={{elevation: 5, margin: 10, backgroundColor: 'red'}}>
<View> To understand this issue we let's dig into react code. Both views will get a Problem: In the screenshot below you can see the different parameters (plain android project in this repo, not react-native, although I used the same ReactViewBackgroundDrawable class from react-native which I just extracted and patched to get it running). Repo: https://github.com/DomiR/react-native-opacity-issue Solution: Fortunately, we can set this flag using As @kmagiera mentioned that you should probably enable this only temporarily during animations. PS: What also should work is setting the opacity value for all children as well. |
what about option "renderToHardwareTextureAndroid" for View? |
Thanks @DomiR , can confirm that setting |
- Use two different animations for entering/exiting - Removed useless styles - Fix janky Android elevation animation by setting `needsOffscreenAlphaCompositing` while animating (see facebook/react-native#23090)
Any updates? |
So the trick is to set the elevation to 0 until fade-in animation is complete for the view. |
…g={true}) * ref: facebook/react-native#23090 (comment)
…phaCompositing={true}) (#225) * * fix shadow artifacts on Android (use needsOffscreenAlphaCompositing={true}) * ref: facebook/react-native#23090 (comment) * * use needsOffscreenAlphaCompositing only on Android
Several users tested a workaround (needsOffscreenAlphaCompositing) for this issue (more info in #23090 (comment)). I believe this issue is solved. |
Environment
Description
What described in the title works in any Android but not on Android P. See the differences:
Android P:
Below Android P:
Reproducible Demo
https://snack.expo.io/@satya164/elevation-issue---android-p
This can affect libraries like
react-navigation
when a new screen comes in animating its opacity. See react-navigation/react-navigation#5535.Can be found here also https://github.com/ferrannp/react-native-elevation-animation-android-pie with react-native 0.59.X.
The text was updated successfully, but these errors were encountered: