Skip to content

Commit f33967c

Browse files
committed
amend(collectionRepeat): resize if width or height changes
1 parent 4de112a commit f33967c

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

js/angular/directive/collectionRepeat.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -187,16 +187,19 @@ function CollectionRepeatDirective($ionicCollectionManager, $parse, $window, $$r
187187
dataLength: 0,
188188
width: 0,
189189
height: 0,
190+
// A resize triggers a refresh only if we have data, the scrollView has size,
191+
// and the size has changed.
190192
resizeRequiresRefresh: function(newWidth, newHeight) {
191-
var requiresRefresh = self.dataLength &&
192-
newWidth && newWidth !== self.width &&
193-
newHeight && newHeight !== self.height;
193+
var requiresRefresh = self.dataLength && newWidth && newHeight &&
194+
(newWidth !== self.width || newHeight !== self.height);
194195

195196
self.width = newWidth;
196197
self.height = newHeight;
197198

198199
return !!requiresRefresh;
199200
},
201+
// A change in data only triggers a refresh if the data has length, or if the data's
202+
// length is less than before.
200203
dataChangeRequiresRefresh: function(newData) {
201204
var requiresRefresh = newData.length > 0 || newData.length < self.dataLength;
202205

0 commit comments

Comments
 (0)