Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-19972] iOS: Peek&Pop only works on first elements of Ti.UI.ListView

GitHub Issuen/a
TypeBug
PriorityCritical
StatusClosed
ResolutionFixed
Resolution Date2015-11-16T18:37:27.000+0000
Affected Version/sRelease 5.1.0
Fix Version/sRelease 5.1.0, Release 5.2.0
ComponentsiOS
Labels3dtouch, iOS, peek&pop, preview, previewcontext
ReporterJan van Kampen
AssigneeHans Knöchel
Created2015-11-02T12:54:13.000+0000
Updated2015-11-17T21:03:30.000+0000

Description

Preview context only shows up on the top of the tableview. If you have 100 rows, and you scroll down to row ~30, you can't force touch anymore. If you move back to the top, row 1, everything works fine.

Comments

  1. Aminul Islam 2015-11-05

    Hi , Could we get a reproducible test case? Thanks
  2. Jan van Kampen 2015-11-13

       var actions = [];
       var win = Ti.UI.createWindow({
           backgroundColor: "white"
       });
        
       // The view to be previewed while popping.
       var previewView = Ti.UI.createView({
           backgroundColor: "blue"
       });
        
       // The window to be opened after popping the preview.
       var detailWindow = Ti.UI.createWindow({
           backgroundColor: "yellow"
       });
        
       detailWindow.add(Ti.UI.createLabel({
           text: "You made it!"
       }));
        
       // The actions to be added to the preview context.
       var action = Ti.UI.iOS.createPreviewAction({
           title: "Preview Action",
           style: Ti.UI.iOS.PREVIEW_ACTION_STYLE_DEFAULT
       });
        
       action.addEventListener("click", function(e) {
         Ti.API.warn(e);
           alert(
               "Title: " + e.title +
               "\nStyle: " + e.style +
               "\nIndex: " + e.index +
               "\nSectionIndex: " + e.sectionIndex +
               "\nItemIndex: " + e.itemIndex
           );
       });
        
       actions.push(action);
        
       // Create the preview context
       var context = Ti.UI.iOS.createPreviewContext({
           preview: previewView,
           actions: actions, // Can have both Ti.UI.iOS.PreviewAction + Ti.UI.iOS.PreviewActionGroup
           contentHeight: 300 // When unspecified, we use the available height
       });
        
       context.addEventListener("peek", function(e) {
         Ti.API.warn("Peek");
         Ti.API.warn(e);
       });
        
       context.addEventListener("pop", function(e) {
         Ti.API.warn("Pop");
         Ti.API.warn(e);
       });
        
       // Assign the preview context
       var listView = Ti.UI.createListView({
           previewContext: context, // Will be ignored on unsupported devices
       });
        
       var sections = [];
        
       for(var i = 1; i <= 2; i++) {
         var items = [];
         var section = Ti.UI.createListSection({
             headerTitle: "Section " + i
         });
         for(var j = 1; j <= 30; j++) {
             items.push({
                 properties: {
                     itemId: "test" + i + j,
                     title: "Cell #" + j
                 }
             });
         }
         section.setItems(items);
         sections.push(section);
       }
       listView.setSections(sections);
        
       win.add(listView);
       win.open();
       
  3. Jan van Kampen 2015-11-13

    Please try it. When you scroll, you can't use peek anymore. But when it works, you get wrong data from de function onPeek.
  4. Hans Knöchel 2015-11-13

    This is a valid issue, I'm on it.
  5. Hans Knöchel 2015-11-13

    PR (master): https://github.com/appcelerator/titanium_mobile/pull/7441 PR (5_1_X): https://github.com/appcelerator/titanium_mobile/pull/7442 [~janvankampen] Please try this version as well.
  6. Harry Bryant 2015-11-17

    Verified as fixed, Peek & Pop features now work on elements after scrolling. Also checked that the itemIndex for each cell returns the appropriate value. iPhone 6S Plus (9.1) Mac OSX El Capitan 10.11 (15A284) Ti SDK: 5.1.0.v20151116164430 Appc Studio: 4.4.0.201511130407 Appc NPM: 4.2.1.GA Appc CLI: 5.1.0-60 Ti CLI: 5.0.5 Alloy: 1.7.26 Xcode 7.1(7B91b) Node v0.12.7 production *Closing ticket.*

JSON Source