Android navigation component exitAnim not working when popUpTo with not empty stack

Viewed 247

There are popUpTo="nav_graph_id" with popUpToInclusive="true" to clear back stack when navigating. Also there are enterAnim and exitAnim set. When stack looks like this: A -*> B (no fragments behind current fragment), both animations work. When it is A -> B -> ... -*> N (one or more fragments behind current fragment), exitAnim is not working.

I've isolated this problem, so it only happens when there are other fragments except the current one.

Bellow is my navigation graph with commented points of interest.

Any way to make exitAnim work inside Pin? version 2.3.5.

<navigation 
  android:id="@+id/nav_main"
  app:startDestination="@id/nav_main_auth"
  >

  <!-- auth -->
  <fragment android:id="@+id/nav_main_auth">

    <!-- to pin -->
    <action
      android:id="@+id/nav_main_auth_to_pin"
      app:destination="@id/nav_main_pin"
      app:enterAnim="@anim/slide_in_left"
      app:exitAnim="@anim/slide_wait"
      app:popExitAnim="@anim/slide_out_right"
      />

    <!-- to home -->
    <action
      android:id="@+id/nav_main_auth_to_home"
      app:destination="@+id/nav_main_home"
      app:popUpTo="@id/nav_main"
      app:popUpToInclusive="true"
      app:enterAnim="@anim/slide_in_left"
      app:exitAnim="@anim/slide_out_left" <!-- here it does work cause no fragments except this one -->
      />

  </fragment>

  <!-- pin -->
  <fragment android:id="@+id/nav_main_pin">

    <!-- to home -->
    <action
      android:id="@+id/nav_main_pin_to_home"
      app:destination="@+id/nav_main_home"
      app:popUpTo="@id/nav_main" <!-- if I remove popUps it works -->
      app:popUpToInclusive="true"
      app:enterAnim="@anim/slide_in_left"
      app:exitAnim="@anim/slide_out_left" <!-- here it does not work cause there's auth fragment behind -->
      />

  </fragment>

  <!-- home -->
  <fragment android:id="@+id/nav_main_home" />
  
</navigation>
0 Answers
Related