2013-06-13 35 views
0

我有一個fieldset與幾個文本字段和datepicker字段。Sencha觸摸日期選擇器和ios軟鍵盤

除了當文本字段處於焦點並且ios鍵盤處於視野中時,所有工作都可以正常工作。如果我單擊鍵盤頂部的下一個(或後退)按鈕,因此可以將其拖到日期選擇器中,而不是將日期選擇器停靠在屏幕底部,它會飛到中間的某個位置。我猜這是由於鍵盤推高了webview和日期選擇器仍然試圖停靠在屏幕上半部分的底部。

這發生在模擬器(見截圖)和我的設備上。

有沒有解決方法?我可以推遲日期選擇器彈出,直到鍵盤退出?

順便說一句,這也恰好與煎茶觸摸選擇字段

回答

1

您可以更新選擇器組件代碼:

觸摸/ src目錄/選擇器/ Date.js:

/** 
* Update by ZWD/gloot 
* Date: 7/30/2013 
*/ 
onDoneButtonTap: function() { 
    var me = this; 
    var oldValue = this._value, 
     newValue = this.getValue(true), 
     testValue = newValue; 

    if (Ext.isDate(newValue)) { 
     testValue = newValue.toDateString(); 
    } 
    if (Ext.isDate(oldValue)) { 
     oldValue = oldValue.toDateString(); 
    } 

    if (testValue != oldValue) { 
     this.fireEvent('change', this, newValue); 
    } 

    setTimeout(function() { 
     me.hide(); 
     me.inputBlocker.unblockInputs(); 
    }, 300); 

    Ext.hideKeyboard(); 
} 

和選擇器/ Picker.js

/** 
* @private 
* Called when the done button has been tapped. 
* Update by ZWD/gloot 
* Date: 7/30/2013 
*/ 
onDoneButtonTap: function() { 
    var me = this, oldValue = me._value, 
     newValue = me.getValue(true); 

    if (newValue != oldValue) { 
     me.fireEvent('change', me, newValue); 
    } 

    setTimeout(function() { 
     me.hide(); 
     me.inputBlocker.unblockInputs(); 
    }, 300); 

}, 

/** 
* @private 
* Called when the cancel button has been tapped. 
* Update by ZWD/gloot 
* Date: 7/30/2013 
*/ 
onCancelButtonTap: function() { 
    var me = this; 
    me.fireEvent('cancel', me); 

    setTimeout(function() { 
     me.hide(); 
     me.inputBlocker.unblockInputs(); 
    }, 300); 
} 

//////////////////////////////////////// //////////////

the setTimeout method can solve the question!