Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Android] Fix bidirectional scrolling on Android #13623

Merged
merged 3 commits into from
Mar 8, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions src/Core/src/Platform/Android/MauiScrollView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -187,9 +187,14 @@ protected override void OnLayout(bool changed, int left, int top, int right, int
{
base.OnLayout(changed, left, top, right, bottom);

if (_hScrollView != null && _hScrollView.Parent == this)
if (_hScrollView != null && _hScrollView.Parent == this && _content != null)
rmarinho marked this conversation as resolved.
Show resolved Hide resolved
{
_hScrollView.Layout(0, 0, right - left, bottom - top);
double scrollViewContentHeight = _content.Height;
var hScrollViewHeight = bottom - top;
//if we are scrolling both ways we need to layout our MauiHorizontalScrollView with more than the available height
jfversluis marked this conversation as resolved.
Show resolved Hide resolved
//so it's parent the NestedScrollView can scroll vertically
jfversluis marked this conversation as resolved.
Show resolved Hide resolved
var newBottom = _isBidirectional ? Math.Max(hScrollViewHeight, scrollViewContentHeight) : hScrollViewHeight;
_hScrollView.Layout(0, 0, right - left, (int)newBottom);
}

if (CrossPlatformArrange == null)
Expand Down