Skip to content
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

ImageView + DraweeHolder: Image is cleared during fragment transition #2512

Closed
snepalnetflix opened this issue Jul 15, 2020 · 9 comments
Closed
Assignees
Labels
needs-details This issue or PR is currently not actionable as it misses details (e.g. for reproducing the problem) stale

Comments

@snepalnetflix
Copy link

Description

I'm using a ImageView with DraweeHolder. When I transition to a different fragment, the image in my image view is cleared. My non-Fresco backed images don't get cleared.

It seems like this is triggered from AbstractDraweeController.onDetach.

Is there any way to avoid this?

Additional Information

  • Fresco version: 2.2.0
  • Platform version: Android Q
@stale
Copy link

stale bot commented Jul 25, 2020

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as "bug" or "enhancement" and I will leave it open. Thank you for your contributions.

@stale stale bot added the stale label Jul 25, 2020
@oprisnik
Copy link
Contributor

Hey! Are you using animations? If so, this is probably the same issue as #1445.

@stale stale bot removed the stale label Jul 27, 2020
@oprisnik oprisnik added the needs-details This issue or PR is currently not actionable as it misses details (e.g. for reproducing the problem) label Jul 27, 2020
@oprisnik oprisnik self-assigned this Jul 27, 2020
@stale
Copy link

stale bot commented Aug 8, 2020

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as "bug" or "enhancement" and I will leave it open. Thank you for your contributions.

@stale stale bot added the stale label Aug 8, 2020
@stale
Copy link

stale bot commented Aug 16, 2020

Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please feel free to reopen with up-to-date information.

@stale stale bot closed this as completed Aug 16, 2020
@snepalnetflix
Copy link
Author

@oprisnik thanks for the link. I think it's a similar issue. I applied your patch from here in my custom image view. To make things work I also need to override onVisibilityAggregated:

    override fun onVisibilityAggregated(isVisible: Boolean) {
        super.onVisibilityAggregated(isVisible)
        maybeOverrideVisibilityHandling();
    }

@oprisnik oprisnik reopened this Sep 7, 2020
@stale stale bot removed the stale label Sep 7, 2020
@oprisnik
Copy link
Contributor

oprisnik commented Sep 7, 2020

Thanks, so you're saying that with the patch and your patch everything is fixed?

@snepalnetflix
Copy link
Author

Thanks, so you're saying that with the patch and your patch everything is fixed?

Correct. We no longer see flashes during fragment transitions.

@stale
Copy link

stale bot commented Sep 20, 2020

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as "bug" or "enhancement" and I will leave it open. Thank you for your contributions.

@stale stale bot added the stale label Sep 20, 2020
@stale
Copy link

stale bot commented Oct 4, 2020

Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please feel free to reopen with up-to-date information.

@stale stale bot closed this as completed Oct 4, 2020
facebook-github-bot pushed a commit to facebook/react-native that referenced this issue Jun 19, 2023
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-details This issue or PR is currently not actionable as it misses details (e.g. for reproducing the problem) stale
Projects
None yet
Development

No branches or pull requests

2 participants