Skip to content

Commit a2526ea

Browse files
Fix modal page push in immersive mode
1 parent 3f99858 commit a2526ea

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/Controls/src/Core/Platform/ModalNavigationManager/ModalNavigationManager.Android.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,16 @@ Task PresentModal(Page modal, bool animated)
149149
NavAnimationInProgress = true;
150150
if (animated)
151151
{
152-
modalContainer.TranslationY = GetModalParentView().Height;
153-
modalContainer?.Animate()?.TranslationY(0)?.SetInterpolator(new DecelerateInterpolator(1))?.SetDuration(300)?.SetListener(new GenericAnimatorListener
152+
var translationValue = 0;
153+
var windowInsets = ViewCompat.GetRootWindowInsets(parentView);
154+
if (windowInsets is not null && !windowInsets.IsVisible(WindowInsetsCompat.Type.StatusBars()))
155+
{
156+
var statusBarHeight = _window.PlatformActivity.GetStatusBarHeight();
157+
translationValue -= statusBarHeight;
158+
}
159+
160+
modalContainer.TranslationY = parentView.Height;
161+
modalContainer?.Animate()?.TranslationY(translationValue)?.SetInterpolator(new DecelerateInterpolator(1))?.SetDuration(300)?.SetListener(new GenericAnimatorListener
154162
{
155163
OnEnd = a =>
156164
{

0 commit comments

Comments
 (0)