Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-2977] Shake gesture not recognized after searchBar blur

GitHub Issuen/a
TypeBug
PriorityLow
StatusClosed
ResolutionInvalid
Resolution Date2017-06-07T18:05:52.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsiOS
Labelsdefect, ios, reported-1.5.1, reported-1.6.0
ReporterPaul Dowsett
AssigneeIngo Muschenetz
Created2011-04-15T03:34:02.000+0000
Updated2017-06-07T18:05:52.000+0000

Description

Tested in simulator by user: iOS 4.2, Ti SDK 1.5.1 & 1.6.X (continuous)
Tested on device by rickblalock: iOS 4.2, 1.6.X (continuous 27 Jan 2011)

User reported issue in http://developer.appcelerator.com/question/104541/problem--titaniumgesture--shake-disable-after-keyboard-blur#184601"> this Q&A post. He explains:

Tested in simulator:

  • Hardware menu > shake Gesture - alert displayed
  • Click on searchBar field > keyboard displayed > Hardware menu > shake Gesture - alert displayed
  • Write text in field > Hardware menu > shake Gesture - alert displayed
  • Click on "search button" > keyboard id hidden - alert not displayed
var win = Ti.UI.currentWindow; 
win.backgroundColor = '#fff';
 
Ti.Gesture.addEventListener('shake',function(e)
{
    alert(e.source+" "+e.timestamp+" "+e.type);
});

var serSearch = Titanium.UI.createSearchBar({
    barColor:'#444', 
    showCancel:false,
    height:60,
    top:0,
    left:0,
    keyboardType:0
});
 
serSearch.addEventListener("return", function(e)
{
    serSearch.blur();
});

win.add(serSearch);

blainH stated:

The shake gesture is trapped at the root, when it's the firstResponder.
While text entry is up, it's not the first responder.
So I can see why the bug's doing what it's doing.
Can fix, but not for 1.6
Actually, possibly not possible to fix. I'd have to look into it.

Comments

  1. yann Offredi 2011-04-15

    I have been using this for solved my problem :

       var timestampAccTmp = 0;
       var timeResolution = 200;
       Ti.Accelerometer.addEventListener('update',function(e)
       {
           timestampAcc = e.timestamp;
           diffTime = timestampAcc - timestampAccTmp;
           //alert(e.x+" "+e.y+" "+e.z+" "+timestampAcc+" "+timestampAccTmp+" "+diffTime);
           
           
           if(diffTime > timeResolution)
           {
               xpos.text = "XX :"+e.x;
               ypos.text = "YX :"+e.y;
               zpos.text = "ZX :"+e.z;
               violence = 1;
               shake = false;
               
               xtop = Math.abs(e.x);
               ytop = Math.abs(e.y);
               ztop = Math.abs(e.z);
               
               Titanium.API.debug(xtop+" "+ytop+" "+ztop);
               
               if ( xtop> violence * 1)
               {
                   shake = true;
               }
               if (ytop > violence * 2)
               {
                   shake = true;
               }
               if (ztop > violence * 3)
               {
                   shake = true;
               }
               if (shake) 
               {
                   alert("shake detected "+xtop+" "+ytop+" "+ztop);
               } 
               timestampAccTmp = timestampAcc;
           }
           
           
       });
       

    thanks

  2. Lee Morris 2017-06-07

    Closing ticket due to time passed.

JSON Source