Skip to content

Commit dca52bb

Browse files
author
Alexander Vakrilov
authored
Merge pull request NativeScript#3988 from NativeScript/fix-autocapitalization-type
FIX: Crash when setting autocapitalizationType=allCharacters in xml
2 parents 577d011 + 4b98db0 commit dca52bb

5 files changed

Lines changed: 10 additions & 10 deletions

File tree

‎tns-core-modules/ui/editable-text-base/editable-text-base-common.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ editableProperty.register(EditableTextBase);
3838
export const updateTextTriggerProperty = new Property<EditableTextBase, UpdateTextTrigger>({ name: "updateTextTrigger", defaultValue: "textChanged" });
3939
updateTextTriggerProperty.register(EditableTextBase);
4040

41-
const autocapitalizationTypeConverter = makeParser<AutocapitalizationType>(makeValidator<AutocapitalizationType>("none", "words", "sentences", "allCharacters"));
41+
const autocapitalizationTypeConverter = makeParser<AutocapitalizationType>(makeValidator<AutocapitalizationType>("none", "words", "sentences", "allcharacters"));
4242

4343
export const autocapitalizationTypeProperty = new Property<EditableTextBase, AutocapitalizationType>({ name: "autocapitalizationType", defaultValue: "sentences", valueConverter: autocapitalizationTypeConverter });
4444
autocapitalizationTypeProperty.register(EditableTextBase);

‎tns-core-modules/ui/editable-text-base/editable-text-base.android.ts‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -321,14 +321,14 @@ export abstract class EditableTextBase extends EditableTextBaseCommon {
321321
}
322322
}
323323

324-
[autocapitalizationTypeProperty.getDefault](): "none" | "words" | "sentences" | "allCharacters" | string {
324+
[autocapitalizationTypeProperty.getDefault](): "none" | "words" | "sentences" | "allcharacters" | string {
325325
let inputType = this.nativeView.getInputType();
326326
if ((inputType & android.text.InputType.TYPE_TEXT_FLAG_CAP_WORDS) === android.text.InputType.TYPE_TEXT_FLAG_CAP_WORDS) {
327327
return "words";
328328
} else if ((inputType & android.text.InputType.TYPE_TEXT_FLAG_CAP_SENTENCES) === android.text.InputType.TYPE_TEXT_FLAG_CAP_SENTENCES) {
329329
return "sentences";
330330
} else if ((inputType & android.text.InputType.TYPE_TEXT_FLAG_CAP_CHARACTERS) === android.text.InputType.TYPE_TEXT_FLAG_CAP_CHARACTERS) {
331-
return "allCharacters";
331+
return "allcharacters";
332332
} else {
333333
return inputType.toString();
334334
}
@@ -347,7 +347,7 @@ export abstract class EditableTextBase extends EditableTextBaseCommon {
347347
case "sentences":
348348
inputType = inputType | android.text.InputType.TYPE_TEXT_FLAG_CAP_SENTENCES; //16384(0x00040000) 15th bit
349349
break;
350-
case "allCharacters":
350+
case "allcharacters":
351351
inputType = inputType | android.text.InputType.TYPE_TEXT_FLAG_CAP_CHARACTERS; //4096 (0x00010000) 13th bit
352352
break;
353353
default:

‎tns-core-modules/ui/editable-text-base/editable-text-base.d.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export class EditableTextBase extends TextBase {
4848
export type KeyboardType = "datetime" | "phone" | "number" | "url" | "email";
4949
export type ReturnKeyType = "done" | "next" | "go" | "search" | "send";
5050
export type UpdateTextTrigger = "focusLost" | "textChanged";
51-
export type AutocapitalizationType = "none" | "words" | "sentences" | "allCharacters";
51+
export type AutocapitalizationType = "none" | "words" | "sentences" | "allcharacters";
5252

5353
export const keyboardTypeProperty: Property<EditableTextBase, KeyboardType>;
5454
export const returnKeyTypeProperty: Property<EditableTextBase, ReturnKeyType>;

‎tns-core-modules/ui/editable-text-base/editable-text-base.ios.ts‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ export abstract class EditableTextBase extends EditableTextBaseCommon {
120120
this.nativeView.returnKeyType = newValue;
121121
}
122122

123-
[autocapitalizationTypeProperty.getDefault](): "none" | "words" | "sentences" | "allCharacters" {
123+
[autocapitalizationTypeProperty.getDefault](): "none" | "words" | "sentences" | "allcharacters" {
124124
let autocapitalizationType = this.nativeView.autocapitalizationType;
125125
switch (autocapitalizationType) {
126126
case UITextAutocapitalizationType.None:
@@ -133,13 +133,13 @@ export abstract class EditableTextBase extends EditableTextBaseCommon {
133133
return "sentences";
134134

135135
case UITextAutocapitalizationType.AllCharacters:
136-
return "allCharacters";
136+
return "allcharacters";
137137

138138
default:
139139
throw new Error("Invalid autocapitalizationType value:" + autocapitalizationType);
140140
}
141141
}
142-
[autocapitalizationTypeProperty.setNative](value: "none" | "words" | "sentences" | "allCharacters") {
142+
[autocapitalizationTypeProperty.setNative](value: "none" | "words" | "sentences" | "allcharacters") {
143143
let newValue: UITextAutocapitalizationType;
144144
switch (value) {
145145
case "none":
@@ -151,7 +151,7 @@ export abstract class EditableTextBase extends EditableTextBaseCommon {
151151
case "sentences":
152152
newValue = UITextAutocapitalizationType.Sentences;
153153
break;
154-
case "allCharacters":
154+
case "allcharacters":
155155
newValue = UITextAutocapitalizationType.AllCharacters;
156156
break;
157157
default:

‎tns-core-modules/ui/enums/enums.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ export module AutocapitalizationType {
108108
export var none: string = "none";
109109
export var words: string = "words";
110110
export var sentences: string = "sentences";
111-
export var allCharacters: string = "allCharacters";
111+
export var allCharacters: string = "allcharacters";
112112
}
113113

114114
export module NavigationBarVisibility {

0 commit comments

Comments
 (0)