Titanium JIRA Archive
Appcelerator Community (AC)

[AC-793] In a scrollview, the scrollingEnabled property is causing a scrollToTop

GitHub Issuen/a
TypeBug
Priorityn/a
StatusClosed
ResolutionCannot Reproduce
Resolution Date2014-07-29T06:59:07.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsAlloy, Titanium SDK & CLI
Labels3.2.2.GA, alloy, ios
ReporterLucas Alves
AssigneeMauro Parra-Miranda
Created2014-04-21T17:35:16.000+0000
Updated2016-03-08T07:37:04.000+0000

Description

When using a scrollView, there is a case (the "y" event is negative) when setting scrollingEnabled to false causes the scrollView to scroll to top position (instead of just disabling the scroll and remaining on the current position). Test case: var scroll = Ti.UI.createScrollView({ height: Ti.UI.FILL, width: Ti.UI.FILL }); var view1 = Ti.UI.createView({ height: 2000, backgroundColor: 'black' }); scroll.add(view1); scroll.scrollTo(0,-50); // HAS TO BE A NEGATIVE VALUE !!! scroll.scrollingEnabled = false;

Comments

  1. Lucas Alves 2014-04-21

    Sorry, I just realized I opened this in the wrong place.
  2. Ritu Agrawal 2014-04-30

    Let us know if we should resolve it then.
  3. Lucas Alves 2014-05-01

    Yes, please. I just thought for a sec it should be in TIMOB.
  4. Ritu Agrawal 2014-05-04

    I ran your test with and without setting scrollingEnabled and the behavior is same i.e. it does not scroll to the top. Here is the updated test case that does not reproduce this issue.
       var win = Titanium.UI.createWindow();
       var scroll = Ti.UI.createScrollView(
       { height: Ti.UI.FILL, width: Ti.UI.FILL }
       );
       var view1 = Ti.UI.createView(
       { height: 500, backgroundColor: 'blue' }
       );
       scroll.add(view1);
       scroll.scrollTo(0,-50); // HAS TO BE A NEGATIVE VALUE !!!
       scroll.scrollingEnabled = false;
       win.add(view1);
       win.open();
       
  5. Lucas Alves 2014-05-05

    Ok, I reviewed my test case, turns out the problem only happens during a scroll event. Try this test case:
       var scroll = Ti.UI.createScrollView(
       { height: Ti.UI.FILL, width: Ti.UI.FILL }
       );
       var view1 = Ti.UI.createView(
       { height: 2500, backgroundColor: 'blue' }
       );
       scroll.add(view1);
       $.win.add(scroll);
       $.win.open();
       scroll.addEventListener('scroll', function(e) {
       	Ti.API.info(e.y);
       	if (e.y < -60) {
       		scroll.scrollingEnabled=false;
       	}
       });
       
    What you will see: When you scroll down to -60, the view1 (blue background) immediately scrolls back to the top. Whats is expected: view1 should be locked in place, only scrolling should be disabled.
  6. Ritu Agrawal 2014-06-12

    I still cannot reproduce this issue with the provided test. Can you please zip up your test project and attach it to this ticket?
  7. Mauro Parra-Miranda 2014-07-29

    Tried with the attached testcase without success.

JSON Source