@@ -174,8 +174,7 @@ async Task PresentModal(Page modal, bool animated)
174174 var dialogFragment = new ModalFragment ( WindowMauiContext , modal )
175175 {
176176 Cancelable = false ,
177- IsAnimated = animated ,
178- modalNavigationManager = this
177+ IsAnimated = animated
179178 } ;
180179
181180 var fragmentManager = WindowMauiContext . GetFragmentManager ( ) ;
@@ -211,7 +210,6 @@ internal class ModalFragment : DialogFragment
211210
212211 public event EventHandler ? AnimationEnded ;
213212
214- public ModalNavigationManager ? modalNavigationManager { get ; internal set ; }
215213
216214 public bool IsAnimated { get ; internal set ; }
217215
@@ -225,7 +223,7 @@ public ModalFragment(IMauiContext mauiContext, Page modal)
225223
226224 public override global ::Android . App . Dialog OnCreateDialog ( Bundle ? savedInstanceState )
227225 {
228- var dialog = new CustomComponentDialog ( RequireContext ( ) , Theme , modalNavigationManager ) ;
226+ var dialog = new CustomComponentDialog ( RequireContext ( ) , Theme ) ;
229227
230228 if ( dialog is null || dialog . Window is null )
231229 throw new InvalidOperationException ( $ "{ dialog } or { dialog ? . Window } is null, and it's invalid") ;
@@ -395,21 +393,18 @@ void FireAnimationEnded()
395393
396394 sealed class CustomComponentDialog : ComponentDialog
397395 {
398- public CustomComponentDialog ( Context context , int themeResId , ModalNavigationManager ? modalNavigationManager ) : base ( context , themeResId )
396+ public CustomComponentDialog ( Context context , int themeResId ) : base ( context , themeResId )
399397 {
400- this . OnBackPressedDispatcher . AddCallback ( new CallBack ( true , this , modalNavigationManager ) ) ;
398+ this . OnBackPressedDispatcher . AddCallback ( new CallBack ( true , this ) ) ;
401399 }
402400
403401 sealed class CallBack : OnBackPressedCallback
404402 {
405403 WeakReference < CustomComponentDialog > _customComponentDialog ;
406404
407- private WeakReference < ModalNavigationManager ? > _modalNavigationManager ;
408-
409- public CallBack ( bool enabled , CustomComponentDialog customComponentDialog , ModalNavigationManager ? modalNavigationManager ) : base ( enabled )
405+ public CallBack ( bool enabled , CustomComponentDialog customComponentDialog ) : base ( enabled )
410406 {
411407 _customComponentDialog = new ( customComponentDialog ) ;
412- _modalNavigationManager = new ( modalNavigationManager ) ;
413408 }
414409
415410 public override void HandleOnBackPressed ( )
@@ -445,13 +440,6 @@ public override void HandleOnBackPressed()
445440 }
446441 }
447442
448- if ( ! preventBackPropagation && _modalNavigationManager . TryGetTarget ( out var mnm ) )
449- {
450- {
451- _ = mnm . PopModalAsync ( true ) ;
452- }
453- }
454-
455443 eventHandler = null ;
456444 void OnPopCanceled ( object ? sender , EventArgs e )
457445 {
0 commit comments