mirror of
https://github.com/bitwarden/mobile
synced 2025-12-31 23:53:25 +00:00
redraw stack layouts on ios tableviews
This commit is contained in:
@@ -1,6 +1,4 @@
|
||||
using Xamarin.Forms;
|
||||
using XLabs.Ioc;
|
||||
using Bit.App.Abstractions;
|
||||
using System;
|
||||
using System.Reflection;
|
||||
|
||||
@@ -42,6 +40,7 @@ namespace Bit.App.Controls
|
||||
public bool NoHeader { get; set; }
|
||||
public bool NoFooter { get; set; }
|
||||
public int BottomPadding { get; set; }
|
||||
public Func<RedrawableStackLayout> WrappingStackLayout { get; set; }
|
||||
|
||||
protected override SizeRequest OnSizeRequest(double widthConstraint, double heightConstraint)
|
||||
{
|
||||
|
||||
27
src/App/Controls/RedrawableStackLayout.cs
Normal file
27
src/App/Controls/RedrawableStackLayout.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Xamarin.Forms;
|
||||
|
||||
namespace Bit.App.Controls
|
||||
{
|
||||
public class RedrawableStackLayout : StackLayout
|
||||
{
|
||||
private DateTime _lastRedraw = DateTime.MinValue;
|
||||
private TimeSpan _redrawThreshold = TimeSpan.FromMilliseconds(1000);
|
||||
|
||||
public async Task RedrawIfNeededAsync(int delay = 0, bool force = false)
|
||||
{
|
||||
var now = DateTime.UtcNow;
|
||||
if(Device.RuntimePlatform == Device.iOS && (force || (now - _lastRedraw) > _redrawThreshold))
|
||||
{
|
||||
_lastRedraw = now;
|
||||
if(delay > 0)
|
||||
{
|
||||
await Task.Delay(delay);
|
||||
}
|
||||
|
||||
InvalidateLayout();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user