From a2526ea2fb86624f1739caafe7acb37c27e6d671 Mon Sep 17 00:00:00 2001 From: PavloLukianets <109070173+PavloLukianets@users.noreply.github.com> Date: Mon, 15 Jan 2024 16:47:25 +0200 Subject: [PATCH] Fix modal page push in immersive mode --- .../ModalNavigationManager.Android.cs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/Controls/src/Core/Platform/ModalNavigationManager/ModalNavigationManager.Android.cs b/src/Controls/src/Core/Platform/ModalNavigationManager/ModalNavigationManager.Android.cs index 7b29d8f61c54..2988bed4fa95 100644 --- a/src/Controls/src/Core/Platform/ModalNavigationManager/ModalNavigationManager.Android.cs +++ b/src/Controls/src/Core/Platform/ModalNavigationManager/ModalNavigationManager.Android.cs @@ -149,8 +149,16 @@ Task PresentModal(Page modal, bool animated) NavAnimationInProgress = true; if (animated) { - modalContainer.TranslationY = GetModalParentView().Height; - modalContainer?.Animate()?.TranslationY(0)?.SetInterpolator(new DecelerateInterpolator(1))?.SetDuration(300)?.SetListener(new GenericAnimatorListener + var translationValue = 0; + var windowInsets = ViewCompat.GetRootWindowInsets(parentView); + if (windowInsets is not null && !windowInsets.IsVisible(WindowInsetsCompat.Type.StatusBars())) + { + var statusBarHeight = _window.PlatformActivity.GetStatusBarHeight(); + translationValue -= statusBarHeight; + } + + modalContainer.TranslationY = parentView.Height; + modalContainer?.Animate()?.TranslationY(translationValue)?.SetInterpolator(new DecelerateInterpolator(1))?.SetDuration(300)?.SetListener(new GenericAnimatorListener { OnEnd = a => {