diff --git a/apps/editable-text-demo/main-page.xml b/apps/editable-text-demo/main-page.xml
index bb622051a..3bec025a2 100644
--- a/apps/editable-text-demo/main-page.xml
+++ b/apps/editable-text-demo/main-page.xml
@@ -2,7 +2,7 @@
-
-
+
+
\ No newline at end of file
diff --git a/ui/editable-text-base/editable-text-base-common.ts b/ui/editable-text-base/editable-text-base-common.ts
index 5e0289857..c39332656 100644
--- a/ui/editable-text-base/editable-text-base-common.ts
+++ b/ui/editable-text-base/editable-text-base-common.ts
@@ -34,6 +34,12 @@ var autocapitalizationTypeProperty = new dependencyObservable.Property(
new proxy.PropertyMetadata(enums.AutocapitalizationType.sentences, dependencyObservable.PropertyMetadataSettings.None)
);
+var autocorrectProperty = new dependencyObservable.Property(
+ "autocorrect",
+ "EditableTextBase",
+ new proxy.PropertyMetadata(undefined, dependencyObservable.PropertyMetadataSettings.None)
+ );
+
function onKeyboardTypePropertyChanged(data: dependencyObservable.PropertyChangeData) {
var editableTextBase = data.object;
editableTextBase._onKeyboardTypePropertyChanged(data);
@@ -62,6 +68,13 @@ function onAutocapitalizationTypePropertyChanged(data: dependencyObservable.Prop
(autocapitalizationTypeProperty.metadata).onSetNativeValue = onAutocapitalizationTypePropertyChanged;
+function onAutocorrectPropertyChanged(data: dependencyObservable.PropertyChangeData) {
+ var editableTextBase = data.object;
+ editableTextBase._onAutocorrectPropertyChanged(data);
+}
+
+(autocorrectProperty.metadata).onSetNativeValue = onAutocorrectPropertyChanged;
+
export class EditableTextBase extends textBase.TextBase implements definition.EditableTextBase {
public static keyboardTypeProperty = keyboardTypeProperty;
@@ -74,6 +87,8 @@ export class EditableTextBase extends textBase.TextBase implements definition.Ed
public static autocapitalizationTypeProperty = autocapitalizationTypeProperty;
+ public static autocorrectProperty = autocorrectProperty;
+
constructor(options?: definition.Options) {
super(options);
}
@@ -118,6 +133,14 @@ export class EditableTextBase extends textBase.TextBase implements definition.Ed
this._setValue(EditableTextBase.autocapitalizationTypeProperty, value);
}
+ get autocorrect(): boolean {
+ return this._getValue(EditableTextBase.autocorrectProperty);
+ }
+
+ set autocorrect(value: boolean) {
+ this._setValue(EditableTextBase.autocorrectProperty, value);
+ }
+
public dismissSoftInput() {
//
}
@@ -138,4 +161,8 @@ export class EditableTextBase extends textBase.TextBase implements definition.Ed
public _onAutocapitalizationTypePropertyChanged(data: dependencyObservable.PropertyChangeData) {
//
}
+
+ public _onAutocorrectPropertyChanged(data: dependencyObservable.PropertyChangeData) {
+ //
+ }
}
\ No newline at end of file
diff --git a/ui/editable-text-base/editable-text-base.android.ts b/ui/editable-text-base/editable-text-base.android.ts
index 4574a6a09..045c95995 100644
--- a/ui/editable-text-base/editable-text-base.android.ts
+++ b/ui/editable-text-base/editable-text-base.android.ts
@@ -212,4 +212,34 @@ export class EditableTextBase extends common.EditableTextBase {
editableTextBase.android.setInputType(inputType);
}
+
+ public _onAutocorrectPropertyChanged(data: dependencyObservable.PropertyChangeData) {
+ var editableTextBase = data.object;
+ if (!editableTextBase.android) {
+ return;
+ }
+
+
+ var inputType = editableTextBase.android.getInputType();
+ console.log("BEFORE: " + inputType);
+
+ switch (data.newValue) {
+ case true:
+ inputType = inputType | android.text.InputType.TYPE_TEXT_FLAG_AUTO_COMPLETE;
+ inputType = inputType | android.text.InputType.TYPE_TEXT_FLAG_AUTO_CORRECT;
+ inputType = inputType & ~android.text.InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS;
+ break;
+ case false:
+ inputType = inputType & ~android.text.InputType.TYPE_TEXT_FLAG_AUTO_COMPLETE;
+ inputType = inputType & ~android.text.InputType.TYPE_TEXT_FLAG_AUTO_CORRECT;
+ inputType = inputType | android.text.InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS;
+ break;
+ default:
+ // We can't do anything.
+ break;
+ }
+
+ editableTextBase.android.setInputType(inputType);
+ console.log("AFTER: " + inputType);
+ }
}
\ No newline at end of file
diff --git a/ui/editable-text-base/editable-text-base.d.ts b/ui/editable-text-base/editable-text-base.d.ts
index 1f0c24998..734acc8fd 100644
--- a/ui/editable-text-base/editable-text-base.d.ts
+++ b/ui/editable-text-base/editable-text-base.d.ts
@@ -11,6 +11,7 @@
public static editableProperty: dependencyObservable.Property;
public static updateTextTriggerProperty: dependencyObservable.Property;
public static autocapitalizationTypeProperty: dependencyObservable.Property;
+ public static autocorrectProperty: dependencyObservable.Property;
constructor(options?: Options);
@@ -40,6 +41,11 @@
*/
autocapitalizationType: string;
+ /**
+ * Enables or disables autocorrection.
+ */
+ autocorrect: boolean;
+
/**
* Hides the soft input method, ususally a soft keyboard.
*/
@@ -67,7 +73,6 @@
/**
* Gets or sets a value indicating when the text property will be updated.
- * Possible values are contained in the UpdateTextTrigger enumeration located in "ui/enums" module.
*/
updateTextTrigger?: string;
@@ -75,5 +80,10 @@
* Gets or sets the autocapitalization type.
*/
autocapitalizationType?: string;
+
+ /**
+ * Enables or disables autocorrection.
+ */
+ autocorrect?: boolean;
}
}
\ No newline at end of file
diff --git a/ui/editable-text-base/editable-text-base.ios.ts b/ui/editable-text-base/editable-text-base.ios.ts
index 105de7f3a..e284dc24d 100644
--- a/ui/editable-text-base/editable-text-base.ios.ts
+++ b/ui/editable-text-base/editable-text-base.ios.ts
@@ -13,7 +13,7 @@ export class EditableTextBase extends common.EditableTextBase {
}
public _onKeyboardTypePropertyChanged(data: dependencyObservable.PropertyChangeData) {
- var newKeyboardType;
+ var newKeyboardType: UIKeyboardType;
switch (data.newValue) {
case enums.KeyboardType.datetime:
newKeyboardType = UIKeyboardType.UIKeyboardTypeNumbersAndPunctuation;
@@ -39,33 +39,33 @@ export class EditableTextBase extends common.EditableTextBase {
}
public _onReturnKeyTypePropertyChanged(data: dependencyObservable.PropertyChangeData) {
- var newReturnKeyType;
+ var newValue;
switch (data.newValue) {
case enums.ReturnKeyType.done:
- newReturnKeyType = UIReturnKeyType.UIReturnKeyDone;
+ newValue = UIReturnKeyType.UIReturnKeyDone;
break;
case enums.ReturnKeyType.go:
- newReturnKeyType = UIReturnKeyType.UIReturnKeyGo;
+ newValue = UIReturnKeyType.UIReturnKeyGo;
break;
case enums.ReturnKeyType.next:
- newReturnKeyType = UIReturnKeyType.UIReturnKeyNext;
+ newValue = UIReturnKeyType.UIReturnKeyNext;
break;
case enums.ReturnKeyType.search:
- newReturnKeyType = UIReturnKeyType.UIReturnKeySearch;
+ newValue = UIReturnKeyType.UIReturnKeySearch;
break;
case enums.ReturnKeyType.send:
- newReturnKeyType = UIReturnKeyType.UIReturnKeySend;
+ newValue = UIReturnKeyType.UIReturnKeySend;
break;
default:
- newReturnKeyType = UIReturnKeyType.UIReturnKeyDefault;
+ newValue = UIReturnKeyType.UIReturnKeyDefault;
break;
}
- (this.ios).returnKeyType = newReturnKeyType;
+ (this.ios).returnKeyType = newValue;
}
public _onAutocapitalizationTypePropertyChanged(data: dependencyObservable.PropertyChangeData) {
- var newValue;
+ var newValue: UITextAutocapitalizationType;
switch (data.newValue) {
case enums.AutocapitalizationType.none:
newValue = UITextAutocapitalizationType.UITextAutocapitalizationTypeNone;
@@ -86,4 +86,24 @@ export class EditableTextBase extends common.EditableTextBase {
(this.ios).autocapitalizationType = newValue;
}
+
+ public _onAutocorrectPropertyChanged(data: dependencyObservable.PropertyChangeData) {
+ console.log("BEFORE: " + (this.ios).autocorrectionType);
+
+ var newValue: UITextAutocorrectionType;
+ switch (data.newValue) {
+ case true:
+ newValue = UITextAutocorrectionType.UITextAutocorrectionTypeYes;
+ break;
+ case false:
+ newValue = UITextAutocorrectionType.UITextAutocorrectionTypeNo;
+ break;
+ default:
+ newValue = UITextAutocorrectionType.UITextAutocorrectionTypeDefault;
+ break;
+ }
+
+ (this.ios).autocorrectionType = newValue;
+ console.log("AFTER: " + (this.ios).autocorrectionType);
+ }
}
\ No newline at end of file