Hybrid View
-
11 Feb 2012 8:24 AM #1
TextArea scroll on iOS not working
TextArea scroll on iOS not working
On any iOs device, when text area is used there is not way to scroll it...
In Sencha Touch 1 this was posted as a fix:
Can this be adopted for Touch 2?Code:// overrides a class and preserves overridden functions in a new property of the prototype, 'original' Ext.overrideOriginal = function(obj, overrides) { var original = {}; for(prop in overrides) if(overrides.hasOwnProperty(prop) && Ext.isFunction(obj.prototype[prop])) original[prop] = obj.prototype[prop]; Ext.override(obj, Ext.applyIf(overrides, { original: original })); }; Ext.overrideOriginal(Ext.form.TextArea, !Ext.is.iOS ? {} : { lastY: undefined, handleTouch: function(e) { this.lastY = e.pageY; }, handleMove: function(e) { var textArea = e.target; var top = textArea.scrollTop <= 0; var bottom = textArea.scrollTop + textArea.clientHeight >= textArea.scrollHeight; var up = e.pageY > this.lastY; var down = e.pageY < this.lastY; this.lastY = e.pageY; // default (mobile safari) action when dragging past the top or bottom of a scrollable // textarea is to scroll the containing div, so prevent that. if((top && up) || (bottom && down)) e.preventDefault(); // Sencha disables textarea scrolling on iOS by default, // so stop propagating the event to delegate to iOS. if(!(top && bottom)) e.stopPropagation(); }, initEvents: function() { var textArea = this.fieldEl.dom; // have to add these events directly to the DOM textarea (as opposed to this.fieldEl.on), // otherwise they're handled after Ext.gesture.Manager and preventDefault will already have been called. textArea.addEventListener( Ext.supports.Touch ? 'touchstart' : 'mousedown', Ext.createDelegate(this.handleTouch, this), false); textArea.addEventListener( Ext.supports.Touch ? 'touchmove' : 'mousemove', Ext.createDelegate(this.handleMove, this), false); this.original.initEvents.apply(this, arguments); }, });
Thanks.
-
11 Feb 2012 11:32 AM #2Sencha - Sencha Touch Dev Team
- Join Date
- Mar 2007
- Location
- Redwood City, California
- Posts
- 3,653
- Vote Rating
- 14
We will review it and report back.
-
11 Feb 2012 11:36 AM #3Sencha - Sencha Touch Dev Team
- Join Date
- Jul 2009
- Location
- Palo Alto, California
- Posts
- 469
- Vote Rating
- 9
We will be putting this in the library, but it will be after 2.0.0 release
Sencha Touch Lead Architect
-
11 Feb 2012 12:27 PM #4
Any way there could be a temp fix for this, based on the code above?
-
20 Apr 2012 5:31 AM #5
Any ideas when a fix for this will be added to the library?
The inability to scroll is the only negative feedback we're getting for our Touch application - the fix posted below for Touch 1 doesn't appear to work anymore (possibly due to iOS 5+ changing the gesture for scrolling textareas?).
We'd like to upgrade to Touch 2 but don't want to spend the effort just yet if we're going to be left with this problem.
Thanks
-
22 Apr 2012 11:21 PM #6
Just tried the sample code on iOS 5 and ST 1.x. It works great.
Thank you
You found a bug! We've classified it as
TOUCH-1941
.
We encourage you to continue the discussion and to find an acceptable workaround while we work on a permanent fix.


Reply With Quote