question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Navigation component: shared transitions backward not works

See original GitHub issue

Component used: Navigation Version used: 1.0.0-alpha06 Devices/Android versions reproduced on: All

Fragment one: RecyclerView (GridLayoutManager). Transition name to ImageView is assigned in Adapter from model’s name (unique) Fragment two: Detail Fragment with ImageView and some text data. Transition name retrieved from argument’s bundle.

Forward shared transition works excellent, but when I press “back” button there is no transition at all. In NavHostActivity: override fun onSupportNavigateUp() = findNavController(R.id.nav_host_fragment).navigateUp()

In old paradigm

fragmentManager
            .beginTransaction()
            .addSharedElement(sharedImageView, transitionName)

all worked fine.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:4
  • Comments:11 (1 by maintainers)

github_iconTop GitHub Comments

23reactions
wrabotcommented, May 1, 2019

I think I found the reason with debugging. navigate will create a transaction with

setReorderingAllowed(true)

This seems to cause the issue

I found a workaround In calling fragment, add the following in onViewCreated (or at the end of onCreateView)

postponeEnterTransition()
view.doOnPreDraw { startPostponedEnterTransition() }
18reactions
caitlynoleykowskicommented, Apr 11, 2019

The GithubBrowserSample contains a shared element transition between an ImageView and another ImageView. When trying to do this between two different element types (such as a list element and the entire detail view, like in gmail when selecting on an email), the return transition does not seem to work. Are there any examples that use shared element transition with navigation component between a list and the list detail view?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Shared Element Transition not working at all - Stack Overflow
Have you tried postponing the enter transition inside LandingFragment::onViewCreated and manually setting the transition name to the view?
Read more >
Navigation Component for Android Part 3: Transition and ...
In this tutorial, you'll learn how to use shared element transitions, action bar and bottom navigation to make an app that shows a...
Read more >
Shared element transition on back pressed [118475573]
Shared element transition doesn't works when moves from backStack. That bug presents only if i use Navigation framework and try to implement shared...
Read more >
Animate transitions between destinations - Android Developers
Shared element transitions to a fragment destination ... The Navigation component lets you add both property and view animations to actions.
Read more >
Shared Element Transition in Navigation Architecture ...
Shared Element transition mainly composes of 3 components: ... However if you navigate back to the first screen the transition doesn't ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found