diff --git a/apidoc/Titanium/UI/ListView.yml b/apidoc/Titanium/UI/ListView.yml index 9d266002818..6bfb33d7024 100644 --- a/apidoc/Titanium/UI/ListView.yml +++ b/apidoc/Titanium/UI/ListView.yml @@ -387,9 +387,22 @@ events: - name: movestart summary: Fired when a list row has started moving. description: | - This property can be used to change the UI once a new drag-and-drop interaction starts. + This event can be used to change the UI once a new drag-and-drop interaction starts. + The event properties are available in Titanium SDK 12.0.0+ since: "11.1.0" platforms: [android, iphone, ipad, macos] + properties: + - name: section + summary: List section from which the item is moved. + type: Titanium.UI.ListSection + + - name: sectionIndex + summary: section index of the reference item. + type: Number + + - name: itemIndex + summary: section item index of the reference item. + type: Number - name: moveend summary: Fired when a list row has ended moving. diff --git a/iphone/Classes/TiUIListView.m b/iphone/Classes/TiUIListView.m index d45631ecdaa..5304d62d86b 100644 --- a/iphone/Classes/TiUIListView.m +++ b/iphone/Classes/TiUIListView.m @@ -1108,7 +1108,21 @@ - (BOOL)canMoveRowAtIndexPath:(NSIndexPath *)indexPath UIDragItem *dragItem = [[UIDragItem alloc] initWithItemProvider:itemProvider]; dragItem.localObject = identifier; - [[self proxy] fireEvent:@"movestart"]; + // Fire an event to react to the move start + NSIndexPath *realIndexPath = [self pathForSearchPath:indexPath]; + TiUIListSectionProxy *theSection = [[self.listViewProxy sectionForIndex:realIndexPath.section] retain]; + NSDictionary *theItem = [[theSection itemAtIndex:realIndexPath.row] retain]; + NSMutableDictionary *eventObject = [[NSMutableDictionary alloc] initWithObjectsAndKeys: + theSection, @"section", + NUMINTEGER(realIndexPath.section), @"sectionIndex", + NUMINTEGER(realIndexPath.row), @"itemIndex", + nil]; + + [[self proxy] fireEvent:@"movestart" withObject:eventObject]; + + [eventObject release]; + [theItem release]; + [theSection release]; return @[ dragItem ]; }