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

Android: TextField/TextArea within a TableView can have performance issues with some keyboards

    Details

    • Story Points:
      13
    • Sprint:
      2019 Sprint 5, 2019 Sprint 6, 2019 Sprint 7, 2019 Sprint 8, 2019 Sprint 9, 2019 Sprint 10, 2019 Sprint 11, 2019 Sprint 12, 2019 Sprint 13, 2019 Sprint 14, 2019 Sprint 15

      Description

      Summary:
      Entering text into a TextField/TextArea embedded within a TableView can cause performance issues if the virtual keyboard shows/hides its top suggestion bar dynamically. It can also cause the cursor to suddenly move to the end of field and cause the field to flicker.

      Reason:
      By default, the "windowSoftInputMode" is set to Ti.UI.Android.SOFT_INPUT_ADJUST_PAN (aka: "adjustPan"), which means that showing/hiding the virtual keyboards will cause the window to resize. The resizing of a TableView triggers its row recycling/update behavior which can cause the "contents" of each row (such as the TextField) to be re-parented to a new row container view, which causes havoc with the virtual keyboard.

      For virtual keyboards that have a fixed height and do not pop-in/out a suggestion bar as you type, this isn't really an issue since the above mentioned resize behavior happens once. For example, this is not an issue on a Pixel phone.

      But some device pop-in/out a suggestion bar as you type which causes the TableView to resize every time you type in a character. This will cause massive performance issues.

      Steps to reproduce:

      1. Build and run TableOfTextFieldsTest.js on Android.
      2. Tap on row 1's TextArea.
      3. Notice that the cursor is moved to end of the field. (The code is supposed to highlight the whole text instead.)
      4. Notice the below warnings get logged.

      [WARN]  IInputConnectionWrapper: getTextBeforeCursor on inactive InputConnection
      [WARN]  IInputConnectionWrapper: getSelectedText on inactive InputConnection
      [WARN]  IInputConnectionWrapper: getTextAfterCursor on inactive InputConnection
      

      Work-Around 1:
      Set up the window to "adjustPan". This works-around the issue because it causes the virtual keyboard to be overlaid on top of the window instead of resizing it, which avoids the issue.

      var window = Ti.UI.createWindow({
      	windowSoftInputMode: Ti.UI.Android ? Ti.UI.Android.SOFT_INPUT_ADJUST_PAN : null,
      });
      

      Work-Around 2:
      Use a ScrollView instead of a TableView.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                jquick Joshua Quick
                Reporter:
                hknoechel Hans Knöchel
                Reviewer:
                Gary Mathews
                Tester:
                Lokesh Choudhary
              • Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Backbone Issue Sync

                  • Titanium SDK/CLI <> Titanium Mobile
                    Synced with:
                    TIMOB-21064
                    Sync status:
                    PENDING
                    Last received:
                    Last sent:

                    Git Source Code