I just wanted to post an answer that also shows how to change the keyboard for both Android and iOS in case it helps anyone. I'm using NativeScript 7 with Angular and TypeScript (but you can also just use regular JavaScript) and I got it working by accessing the native elements of iOS and Android used under RadDataForm
. I was also able to figure out the types for TypeScript which was really nice to see all the different InputType
's available*:
<RadDataForm [source]="item" (editorUpdate)="onEditorUpdate($event)">
<TKEntityProperty tkDataFormProperty name="description"></TKEntityProperty>
</RadDataForm>
import { DataFormEventData } from 'nativescript-ui-dataform';
import { ios } from '@nativescript/core/application';
// ... inside an Angular component
public onEditorUpdate(dataFormEvent: DataFormEventData): void {
if (dataFormEvent.propertyName === 'descriptionProperty') {
if (ios) {
const iosTextField = dataFormEvent.editor as UITextField;
iosTextField.autocapitalizationType = UITextAutocapitalizationType.None; // "Sentences", "Words", "AllCharacters", or "None"
iosTextField.autocorrectionType = UITextAutocorrectionType.Yes; // "Yes", "No", or "Default"
} else {
const textEditor = dataFormEvent.editor as com.telerik.widget.dataform.visualization.editors.DataFormTextEditor;
const androidEditText = textEditor.getEditorView() as android.widget.EditText;
androidEditText.setInputType(android.text.InputType.TYPE_TEXT_VARIATION_NORMAL); // Many difference choices see Android docs: https://developer.android.com/reference/android/text/InputType
}
}
}
*Android InputType
choices, see Android docs: https://developer.android.com/reference/android/text/InputType