@@ -148,6 +148,20 @@ private async Task<View> Go(bool isHotReload = false)
148
148
var view = ( View ? ) _services . GetService ( targetType ) ??
149
149
throw new Exception ( $ "View { targetType . Name } not found") ;
150
150
151
+ _ = view . FadeTo ( 1 ) ;
152
+
153
+ string ? previousRouteName = null ;
154
+ Type ? previousRouteType = null ;
155
+ View ? previousView = null ;
156
+
157
+ if ( _activeIndex > 0 )
158
+ {
159
+ previousRouteName = _navigationStack [ _activeIndex - 1 ] . Split ( '?' ) [ 0 ] ;
160
+ previousRouteType = ActiveRoutes [ previousRouteName ] ;
161
+ previousView = ( View ? ) _services . GetService ( previousRouteType ) ??
162
+ throw new Exception ( $ "View { previousRouteType . Name } not found") ;
163
+ }
164
+
151
165
if ( _activeView is not null )
152
166
{
153
167
_activeView . OnLeaving ( ) ;
@@ -166,6 +180,7 @@ private async Task<View> Go(bool isHotReload = false)
166
180
}
167
181
}
168
182
183
+ _ = ( previousView ? . FadeTo ( 0 ) ) ;
169
184
Current ? . View . ShowView ( view ) ;
170
185
171
186
if ( view is FluidView fluidView )
@@ -201,11 +216,8 @@ private async Task<View> Go(bool isHotReload = false)
201
216
. ToDouble ( VisualElement . WidthRequestProperty , flowView . Width )
202
217
. ToDouble ( VisualElement . HeightRequestProperty , flowView . Height ) ) ;
203
218
204
- if ( _activeIndex > 0 )
219
+ if ( previousRouteType is not null )
205
220
{
206
- var previousRouteName = _navigationStack [ _activeIndex - 1 ] . Split ( '?' ) ;
207
- var previousRouteType = ActiveRoutes [ previousRouteName [ 0 ] ] ;
208
-
209
221
_ = fluidView . TransitionView . FlowToResult ( previousRouteType ) ;
210
222
_ = await fluidView . TransitionView . Flow ( targetType ) ;
211
223
}
@@ -214,6 +226,11 @@ private async Task<View> Go(bool isHotReload = false)
214
226
_activeView = fluidView ;
215
227
}
216
228
229
+ if ( previousView is not null )
230
+ {
231
+ Current ? . View . RemoveView ( previousView ) ;
232
+ }
233
+
217
234
return view ;
218
235
}
219
236
}
0 commit comments