[TIMOB-28337] Android: ListView properties missing in "longpress" event in Alloy as of 9.3.0
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | High |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2021-02-10T16:35:29.000+0000 |
Affected Version/s | Release 9.3.1, Release 10.0.0 |
Fix Version/s | Release 9.3.2 |
Components | Android |
Labels | listview, longpress, regression |
Reporter | Hans Knöchel |
Assignee | Gary Mathews |
Created | 2021-02-05T20:42:00.000+0000 |
Updated | 2021-02-12T08:48:30.000+0000 |
Description
When using the "longpress" event on the Android ListView in 9.3.0+, the itemIndex / sectionIndex are not supplied via the event when the longpress occured on a child view of the list item template. I don't have an isolated test case so far, but it should be reproducible on any custom-templates test case that adds the "longpress" event to the view wrapper.
The same used to work on both iOS and Android. What I can share immediately is the Alloy sample:
<Alloy>
<ListView id="listView" defaultItemTemplate="MyCell">
<Templates>
<ItemTemplate name="MyCell">
<View height="43" onLongpress="onLongPress">
<ImageView bindId="image" />
<Label bindId="titleLabel" />
</View>
</ItemTemplate>
</Templates>
</ListView>
</Alloy>
Important to note is that the longpress event is added to the item template, not the list view itself as this used to be the only way to handle this. If there are better ways, let me know!
*EDIT*: Just checked it: The longpress event does not work on the ListView at all (like the itemclick and others), so the above is the only feasible workaround thats now also broken :(
Thanks for looking into this Gary :) Many thanks for this amazing work!
[~hknoechel] I'm having trouble reproducing this in JS, adding an event listener to a child label will inherit
sectionIndex
anditemIndex
etc.. correctly.I'll look into what Alloy is doing, as it may not be making use of the
events
property in the template.master: https://github.com/appcelerator/titanium_mobile/pull/12456
FR Passed. Waiting for jenkins.
This was also reported in TIMOB-28291.
Thanks Rodrigo! I believe now it's fully fixed. You can try the latest 9.3.2 version (ti sdk install -b 9_3_X)!