New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[TIMOB-17572] iOS: Fix activity indicator animation in list items #9716
Conversation
Generated by 🚫 dangerJS |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CR passed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FR Passed: Activity indicator no longer freezes when updating list.
Test steps:
- Built a new SDK from https://jenkins.appcelerator.org/job/titanium-sdk/job/titanium_mobile/job/PR-9716/2/artifact/dist/mobilesdk-7.1.0.v20180114192248-osx.zip
- Created a new titanium project
- Added the test case mentioned in https://jira.appcelerator.org/browse/TIMOB-17572
var win = Ti.UI.createWindow({
backgroundColor: 'white'
});
var listTemplate = {
childTemplates: [{
type: 'Ti.UI.Label',
bindId: 'info',
properties: {
color: 'black',
font: {
fontFamily: 'Arial',
fontSize: '20dp',
fontWeight: 'bold'
},
left: '60dp',
top: 0,
}
}]
};
var loadTemplate = {
childTemplates: [{
type: 'Ti.UI.ActivityIndicator',
bindId: 'ai',
properties: {
left: 12,
font: {
fontSize: 16,
fontFamily: 'Helvetica',
fontWeight: 'bold',
},
color: "black",
style: Ti.UI.ActivityIndicatorStyle.DARK,
height: 55,
visible: true
}
}]
};
var list = Ti.UI.createListView({
templates: {
'item': listTemplate,
'load': loadTemplate
},
});
var sections = [];
var fruitSection = Ti.UI.createListSection({
headerTitle: 'Fruits / Frutas'
});
var fruitDataSet = [{
template: 'item',
info: {
text: 'Apple'
}
},
{
template: 'item',
info: {
text: 'Banana'
}
}
];
fruitSection.setItems(fruitDataSet);
sections.push(fruitSection);
list.setSections(sections);
var iterations = 1;
var createListDataItems = function() {
var items = fruitDataSet;
fruitDataSet.pop();
for (var i = 1; i <= 2; i++) {
items.push({
template: 'item',
info: {
text: 'added ' + iterations + i
}
});
}
iterations++;
return items;
};
var createLoadingTransactionsListItem = function() {
var items = fruitDataSet;
items.push({
template: 'load',
ai: {
message: ' Loading...'
}
});
return items;
};
var loadMore = function() {
// show loading message
fruitSection.setItems(createLoadingTransactionsListItem());
setTimeout(function() {
// append more items
fruitSection.setItems(createListDataItems());
list.setMarker({
sectionIndex: 0,
itemIndex: fruitSection.items.length - 2
});
}, 2000);
};
list.addEventListener('marker', loadMore);
setTimeout(loadMore, 0);
win.add(list);
win.open();
- Ran the program
- Saw the Activity indicator spinning
- Refreshed the list to add more items
- Saw that the activity indicator was still spinning
Test Environment
Appcelerator Command-Line Interface, version 7.0.1
iphone 6+ (10.2)
Operating System Name: Mac OS High Sierra
Operating System Version: 10.13
Node.js Version: 8.9.1
Xcode: 9.2
Appcelerator Studio: 5.0.0.201712081732
JIRA: https://jira.appcelerator.org/browse/TIMOB-17572