@@ -11,6 +11,8 @@ import dev.hotwire.core.bridge.BridgeDestination
1111import dev.hotwire.core.config.Hotwire
1212import dev.hotwire.core.turbo.config.PathConfigurationProperties
1313import dev.hotwire.core.turbo.config.context
14+ import dev.hotwire.core.turbo.config.presentation
15+ import dev.hotwire.core.turbo.nav.Presentation
1416import dev.hotwire.core.turbo.nav.PresentationContext
1517import dev.hotwire.core.turbo.visit.VisitAction
1618import dev.hotwire.navigation.R
@@ -136,24 +138,38 @@ interface HotwireDestination : BridgeDestination {
136138 action : VisitAction
137139 ): NavOptions {
138140 val modal = newPathProperties.context == PresentationContext .MODAL
139- val replace = action == VisitAction .REPLACE
141+ val clearAll = newPathProperties.presentation == Presentation .CLEAR_ALL
142+ val animate = action != VisitAction .REPLACE &&
143+ newPathProperties.presentation != Presentation .REPLACE &&
144+ newPathProperties.presentation != Presentation .REPLACE_ROOT
140145
141146 return if (modal) {
142147 navOptions {
143148 anim {
144- enter = if (replace) 0 else R .anim.enter_slide_in_bottom
149+ enter = if (animate) R .anim.enter_slide_in_bottom else 0
145150 exit = R .anim.exit_slide_out_bottom
146151 popEnter = R .anim.enter_slide_in_bottom
147152 popExit = R .anim.exit_slide_out_bottom
148153 }
149154 }
150155 } else {
151- navOptions {
152- anim {
153- enter = if (replace) 0 else R .anim.enter_slide_in_right
154- exit = R .anim.exit_slide_out_left
155- popEnter = R .anim.enter_slide_in_left
156- popExit = R .anim.exit_slide_out_right
156+ if (clearAll) {
157+ navOptions {
158+ anim {
159+ enter = R .anim.exit_slide_out_left
160+ exit = R .anim.exit_slide_out_right
161+ popEnter = R .anim.enter_slide_in_left
162+ popExit = R .anim.enter_slide_in_right
163+ }
164+ }
165+ } else {
166+ navOptions {
167+ anim {
168+ enter = if (animate) R .anim.enter_slide_in_right else 0
169+ exit = R .anim.exit_slide_out_left
170+ popEnter = R .anim.enter_slide_in_left
171+ popExit = R .anim.exit_slide_out_right
172+ }
157173 }
158174 }
159175 }
0 commit comments