Issue Description
This occurs on iPhone 6 ONLY scrollableView.currentPage initialized at index 3, displays index 1 (by setting its currentPage variable on creation).
Expected results: Item at index 3 is shown
Actual results: Item at index 1 is shown
To reproduce:
Unzip attachment into any Resources folder for a Classic Titanium project.
Run sample as iPhone6 and select red box
Watch the monitor logs.
Run sample as iPhone5/Android and select red box
Watch the monitor logs. The console displays the following:
On Android
11-25 14:27:29.563: I/TiAPI(1231): ScrollableView initialized at position: 3
11-25 14:27:30.573: I/TiAPI(1231): ScrollableViews current page after one second: 3
On iPhone5
[INFO] : Application started
[INFO] : ScrollableViewBugRepro/1.0 (3.4.1.5982e8f)
[INFO] : button pressed
[INFO] : ScrollableView initialized at position: 3
[INFO] : ScrollableViews current page after one second: 3
On iPhone6
[INFO] : Application started
[INFO] : ScrollableViewBugRepro/1.0 (3.4.1.5982e8f)
[INFO] : button pressed
[INFO] : ScrollableView initialized at position: 3
[INFO] : ScrollableViews current page after one second: 1
Additional information
If we do not put this.swiper (the scrollableView) into a container view, then the issue goes away only so long as its parent container has a 'vertical' layout (the parent container in the sample app is FirstView.js).
When this 'vertical' layout property is removed from FirstView, we see the issue return, but slightly differently -- the index gets set to 2, instead of 1 (when it is initialized as 3).
Unfortunately, we cannot use this as a workaround, as the view structure we need to build for the actual app needs the scrollableView to be in a container with other views, or to be set up without the vertical layout.
//AccountSwiper.js
return this.swiper; //<-- Uncomment to 'resolve' issue
return swiperContainerView;
Having trouble reproducing this issue. Below is a PR that may fix the issue, but I haven't been able to confirm. [~egomez][~rtlechuga], Please test this build and let me know if it fixes the issue or not: https://dl.dropboxusercontent.com/u/7540194/mobilesdk-3.5.0-osx.zip Thank you. Potential PRs: master: https://github.com/appcelerator/titanium_mobile/pull/6458 3_5_X: https://github.com/appcelerator/titanium_mobile/pull/6459
Thanks [~jalter] the fix looks good so far. Customer confirmed that fixes the issue.
PR's merged
Closing ticket as fixed. Verified "ScrollableViews current page after one second: 3" appears in Xcode console. Tested on: Appcelerator Studio, build: 3.4.1.201410281743 SDK build: 3.5.0.v20141210144440 CLI: 3.4.1 Alloy: 1.5.1 Xcode: 6.2 beta Devices: iphone 6 (8.1), iphone 5s (8.0.2)