summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Platform.iOS
diff options
context:
space:
mode:
authorSamantha Houts <samantha@teamredwall.com>2016-08-02 14:48:25 -0700
committerRui Marinho <me@ruimarinho.net>2016-08-02 22:48:25 +0100
commitd5ad18b3e9947157ab073eb0e5c0a30e7f039c62 (patch)
tree39534e2b17e7100285fa0cba43fcd6c8057d710b /Xamarin.Forms.Platform.iOS
parentfd838d3d800ce9eca3f70f2d89d0bf10a59d9f5e (diff)
downloadxamarin-forms-d5ad18b3e9947157ab073eb0e5c0a30e7f039c62.tar.gz
xamarin-forms-d5ad18b3e9947157ab073eb0e5c0a30e7f039c62.tar.bz2
xamarin-forms-d5ad18b3e9947157ab073eb0e5c0a30e7f039c62.zip
[A, iOS] ListView Pull-To-Refresh indicator animates when navigating back to it (#274)
* Add repro for 33561 * [A] ListView refreshing on created shows indicator * [iOS] Refresh indicator restarts when appeared * Remove superfluous get
Diffstat (limited to 'Xamarin.Forms.Platform.iOS')
-rw-r--r--Xamarin.Forms.Platform.iOS/Renderers/ListViewRenderer.cs19
-rw-r--r--Xamarin.Forms.Platform.iOS/VisualElementRenderer.cs2
2 files changed, 18 insertions, 3 deletions
diff --git a/Xamarin.Forms.Platform.iOS/Renderers/ListViewRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/ListViewRenderer.cs
index 5483a169..7cd691f9 100644
--- a/Xamarin.Forms.Platform.iOS/Renderers/ListViewRenderer.cs
+++ b/Xamarin.Forms.Platform.iOS/Renderers/ListViewRenderer.cs
@@ -41,6 +41,7 @@ namespace Xamarin.Forms.Platform.iOS
FormsUITableViewController _tableViewController;
IListViewController Controller => Element;
ITemplatedItemsView<Cell> TemplatedItemsView => Element;
+ public override UIViewController ViewController => _tableViewController;
public override SizeRequest GetDesiredSize(double widthConstraint, double heightConstraint)
{
@@ -927,7 +928,7 @@ namespace Xamarin.Forms.Platform.iOS
ITemplatedItemsList<Cell> GetSectionList(int section)
{
- return (ITemplatedItemsList<Cell>)((IList)TemplatedItemsView.TemplatedItems) [section];
+ return (ITemplatedItemsList<Cell>)((IList)TemplatedItemsView.TemplatedItems)[section];
}
void OnSectionPropertyChanged(object sender, PropertyChangedEventArgs e)
@@ -1015,6 +1016,7 @@ namespace Xamarin.Forms.Platform.iOS
readonly ListView _list;
IListViewController Controller => _list;
UIRefreshControl _refresh;
+ bool _refreshingEventSent;
bool _refreshAdded;
@@ -1089,6 +1091,14 @@ namespace Xamarin.Forms.Platform.iOS
public override void ViewWillAppear(bool animated)
{
+ base.ViewWillAppear(animated);
+
+ if (_list.IsRefreshing && _refresh.Refreshing)
+ {
+ // Restart the refreshing to get the animation to trigger
+ UpdateIsRefreshing(false);
+ UpdateIsRefreshing(true);
+ }
}
protected override void Dispose(bool disposing)
@@ -1114,8 +1124,13 @@ namespace Xamarin.Forms.Platform.iOS
void OnRefreshingChanged(object sender, EventArgs eventArgs)
{
- if (_refresh.Refreshing)
+ if (_refresh.Refreshing && !_refreshingEventSent)
+ {
Controller.SendRefreshing();
+ _refreshingEventSent = true;
+ }
+ else if (!_refresh.Refreshing)
+ _refreshingEventSent = false;
}
void RemoveRefresh()
diff --git a/Xamarin.Forms.Platform.iOS/VisualElementRenderer.cs b/Xamarin.Forms.Platform.iOS/VisualElementRenderer.cs
index 68ae10bb..ab212b21 100644
--- a/Xamarin.Forms.Platform.iOS/VisualElementRenderer.cs
+++ b/Xamarin.Forms.Platform.iOS/VisualElementRenderer.cs
@@ -121,7 +121,7 @@ namespace Xamarin.Forms.Platform.iOS
Layout.LayoutChildIntoBoundingRegion(Element, new Rectangle(Element.X, Element.Y, size.Width, size.Height));
}
- public UIViewController ViewController
+ public virtual UIViewController ViewController
{
get { return null; }
}