Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-9869] iOS: ScrollableView event 'scroll' is fired multiple times

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionInvalid
Resolution Date2012-07-12T12:07:19.000+0000
Affected Version/sRelease 2.1.0
Fix Version/sn/a
ComponentsiOS
Labelsapi
ReporterDavide Cassenti
AssigneeNeeraj Gupta
Created2012-07-03T04:54:11.000+0000
Updated2017-03-24T18:08:53.000+0000

Description

Problem description

When scrolling from view to view in a ScrollableView, the 'scroll' event is called multiple times. This was working fine with previous versions of the SDK (e.g. 2.0.2.GA). This also causes the app to freeze sometimes.

Steps to reproduce

1. Create an app with the code below 2. Test the app on the iOS Simulator, using SDK 2.1.0.GA ~~~ var win = Ti.UI.createWindow(); var view1 = Ti.UI.createView({ backgroundColor:'#123' }); var view2 = Ti.UI.createView({ backgroundColor:'#246' }); var view3 = Ti.UI.createView({ backgroundColor:'#48b' }); scrollableView = Titanium.UI.createScrollableView({ views:[view1, view2, view3], showPagingControl:false, top:10, height: 400, }); scrollableView.addEventListener('scroll', function(e) { activeView = e.view; if (e.currentPage != null && e.currentPage != undefined && e.currentPage != 'undefined') { Ti.API.log ("scroll called - current index " + i); } }); win.add(scrollableView); win.open(); ~~~

Current result

When scrolling from a view to another, the scroll event is called more than once (see the console logs).

Expected result

The 'scroll' event is fired only once, when scrolling from a view to another. Testing the same code with SDK 2.0.2.GA works just fine.

Comments

  1. saikou baldé 2012-07-08

    thats maybe help you (this behavor is caused by New in Release 2.1.0.GA): ScrollableView scroll event enhancements. Prior to Release 2.1, the ScrollableView scroll event behavior was not consistent with the scroll event on other views. On Android, it fired when dragging ended, and on iOS it fired when the view finished scrolling. To be more consistent with other views, the scroll event was redefined to fire continuously while the view is scrolling. To obtain the previous behavior on Android, add a listener for the dragEnd event instead. To obtain the previous behavior on iOS, add a listener for the scrollEnd event instead.
  2. Neeraj Gupta 2012-07-12

    For consistency with Table and Scroll views, the act of scrolling continuously fires the 'scroll' event, and the act of stopping a scroll now fires the 'scrollEnd' event. Apps should have these event listeners updated to reflect the change.
  3. Lee Morris 2017-03-24

    Closing ticket as invalid.

JSON Source