Uploaded image for project: 'Appcelerator - INBOX'
  1. Appcelerator - INBOX
  2. AC-6646

[Android] Scrollable View `currentPage` Property Not Updated After Being Assigned

    Details

    • Type: Bug
    • Status: Open
    • Resolution: Unresolved
    • Affects Version/s: None
    • Component/s: Titanium SDK & CLI
    • Labels:
    • Environment:

      Titanium SDK: 9.3.0.GA (macOS version)
      Platform: Android

      Description

      If `currentPage` property of scrollable view is assigned in the code, the value doesn't seem to get updated immediately on Android. This issue can be reproduced by creating a new project with the following sample code, building the project with Titanium SDK 9.3.0.GA, and running the app on an Android device:

      var win = Ti.UI.createWindow();
       
      var v0 = Ti.UI.createView({
          backgroundColor: 'red'
      });
      v0.add(Ti.UI.createLabel({
          color: 'white',
          text: 'Page index = 0'
      }));
       
      var v1 = Ti.UI.createView({
          backgroundColor: 'blue'
      });
      v1.add(Ti.UI.createLabel({
          color: 'white',
          text: 'Page index = 1'
      }));
       
      var v2 = Ti.UI.createView({
          backgroundColor: 'green'
      });
      v2.add(Ti.UI.createLabel({
          color: 'white',
          text: 'Page index = 2'
      }));
       
      var scrollableView = Ti.UI.createScrollableView({
          views: [v0, v1, v2],
          height: Ti.UI.FILL,
          width: Ti.UI.FILL
      });
      win.add(scrollableView);
       
      // Note that `currentPage` property of scrollable view is assigned here
      scrollableView.currentPage = 1;
       
      Ti.API.info('`currentPage` property of scrollable view is: ' + scrollableView.currentPage);
       
      win.open();
      

      What I observed in the console was a message saying "[INFO] `currentPage` property of scrollable view is: 0", but `currentPage` should have been updated to 1 already.

      FYI, when I run the above sample code on an iOS device, the console output would be "[INFO] `currentPage` property of scrollable view is: 1" instead, which was the expected behaviour.

        Attachments

          Activity

            People

            • Assignee:
              amukherjee Abir Mukherjee
              Reporter:
              mwenli Ma Wenli
            • Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:

                Git Integration