@@ -550,6 +550,80 @@ void cn1_setStyleDoneButton(CN1_THREAD_STATE_MULTI_ARG UIBarButtonItem* btn) {
550550 utv.text = [NSString stringWithUTF8String: str];
551551 utv.delegate = [[CodenameOne_GLViewController instance ] eaglView ];
552552
553+ // Apply constraints for multiline text view
554+ // INITIAL_CAPS_WORD
555+ if ((constraint & 0x100000 ) == 0x100000 ) {
556+ utv.autocapitalizationType = UITextAutocapitalizationTypeWords;
557+ } else {
558+ // INITIAL_CAPS_SENTENCE
559+ if ((constraint & 0x200000 ) == 0x200000 ) {
560+ utv.autocapitalizationType = UITextAutocapitalizationTypeSentences;
561+ } else {
562+ // UPPERCASE
563+ if ((constraint & 0x800000 ) == 0x800000 ) {
564+ utv.autocapitalizationType = UITextAutocapitalizationTypeAllCharacters;
565+ } else {
566+ utv.autocapitalizationType = UITextAutocapitalizationTypeNone;
567+ }
568+ }
569+ }
570+
571+ // NON_PREDICTIVE
572+ if ((constraint & 0x80000 ) == 0x80000 ) {
573+ utv.autocorrectionType = UITextAutocorrectionTypeNo;
574+ }
575+
576+ // PASSWORD (Note: multiline password fields are uncommon, but supported)
577+ if ((constraint & 0x10000 ) == 0x10000 ) {
578+ utv.secureTextEntry = YES ;
579+ if (@available (iOS 11 , *)) {
580+ utv.textContentType = UITextContentTypePassword;
581+ }
582+ }
583+
584+ if ((constraint & 0x400000 ) == 0x400000 ) {
585+ if (@available (iOS 11 , *)) {
586+ utv.textContentType = UITextContentTypeUsername;
587+ }
588+ }
589+
590+ // EMAILADDR and other keyboard types (these apply even to multiline)
591+ int cccc = constraint & 0xff ;
592+ if (cccc == 1 ) {
593+ utv.keyboardType = UIKeyboardTypeEmailAddress;
594+ utv.autocapitalizationType = UITextAutocapitalizationTypeNone;
595+ if (@available (iOS 10 , *)) {
596+ utv.textContentType = UITextContentTypeEmailAddress;
597+ }
598+ } else {
599+ // NUMERIC
600+ if (cccc == 2 ) {
601+ utv.keyboardType = UIKeyboardTypeNumberPad;
602+ } else {
603+ // PHONENUMBER
604+ if (cccc == 3 ) {
605+ utv.keyboardType = UIKeyboardTypePhonePad;
606+ if (@available (iOS 10 , *)) {
607+ utv.textContentType = UITextContentTypeTelephoneNumber;
608+ }
609+ } else {
610+ // URL
611+ if (cccc == 4 ) {
612+ utv.keyboardType = UIKeyboardTypeURL;
613+ utv.autocapitalizationType = UITextAutocapitalizationTypeNone;
614+ if (@available (iOS 10 , *)) {
615+ utv.textContentType = UITextContentTypeURL;
616+ }
617+ } else {
618+ // DECIMAL
619+ if (cccc == 5 ) {
620+ utv.keyboardType = UIKeyboardTypeDecimalPad;
621+ }
622+ }
623+ }
624+ }
625+ }
626+
553627 if (showToolbar) {
554628 // add navigation toolbar to the top of the keyboard
555629#ifndef CN1_USE_ARC
0 commit comments