Skip to content

Commit 79d7ff5

Browse files
committed
Add needsview to android to be consistent
1 parent d08495e commit 79d7ff5

File tree

3 files changed

+5
-1
lines changed

3 files changed

+5
-1
lines changed

VirtualListView/Platforms/Android/RvAdapter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public override void OnBindViewHolder(RecyclerView.ViewHolder holder, int positi
7575
_ => null
7676
};
7777

78-
if (itemHolder?.VirtualView is null)
78+
if (itemHolder.NeedsView)
7979
{
8080
var newView = positionalViewSelector?.ViewSelector?.CreateView(info, data);
8181
itemHolder.SetupView(newView);

VirtualListView/Platforms/Android/RvItemHolder.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ public RvItemHolder(IMauiContext mauiContext, ListOrientation orientation)
2323
public IView VirtualView
2424
=> ViewContainer?.VirtualView;
2525

26+
public bool NeedsView
27+
=> ViewContainer?.NeedsView ?? true;
2628

2729
public void SetupView(IView view)
2830
{

VirtualListView/Platforms/Android/RvViewContainer.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ public RvViewContainer(IMauiContext context)
1818

1919
public AView NativeView { get; private set; }
2020

21+
public bool NeedsView => VirtualView is null || VirtualView.Handler is null || NativeView is null;
22+
2123
public void UpdatePosition(IPositionInfo positionInfo)
2224
{
2325
if (VirtualView is IPositionInfo viewWithPositionInfo)

0 commit comments

Comments
 (0)