-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Share Element Gone after do SharedElementReturnTransition in Android N #1445
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
Comments
Can you please show how you do the transition part using Fresco's demo app? |
activity_main.xml and activity_detail� has same SimpleDraweeView with same transitionName protected void onCreate(Bundle savedInstanceState) { addTransitionListener() does nothing just print log so do I use wrong way to do the transition? � |
This is happening to me as well. I have the following in onCreate() method before super.onCreate()
|
I'm experiencing the same issue. The setSharedElementReturnTransition is not working on Android N. I've added logs to the transition listeners and the onTransitionStart and onTransitionEnd are not triggered on Android N, but on Android M & L it works just fine. |
Any update on this issue? |
Switched from Fresco to Picasso and the issue is resolved. Too bad this library isn't maintained as often as required by the new Android OS versions that come out. |
It seems that this issue is incorrectly marked as 'needs-details'. This problem also exists on Android 7.1.1 (API level 25). |
Thanks, we'll take a look |
I am also experiencing the same problem, so +1 from me for fixing it. |
same here |
Do it. Do it. ;-) |
Yes, please do it. |
Please... |
+1 |
Wonder why this isn't a high priority.. |
+1 |
When I scroll to the shared element position in
If someone knows a better fix I would appreciate if you could share it. |
Hello, i am experiencing the same issue but only on Android 7.1.1 API 25 If there are any updates about the issue i would highly appreciate it. |
same here on emu with 7.x, but I use onWindowFocusChanged be immersive, when finish occured the image will disappear but reshow instantly. |
Same here. Calling requestLayout on the View containing the SimpleDraweeView seems fixing it with some flickering. Please advise |
Just add this code in calling activity,+1 if this can help you!!! @oprisnik
|
same problem here... @antxyz I've put your code in both calling and callee activities onCreate method but with no success. The shared element image is still invisible after returning transition. |
I don't know If it can help to find a solution, but I noticed that when softkeyboard is opened, the SimpleDraweeView become visible. |
I was having the same problem and it was fixed after this two calls:
|
@oprisnik I finally found the cause of my problem. |
Please fix this issue... |
Fresco 1.9.0 doesn't fix the issue properly.
So I'm using both workarounds in my code to be safe in my code and hopefully that covers everything. @oprisnik I'll spend some time to try and understand the problem better, if I find a fix I'll submit a PR. |
Yeah, unfortunately we still don't have a good fix for this issue since all solutions mentioned in this thread fail in one or the other way. If somebody has an idea on how to properly fix this, please let us know or, even better, submit a PR :) |
Still, this issue on react-native-maps component. I imagine it's a concurrent problem? |
Any progress on pinpointing the issue? Seems we haven't hear anything since April. |
We still did not have time to further investigate what's going on here. Feel free to look into the issue and submit a pull request! |
As mentioned earlier, the underlying issue seems to be an Android framework bug where ImageView doesn't properly restore the visibility of the underlying Drawable when returning from the transition. I've filed an Android bug report here: https://issuetracker.google.com/issues/111293868 I've also created a (non-Fresco) sample app that outlines the issue: https://github.com./oprisnik/VisibilityPlayground We'll investigate if there is a workaround for this issue. However, Fresco requires manual memory management and we rely on the Drawable visibility to re-request the image, so I'm not sure if there is a better fix than the workarounds described above. |
I switched to fresco not being aware of this issue. I render a ton of gifs and it does a great job, but I'm also dependent on these animations for navigation. I've been able to use the above mentioned hacks, but on a return animation, the image will disappear. |
Actually invalidate or View.setVisibility can not show drawable, you need call Drawable.setVisible(true, true) directly .
|
@oprisnik In your non-fresco sample app you set the transition to ChangeBounds. Does the bug happen if you remove this line? I guess the visibility is restored correctly when the |
This was the fix for animating fresco images as per https://frescolib.org/docs/shared-transitions.html. But turns out they still don't work because of fresco/android bug, facebook/fresco#1445 and https://issuetracker.google.com/issues/111293868 (tried the workaround in the fresco bug but they didn't work). So backing it out and not supporting shared images for the first release. Will revisit when fresco/android fix the problem
@RainFool is right. simpleDraweeView.getVisibility() is |
Yes, this is a bug in the Android framework where the View visibility (ImageView to be precise) is not propagated to the Drawable, so you have to manually update visibility. Please star the Android bug report here so that this gets more visibility: https://issuetracker.google.com/issues/111293868 |
Summary: Adds support for Android Transitions during Fragment navigation. React Native navigation libraries (like [the Navigation router](https://github.com./grahammendick/navigation/blob/e9deae985a1962db17d6b1fbf90628d20c29810c/NavigationReactNative/src/android/src/main/java/com/navigation/reactnative/NavigationStackView.java#L139) and [React Native Screens](https://github.com./software-mansion/react-native-screens/blob/ea240b46866d66398904d0c2d0fe5fabdc2f269b/android/src/main/java/com/swmansion/rnscreens/ScreenContainer.kt#L98)) use Fragments to manage the stack of screens. But they can’t use Transitions to animate these Fragments because React Native images disappear during the Transition (see the videos in the Test Plan section below). Navigation libraries are forced to [setCustomAnimations](https://developer.android.com/reference/androidx/fragment/app/FragmentTransaction.html#setCustomAnimations(int,int)) instead of [enter and exit Transitions](https://developer.android.com/reference/android/app/Fragment#setEnterTransition(android.transition.Transition)). But animations have limitations compared to Transitions - Animations have to be resx files so can’t be defined declaratively in React - Android’s Material Transforms are built around Transitions - Native shared elements only support Transitions Images disappearing during Transitions is [a known Fresco bug](facebook/fresco#2512). This PR applies [the fix suggested by the Fresco repo](facebook/fresco#1445 (comment)). ## Changelog: [ANDROID] [FIXED] - Support Android Transitions during Fragment navigation Pull Request resolved: #37857 Test Plan: I’ve created a [minimal reproduction that demonstrates the bug](https://github.com./grahammendick/image-disappears-during-transition-bug). The first video below shows the example from that repo. You can see that the image disappears when changing the painting. It should fade out and in like the text does. The second video shows the same example after the fix is applied. You can see that the painting fades out and in just like the text. https://github.com./facebook/react-native/assets/1761227/6739f029-eda0-44d2-b328-a73b075bd82a https://github.com./facebook/react-native/assets/1761227/9c73cdf0-303b-4a82-8df5-5f6a5846a58e Reviewed By: javache Differential Revision: D46769995 Pulled By: dmytrorykun fbshipit-source-id: 0ced8af7b246d8c59cbfb5cabf422114c6154c65
Fix suggested by fresco, see facebook/fresco#1445 (comment)
I use the newest fresco code for doing SharedElement Transition work, it runs well in Android L、M, But on Android N, it goes wrong
before transition

after transition

The text was updated successfully, but these errors were encountered: