AIR Native Extension for alternate way to input text on AIR.
- Download com.github.airext.NativeKeyboardText.ane ANE and add it as dependencies to your project. Optionally you may include corresponded
com.github.airext.NativeKeyboardText.swc
library to your project. - Edit your Application Descriptor file with registering new native extensions like this:
<extensions>
<extensionID>com.github.airext.NativeKeyboardText</extensionID>
</extensions>
Set iOS minimum version to 12.0 in iPhone InfoAdditions:
<iPhone>
<!-- A list of plist key/value pairs to be added to the application Info.plist -->
<InfoAdditions>
<![CDATA[
<key>MinimumOSVersion</key>
<string>12.0</string>
]]>
</InfoAdditions>
</iPhone>
A very simple example:
// listen to Keyboard's Input event
NativeKeyboardText.shared.addEventListener(NativeKeyboardTextInputEvent.INPUT, function(event: NativeKeyboardTextInputEvent): void {
log("Keyboard input: " + event.text);
});
// show Keyboard using shared instance method.
var params: NativeKeyboardTextParams = new NativeKeyboardTextParams();
NativeKeyboardText.shared.showKeyboard(params);
Full documentation could be found here
Use NativeKeyboardText.shared
to obtain an instance of NativeKeyboardText class, it is designed to be a singleton.
NativeKeyboardText.isSupported
indicates if NativeKeyboardText is supported on the current platform;NativeKeyboardText.extensionVersion
returns extension version number;
NativeKeyboardText.shared.showKeyboard(NativeKeyboardTextParams)
shows native keyboard parametrized based onNativeKeyboardTextParams
instance.NativeKeyboardText.shared.showKeyboard.hideKeyboard()
hides native keyboard if presented from this ANE.
NativeKeyboardTextShowEvent.SHOW
dispatches when native keyboard is opened.NativeKeyboardTextHideEvent.HIDE
dispatches after native keyboard hides, providesoldText: String
andnewText: String
properties that could be used to handle user input.NativeKeyboardTextInputEvent.INPUT
dispatches when user taps on a return button, containstext
property with current user input.
The appearance of native keyboard could be changed with NativeKeyboardTextParams
object:
NativeKeyboardTextParams.text
specifies initial text to display in a text field above native keyboard;NativeKeyboardTextParams.isSecureTextEntry
indicates if input should be secured;NativeKeyboardTextParams.keyboardType
keyboard type fromNativeKeyboardType
enum.NativeKeyboardTextParams.returnKeyType
a type of return button fromReturnKeyType
enum.NativeKeyboardTextParams.autoCorrection
auto correction type fromAutoCorrection
enum.NativeKeyboardTextParams.autoCapitalization
auto capitalization type fromAutoCapitalization
enum.NativeKeyboardTextParams.spellChecking
spell checking type fromSpellChecking
enum.NativeKeyboardTextParams.maxCharactersCount
indicates how mach characters user able to enter.
This enum maps to UIKeyboardType, next values are supported:
NativeKeyboardType.Default
NativeKeyboardType.ASCIICapable
NativeKeyboardType.NumbersAndPunctuation
NativeKeyboardType.URL
NativeKeyboardType.NumberPad
NativeKeyboardType.PhonePad
NativeKeyboardType.NamePhonePad
NativeKeyboardType.EmailAddress
NativeKeyboardType.DecimalPad
NativeKeyboardType.Twitter
NativeKeyboardType.WebSearch
NativeKeyboardType.ASCIICapableNumberPad
Maps to UIReturnKeyType, next values are supported:
ReturnKeyType.Default
ReturnKeyType.Go
ReturnKeyType.Google
ReturnKeyType.Join
ReturnKeyType.Next
ReturnKeyType.Route
ReturnKeyType.Search
ReturnKeyType.Send
ReturnKeyType.Yahoo
ReturnKeyType.Done
ReturnKeyType.EmergencyCall
ReturnKeyType.Continue
Maps to UITextAutocapitalizationType, next values are supported:
AutoCapitalization.None
AutoCapitalization.Words
AutoCapitalization.Sentences
AutoCapitalization.AllCharacters
Maps to UITextAutocorrectionType, supports next values:
AutoCorrection.Default
AutoCorrection.No
AutoCorrection.Yes
Maps to UITextSpellCheckingType, supports next values:
SpellChecking.Default
SpellChecking.No
SpellChecking.Yes