Problem description
A DashboardView disappears from a ScrollableView's page as soon as the page is out of cache.
Steps to reproduce
Follow these steps to reproduce:
Use the following code:
var win = Ti.UI.createWindow();
var pages = [];
var dashboardData = [];
for (var i=0; i<9; i++){
var item = Ti.UI.createDashboardItem({
image: 'appicon.png'
});
dashboardData.push(item);
}
var dashboard = Ti.UI.createDashboardView({
data: dashboardData,
wobble: true,
top: 100
});
for (var i=0; i<10; i++) {
pages[i] = Ti.UI.createView({
backgroundColor: '#fff'
});
pages[i].add(Ti.UI.createLabel({text: i}));
if (i === 0) {
pages[i].add(dashboard);
}
}
var scroll = Ti.UI.createScrollableView({
views: pages,
cacheSize: 3
});
win.add(scroll);
win.open();
1. Swipe 2 times to the right
2. Swipe 2 times to the left
Problem does not occur if cache size is increased to >= number of pages.
Recreating the entire DashboardView in a scroll or scrollend eventlistener seems to be the only way to work around the issue from JS side. See attached workaround.js
PR pending https://github.com/appcelerator/titanium_mobile/pull/4995
Verified as fixed, hence closing the issue. Verified on: Device : iPhone 5s , iOS version : 7.1.1 SDK: 3.3.0.v20140423155715 CLI version : 3.3.0-dev OS : MAC OSX 10.9.2 Alloy: 1.4.0-dev ACS: 1.0.14 npm:1.3.2 Appcelerator Studio, build: 3.3.0.201404211130 titanium-code-processor: 1.1.1-alpha XCode : 5.1.1