TextInput in iOS gains then immediately loses focus won't open softkeyboard. FocusManager says still
Dev Environment: Flash Builder 4.7<br/>
SDK: Flex 4.6.0 (build 23201) AIR 3.5<br/>
Arguments: -local en_US -swf-version=16<br/>
Testing Platform: iOS 6 on iPad 2
Severe bug, I believe. Renders iOS apps developed using these technologies utterly unusable.
Situation: Whenever I touch the TextInput component on the testing platform device, it will do one of two things:
- It will perform as it is supposed to. It gains focus (focusIn event dispatched), a blue focus rect surrounds it, the prompt text is replaced by a flashing cursor, the soft keyboard activates and is displayed (all expected events dispatched).
- It will fail. It will gain focus (focusIn event dispatched), and the blue focus rect will appear briefly and then disappear, the prompt text remains displayed and there is no cursor in the field (focusOut event dispatched). The softKeyboardActivate event is dispatched and immediately the softKeyboardDeactivate event is dispatched. The keyboard does not appear even briefly.
I can tap tap tap tap and eventually one tap (no different than any other) will be successful and #1 will happen instead of #2.
Here's the oddest thing. The focusManager tells me that the DisplayObject that has the focus is the same object when the focusIn event is dispatched and after the focusOut event is dispatched (and if I check every 10ms using a timer, the results don't change... the correct DO has focus.
Below the code is the trace output.
<?xml version="1.0" encoding="utf-8"?>
<s:ItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
xmlns:c="components.*"
width="100%"
creationComplete="creationCompleteHandler()">
<fx:Declarations>
<s:DropShadowFilter id="dropShadowFilter" blurX="6" blurY="6" alpha="0.5" distance="6" angle="60" strength=".5" quality="{BitmapFilterQuality.HIGH}"/>
</fx:Declarations>
<fx:Script>
<![CDATA[
import flash.filters.BitmapFilterQuality;
import mx.utils.ObjectProxy;
import spark.skins.mobile.TextAreaSkin;
import views.tools.MakeAToolBase;
[Bindable]
private var pad:Number = 15;
[Bindable]
public var dataProxy:ObjectProxy;
[Bindable]
public var v:MakeAToolBase;
protected function creationCompleteHandler():void
{
trace("LearnItListItemRenderer FUNCTION creationCompleteHander()");
dataProxy = new ObjectProxy(data);
dataProxy.choosePictureButton = choosePictureButton;
}
]]>
</fx:Script>
<s:layout>
<s:HorizontalLayout horizontalAlign="center"/>
</s:layout>
<s:HGroup id="listItem" gap="33" paddingTop="15" paddingBottom="15" horizontalAlign="center" paddingLeft="15" paddingRight="44"
verticalAlign="middle" width="100%" height="210" filters="{[dropShadowFilter]}">
<s:Group height="100%">
<s:Rect height="100%" width="100%" radiusX="5" radiusY="5">
<s:fill>
<s:SolidColor color="0xffffff" alpha="1"/>
</s:fill>
<s:stroke>
<s:SolidColorStroke weight=".5" color="0x000066"/>
</s:stroke>
</s:Rect>
<s:Label text="{dataProxy.numberLabel}" fontSize="32" color="#000072" verticalAlign="middle" verticalCenter="0" paddingLeft="12" paddingRight="12"/>
</s:Group>
<c:ChoosePictureButton id="choosePictureButton" height="{listItem.height-pad-pad}" width="{(4*(listItem.height-pad-pad))/3}"/>
<s:VGroup id="textInputBoxesGroup" height="100%" width="100%">
<s:TextInput id="behaviorNameTextInput" color="#000000" textAlign="left" width="100%"
prompt="Enter Behavior Name..."
needsSoftKeyboard="true"
interactionMode="touch"
skinClass="spark.skins.mobile.TextInputSkin"
returnKeyLabel="done"
showPromptWhenFocused="true"
touchBegin="trace('touch');"
softKeyboardActivate= "trace('############################# SoftKeyboardActive #####################################');"
softKeyboardDeactivate="trace('############################# SoftKeyboardDeactivating #####################################');"
softKeyboardActivating="trace('############################# SoftKeyboardActivating #####################################');"
focusIn="trace('TEXTINPUT FOCUSIN: '+this.focusManager.getFocus())"
focusOut="trace('TEXTINPUT FOCUSOUT: '+this.focusManager.getFocus())"
creationComplete="{data.behaviorNameTextInput=behaviorNameTextInput;}"
/>
<s:Spacer id="behaviorSpacer" height="2"/>
<s:TextArea id="behaviorDescriptionTextArea"
fontFamily="verdana" fontSize="16"
verticalAlign="top" textAlign="left" width="100%" height="100%"
verticalScrollPolicy="on"
interactionMode="touch"
color="#000000" prompt="Enter Behavior Description..."
softKeyboardType="{SoftKeyboardType.DEFAULT}"
needsSoftKeyboard="true"
showPromptWhenFocused="true"
skinClass="spark.skins.mobile.TextAreaSkin"
creationComplete="{data.behaviorDescriptionTextArea=behaviorDescriptionTextArea}"/>
</s:VGroup>
<c:YesNoVerticalButtonsGroup/>
/s:HGroup>
</s:ItemRenderer>
Trace output [ edited for brevity ]
TEXTINPUT FOCUSIN: PictureToolsOnTheMoveMakeIt0.TabbedViewNavigatorApplicationSkin6.tabbedNavigator.TabbedViewNavigatorSkin8.contentGroup._PictureToolsOnTheMoveMakeIt_ViewNavigator3.ViewNavigatorSkin35.contentGroup.MakeAToolLearnItView471.SkinnableContainerSkin472.contentGroup.itemList.ListSkin475.Scroller477.ScrollerSkin478.DataGroup476.LearnItListItemRenderer566.listItem.textInputBoxesGroup.behaviorNameTextInput
############################# SoftKeyboardActivating #####################################
############################# SoftKeyboardDeactivating #####################################
TEXTINPUT FOCUSOUT: PictureToolsOnTheMoveMakeIt0.TabbedViewNavigatorApplicationSkin6.tabbedNavigator.TabbedViewNavigatorSkin8.contentGroup._PictureToolsOnTheMoveMakeIt_ViewNavigator3.ViewNavigatorSkin35.contentGroup.MakeAToolLearnItView471.SkinnableContainerSkin472.contentGroup.itemList.ListSkin475.Scroller477.ScrollerSkin478.DataGroup476.LearnItListItemRenderer566.listItem.textInputBoxesGroup.behaviorNameTextInput
############################# SoftKeyboardDeactivating #####################################
[ FAILED ATTEMPTS 2 - 22 REMOVED FOR READABILITY ]
TEXTINPUT FOCUSIN: PictureToolsOnTheMoveMakeIt0.TabbedViewNavigatorApplicationSkin6.tabbedNavigator.TabbedViewNavigatorSkin8.contentGroup._PictureToolsOnTheMoveMakeIt_ViewNavigator3.ViewNavigatorSkin35.contentGroup.MakeAToolLearnItView471.SkinnableContainerSkin472.contentGroup.itemList.ListSkin475.Scroller477.ScrollerSkin478.DataGroup476.LearnItListItemRenderer566.listItem.textInputBoxesGroup.behaviorNameTextInput
############################# SoftKeyboardActivating #####################################
############################# SoftKeyboardActive #####################################