Skip to content

Commit 68b8eea

Browse files
authored
re-apply soft-input mode state after replacing Window.Page on Android (#3386)
1 parent ed5b228 commit 68b8eea

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/Maui/Prism.Maui/Navigation/PageNavigationService.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1181,7 +1181,23 @@ protected virtual async Task DoPush(Page currentPage, Page page, bool? useModalN
11811181
}
11821182
else
11831183
{
1184+
#if ANDROID
1185+
// Preserve Android SoftInputMode across root page replacement (Issue #3298)
1186+
Android.Views.SoftInput? softInputMode = null;
1187+
if (Window?.Handler?.PlatformView is Android.App.Activity activity)
1188+
{
1189+
softInputMode = activity.Window?.Attributes?.SoftInputMode;
1190+
}
1191+
#endif
1192+
11841193
Window.Page = page;
1194+
1195+
#if ANDROID
1196+
if (softInputMode.HasValue && Window?.Handler?.PlatformView is Android.App.Activity restoredActivity)
1197+
{
1198+
restoredActivity.Window?.SetSoftInputMode(softInputMode.Value);
1199+
}
1200+
#endif
11851201
}
11861202
}
11871203
else

0 commit comments

Comments
 (0)