Skip to content

Commit

Permalink
Hook up horizontal scroll events on Android
Browse files Browse the repository at this point in the history
Fixes #5090
  • Loading branch information
hartez committed Jun 14, 2022
1 parent 8604b3c commit 3630a94
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/Core/src/Platform/Android/MauiScrollView.cs
Expand Up @@ -10,7 +10,7 @@

namespace Microsoft.Maui.Platform
{
public class MauiScrollView : NestedScrollView, IScrollBarView
public class MauiScrollView : NestedScrollView, IScrollBarView, NestedScrollView.IOnScrollChangeListener
{
View? _content;

Expand Down Expand Up @@ -277,6 +277,11 @@ void SmoothScrollTo(int x, int y, Action finished)
animator.Start();
}

void IOnScrollChangeListener.OnScrollChange(NestedScrollView v, int scrollX, int scrollY, int oldScrollX, int oldScrollY)
{
OnScrollChanged(scrollX, scrollY, oldScrollX, oldScrollY);
}

internal Func<Graphics.Rect, Graphics.Size>? CrossPlatformArrange { get; set; }
}

Expand Down Expand Up @@ -396,6 +401,16 @@ void IScrollBarView.AwakenScrollBars()
}

bool IScrollBarView.ScrollBarsInitialized { get; set; } = false;

protected override void OnScrollChanged(int l, int t, int oldl, int oldt)
{
base.OnScrollChanged(l, t, oldl, oldt);

if (_parentScrollView is NestedScrollView.IOnScrollChangeListener scrollChangeListener)
{
scrollChangeListener.OnScrollChange(_parentScrollView, l, t, oldl, oldt);
}
}
}

internal interface IScrollBarView
Expand Down

0 comments on commit 3630a94

Please sign in to comment.