Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions iphone/Classes/TiUIListView.m
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ @interface TiUIListView ()
@property (nonatomic, readonly) TiUIListViewProxy *listViewProxy;
@property (nonatomic, copy, readwrite) NSString *searchString;
@property (nonatomic, copy, readwrite) NSString *searchedString;
@property (nonatomic, assign) CGFloat lastContentOffset;
@end

static TiViewProxy *FindViewProxyWithBindIdContainingPoint(UIView *view, CGPoint point);
Expand Down Expand Up @@ -2011,6 +2012,15 @@ - (void)scrollViewDidScroll:(UIScrollView *)scrollView
TiUIListSectionProxy *section;
CGFloat topSpacing = scrollView.contentOffset.y + scrollView.adjustedContentInset.top;

NSString *direction = [NSNull null];

if (self.lastContentOffset > scrollView.contentOffset.y) {
direction = @"down";
} else if (self.lastContentOffset < scrollView.contentOffset.y) {
direction = @"up";
}
self.lastContentOffset = scrollView.contentOffset.y;

if ([indexPaths count] > 0) {
NSIndexPath *indexPath = [self pathForSearchPath:[indexPaths objectAtIndex:0]];
NSUInteger visibleItemCount = [indexPaths count];
Expand All @@ -2022,6 +2032,7 @@ - (void)scrollViewDidScroll:(UIScrollView *)scrollView
[eventArgs setValue:section forKey:@"firstVisibleSection"];
[eventArgs setValue:[section itemAtIndex:[indexPath row]] forKey:@"firstVisibleItem"];
[eventArgs setValue:NUMINTEGER(topSpacing) forKey:@"top"];
[eventArgs setValue:direction forKey:@"direction"];

if (lastVisibleItem != [indexPath row] || lastVisibleSection != [indexPath section] || forceUpdates) {
// only log if the item changes or forced
Expand All @@ -2038,6 +2049,7 @@ - (void)scrollViewDidScroll:(UIScrollView *)scrollView
[eventArgs setValue:section forKey:@"firstVisibleSection"];
[eventArgs setValue:NUMINTEGER(-1) forKey:@"firstVisibleItem"];
[eventArgs setValue:NUMINTEGER(topSpacing) forKey:@"top"];
[eventArgs setValue:direction forKey:@"direction"];
}
});
}
Expand Down
Loading