[TIMOB-26295] Android: Listview with template causes a nullpointer on itemclick
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Critical |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2018-09-01T13:49:00.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Release 7.5.0 |
Components | Android |
Labels | android |
Reporter | Zaedy Dantas Sayão |
Assignee | Gary Mathews |
Created | 2018-08-13T17:47:30.000+0000 |
Updated | 2018-09-05T10:14:20.000+0000 |
Description
When you click on a listitem, using a Listview with template, it causes a nullpointer.
It happens when you try to manipulate the items of a section.
*Test case:*
*index.xml*
<Alloy>
<Window id="win">
<ListView id="listView" backgroundColor="#fff">
<Templates>
<ItemTemplate name="menuItem">
<View bindId="item" height="50" backgroundColor="#24292e" color="#fff" onClick="onMenuItemClick">
<Label bindId="name" color="#fff"></Label>
</View>
</ItemTemplate>
</Templates>
<ListSection />
</ListView>
</Window>
</Alloy>
-------------------
*index.js*
function onMenuItemClick(e) {
$.listView.sections[0].items = [];
}
var menuItems = [];
menuItems.push({
name: {
text: "A"
},
template: 'menuItem'
}, {
name: {
text: 'B'
},
template: 'menuItem'
}, {
name: {
text: "C"
},
template: 'menuItem'
}, {
name: {
text: "D"
},
template: 'menuItem'
});
$.listView.sections[0].items = menuItems;
$.win.open();
Attachments
File | Date | Size |
---|---|---|
Screen Shot 2018-08-13 at 14.45.32.png | 2018-08-13T17:45:51.000+0000 | 49254 |
I have a fix to the problem. I'll submit a PR after the issue has been moved to the correct project.
Hello, I have tested the issue and was able to reproduce it as described. I will forward this to our engineering. Please submit the PR. Thanks.
master: https://github.com/appcelerator/titanium_mobile/pull/10251
*Closing ticket.* A nullpoint error is no longer thrown when an item in the listView is clicked. The fix is present in SDK: {noformat} 7.5.0.v20180904155047 {noformat} *ENV* {noformat} Pixel 2 XL (9.0) Emulator (8.1, 7.1.1) Appc NPM: 4.2.13 Appc CLI: 7.0.6 Ti CLI: 5.1.1 Node: 8.9.4 NPM: 6.3.0 {noformat}