Skip to content

Commit

Permalink
fix(collectionRepeat): ignore spacing of hidden elements (ion-refresher)
Browse files Browse the repository at this point in the history
Closes #1970
  • Loading branch information
ajoslin committed Aug 11, 2014
1 parent 044fac4 commit 9bfa3bd
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
3 changes: 3 additions & 0 deletions js/angular/directive/collectionRepeat.js
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,8 @@ function($collectionRepeatManager, $collectionDataSource, $parse) {
rerender(value);
});

// Find every sibling before and after the repeated items, and pass them
// to the dataSource
var scrollViewContent = scrollCtrl.scrollView.__content;
function rerender(value) {
var beforeSiblings = [];
Expand All @@ -226,6 +228,7 @@ function($collectionRepeatManager, $collectionDataSource, $parse) {
if ( ionic.DomUtil.elementIsDescendant($element[0], node, scrollViewContent) ) {
before = false;
} else {
if (node.hasAttribute('collection-repeat-ignore')) return;
var width = node.offsetWidth;
var height = node.offsetHeight;
if (width && height) {
Expand Down
2 changes: 1 addition & 1 deletion js/angular/directive/refresher.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ IonicModule
replace: true,
require: '^$ionicScroll',
template:
'<div class="scroll-refresher">' +
'<div class="scroll-refresher" collection-repeat-ignore>' +
'<div class="ionic-refresher-content" ' +
'ng-class="{\'ionic-refresher-with-text\': pullingText || refreshingText}">' +
'<div class="icon-pulling">' +
Expand Down
2 changes: 2 additions & 0 deletions test/html/list-fit.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ <h1 class="title">Hi</h1>
</a>
</ion-header-bar>
<ion-content>
<ion-refresher on-refresh="loadMore()"></ion-refresher>
<p>
Hi, I'm some text before the list.
</p>
Expand Down Expand Up @@ -61,6 +62,7 @@ <h2>{{item.text}}</h2>
var n = 1 + Math.floor(4*Math.random());
for (var i = 0; i < n; i++) addImage();
$scope.$broadcast('scroll.infiniteScrollComplete');
$scope.$broadcast('scroll.refreshComplete');
}, 1500);
};
}
Expand Down

0 comments on commit 9bfa3bd

Please sign in to comment.