@@ -56,39 +56,11 @@ internal static SafeAreaRegions GetSafeAreaRegionForEdge(int edge, ICrossPlatfor
5656
5757 if ( safeAreaView2 is not null )
5858 {
59- // Check if this view is inside a container that ignores safe area (ListView, TableView)
60- // These containers manage their own layout and should NOT have safe area insets applied to their CONTENT
61- bool isInsideSafeAreaIgnoredContainer = false ;
62- if ( safeAreaView2 is IView mauiView )
63- {
64- // Walk up the parent hierarchy to check if any ancestor is a safe-area-ignored container
65- var ancestor = mauiView . Parent as IView ;
66- while ( ancestor != null )
67- {
68- if ( ancestor is ISafeAreaIgnoredContainer )
69- {
70- isInsideSafeAreaIgnoredContainer = true ;
71- break ;
72- }
73- ancestor = ancestor . Parent as IView ;
74- }
75- }
76-
77- // Apply safe area selectively per edge based on SafeAreaRegions
78- // If inside a safe-area-ignored container, set all values to 0 instead of calculating them
79- double left , top , right , bottom ;
80- if ( isInsideSafeAreaIgnoredContainer )
81- {
82- // Inside ListView/TableView/ViewCell - no safe area padding
83- left = top = right = bottom = 0 ;
84- }
85- else
86- {
87- // Normal safe area calculation
88- left = GetSafeAreaForEdge ( GetSafeAreaRegionForEdge ( 0 , layout ) , baseSafeArea . Left , 0 , isKeyboardShowing , keyboardInsets ) ;
89- top = GetSafeAreaForEdge ( GetSafeAreaRegionForEdge ( 1 , layout ) , baseSafeArea . Top , 1 , isKeyboardShowing , keyboardInsets ) ;
90- right = GetSafeAreaForEdge ( GetSafeAreaRegionForEdge ( 2 , layout ) , baseSafeArea . Right , 2 , isKeyboardShowing , keyboardInsets ) ;
91- bottom = GetSafeAreaForEdge ( GetSafeAreaRegionForEdge ( 3 , layout ) , baseSafeArea . Bottom , 3 , isKeyboardShowing , keyboardInsets ) ;
59+ // Apply safe area selectively per edge based on SafeAreaRegions
60+ double left = GetSafeAreaForEdge ( GetSafeAreaRegionForEdge ( 0 , layout ) , baseSafeArea . Left , 0 , isKeyboardShowing , keyboardInsets ) ;
61+ double top = GetSafeAreaForEdge ( GetSafeAreaRegionForEdge ( 1 , layout ) , baseSafeArea . Top , 1 , isKeyboardShowing , keyboardInsets ) ;
62+ double right = GetSafeAreaForEdge ( GetSafeAreaRegionForEdge ( 2 , layout ) , baseSafeArea . Right , 2 , isKeyboardShowing , keyboardInsets ) ;
63+ double bottom = GetSafeAreaForEdge ( GetSafeAreaRegionForEdge ( 3 , layout ) , baseSafeArea . Top , 3 , isKeyboardShowing , keyboardInsets ) ;
9264 }
9365
9466 var globalWindowInsetsListener = MauiWindowInsetListener . FindListenerForView ( view ) ;
0 commit comments