Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-5972

When the width of the ScrollableView is changed the current page of a ScrollableView is changed

    Details

      Description

      Problem

      When the width of the ScrollableView changes, the current page on the screen inexplicably jumps to 0, while the currentPage property itself remains whatever you set it to.
      This is visible if you press "scroll" and then the "resize" button.

      Reproducible steps:

      1. Run the code below
      2. Scroll to page 1 on the green square
      3. Press the scroll button
      4. Press the resize button

      notice that the current page is changed

      Expected behavior:

      Customer wants to keep the number of the current page after press the resize button.

      More details:

      Tested in a mobile device with Android, and worked well.

      Sample code:

      var win = Titanium.UI.createWindow({
       	backgroundColor : '#f0f0f0',
      	layout : 'vertical'
      });
       
      var views = [];
       
      for(var i = 0; i < 3; i++) {
      	views[i] = Ti.UI.createView();
      	views[i].add(Ti.UI.createLabel({
      		text : i,
      		width : 'auto',
      		height : 'auto'
      	}));
      }
       
      var parentView = Ti.UI.createView({
      	width : 100,
      	height : 100
      });
      var scrollableView = Ti.UI.createScrollableView({
      	borderColor : 'green',
      	borderWidth : 1,
      	views : views,
      	showPagingControls : true,
      	pagingControlHeight : 20,
      	currentPage : 2
      });
       
      var scrollButton = Ti.UI.createButton({
      	title : 'scroll',
      	width : 100,
      	height : 50
      });
      scrollButton.addEventListener('click', function() {
      	scrollableView.currentPage = 2;
      });
      var resizeButton = Ti.UI.createButton({
      	title : 'resize',
      	width : 100,
      	height : 50
      });
      resizeButton.addEventListener('click', function() {
      	parentView.width = 200;
      	Ti.API.info('currentPage: ' + scrollableView.currentPage + ' (supposedly...)');
      });
       
      parentView.add(scrollableView);
       
      win.add(parentView);
       
      win.add(scrollButton);
      win.add(resizeButton);
      win.open();
      
      

      Helpdesk

      APP-256873

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                srahim Sabil Rahim
                Reporter:
                framirez Francisco Antonio Duran Ramirez
              • Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Backbone Issue Sync

                  • Titanium SDK/CLI <> Titanium Mobile
                    Synced with:
                    TIMOB-5073
                    Sync status:
                    ERROR
                    Last received:
                    Last sent:

                    Git Source Code