Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-27694

Android: Textfield.focus() method is not working in Ti SDK 8.3.0.GA

    Details

    • Type: Bug
    • Status: Closed
    • Priority: None
    • Resolution: Fixed
    • Affects Version/s: Release 8.2.1, Release 8.3.0
    • Fix Version/s: Release 9.0.0, Release 8.3.1
    • Component/s: Android
    • Environment:

      Ti SDK 8.3.0.GA, 8.2.1.GA
      CLI 7.1.2
      Android Device: Samsung Galaxy J7 Prime2 v9.0.0, Emulator Google Nexus v8.0.0

    • Story Points:
      3
    • Sprint:
      2019 Sprint 26, 2020 Sprint 1

      Description

      Issue: Textfield.focus() method is not working properly on android after updating to 8.3.0. It is getting focused but no keyboard is shown. The keyboard is only showing on the click of the TextField but if I call TextField.focus() then textfield is getting focused without a keyboard.

      Steps To Reproduce:
      1. Create a classic project
      2. Paste this code in app.js file
      3. Run it on android device or emulator
      4. Click on the "Focus Test" Button

      Note: Works as expected with Ti SDK 8.2.0.GA

      app.js

      var win = Ti.UI.createWindow({
      	title : "Focus Test",
      	backgroundColor : 'red',
      	layout : "vertical"
       
      });
       
      // Create a TextField.
      var aTextField = Ti.UI.createTextField({
      	height : 40,
      	top : 30,
      	left : 20,
      	right : 20,
      	backgroundColor : "gray",
      	hintText : 'This is hint text',
      	softKeyboardOnFocus : Ti.UI.Android.SOFT_KEYBOARD_DEFAULT_ON_FOCUS, // Android only
      	keyboardType : Ti.UI.KEYBOARD_DEFAULT,
      	returnKeyType : Ti.UI.RETURNKEY_DEFAULT,
      	borderStyle : Ti.UI.INPUT_BORDERSTYLE_ROUNDED
      });
       
      // Listen for return events.
      aTextField.addEventListener('return', function(e) {
      	aTextField.blur();
      	alert('Input was: ' + aTextField.value);
      });
       
      // Add to the parent view.
      win.add(aTextField);
       
      // Create a Button.
      var test = Ti.UI.createButton({
      	title : 'Focus Test',
      	height : Ti.UI.SIZE,
      	width : Ti.UI.SIZE,
      	top : 50,
       
      });
       
      // Listen for click events.
      test.addEventListener('click', function() {
       
      	aTextField.focus();
      	//alert('\'aButton\' was clicked!');
      });
       
      // Add to the parent view.
      win.add(test);
       
      win.open();
      
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                cwilliams Christopher Williams
                Reporter:
                morahman Motiur Rahman
                Reviewer:
                Gary Mathews
                Tester:
                Lokesh Choudhary
              • Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Backbone Issue Sync

                  • Backbone Issue Sync is enabled for your project, but we do not have any synchronization info for this issue.

                    Git Source Code