Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-24987] Android: TextField and TextView elements in SDK 6.1.1.GA do not fire focus events / trigger keyboard when using custom theme

GitHub Issuen/a
TypeBug
PriorityCritical
StatusClosed
ResolutionFixed
Resolution Date2017-07-26T21:37:13.000+0000
Affected Version/sn/a
Fix Version/sRelease 6.1.2
ComponentsAndroid
Labelsandroid, merge-6.1.2, regression
ReporterPeter Lancaster
AssigneeJoshua Quick
Created2017-07-18T12:03:58.000+0000
Updated2017-07-26T23:08:36.000+0000

Description

After upgrading from Ti SDK 5.2.0 to 6.1.1.GA, all Alloy compiled Android TextField and TextView elements do not appear to fire any events that trigger the OS keyboard to appear (for text input). This means that the majority of the app we are upgrading is completely unusable - and this completely blocks our upgrade until it is resolved / explained. Example code below shows fields in three different positions - none of which work currently (but did previously):
<Alloy>
  <View id="wrapper">
    <TextField left="0" right="0" height="35" hintText="test 1" />
    <ScrollView id="content" top="0" bottom="0">
      <TextField left="0" right="0" height="35" hintText="test 2" />
      <View id="container">
        <TextField left="0" right="0" height="35" hintText="test 3" />
      </View>
    </ScrollView>
  </View>
</Alloy>
I can see in the TiSlack community channel that we're not the only people encountering this issue (screenshot attached) - can you give us some idea of what is the root cause of this, and when it will be resolved? (note - other elements nested in the same locations, such as buttons or labels, are touchable and can be interacted with - this has been tested on a Genymotion 7.1 simulator, along with real Samsung 7.0 and 6.0 devices)

Attachments

FileDateSize
android-text-input.png2017-07-18T12:00:36.000+0000130820
max-node-version.png2017-07-19T07:31:42.000+000053581

Comments

  1. John Goodland 2017-07-18

    I can’t reproduce this Pete - sorry. I have this working as expected on Samsung Galaxy A3 (device) and Genymotion Samsung Galaxy S6. Beware the keyboard may be hidden on Genymotion and you need to turn it on. Option is change Keyboard – Hardware – Show input method. Happy to supply code, but it’s pretty much as per your example. Creating a new app mobile app using 6.1.1 GA from studio.
  2. Peter Lancaster 2017-07-18

    Could the problem be down to something that needs to be upgraded? We're starting from an Alloy 5.2.0 base, moving to 6.1.1 - do you see the same result from that path too?
  3. John Goodland 2017-07-18

    I went direct with a new app. Could you try that please? At least that way we will know its maybe something with the old Alloy base? thanks.
  4. Peter Lancaster 2017-07-18

    To confirm - from a *brand new* app - built directly from 6.1.1.GA - this problem doesn't occur with the following code in the index.xml file:
       <Alloy>
       	<Window class="container">
       		<TextField left="0" right="0" height="35" hintText="test 1" />
       		<ScrollView id="content" top="0" bottom="0">
       			<TextField left="0" right="0" height="35" hintText="test 2" />
       			<View id="container">
       				<TextField left="0" right="0" height="35" hintText="test 3" />
       			</View>
       		</ScrollView>
       	</Window>
       </Alloy>
       
    So this must be related to the upgrade process / flow?
  5. John Goodland 2017-07-18

    Thanks Pete. Could you please add your tiapp.xml (from the upgraded app) to this ticket and I will get engineering to look into this.
  6. Abir Mukherjee 2017-07-18

    Node Version: 6.10.3 NPM Version: 3.10.10 Mac OS: 10.12.4 Appc CLI: 6.2.2 Appc CLI NPM: 4.2.9 Titanium SDK version: 6.1.1.GA Appcelerator Studio, build: 4.9.0.201705302345 Xcode 8.3.2 Device Android 7.1 (Pixel) Android SDK API level 23 I was not able to reproduce the issue, and the app worked as expected. After I launched the app with the above demo code, the OS keyboard appeared.
  7. John Goodland 2017-07-18

    The bug appears to be in updated 5.2 base Alloy code that has been migrated to 6.1.1GA. I have request that Pete sends us the tipapp.xml to see what differences it may contain. Do you have any suggests to properties a newly created alloy app will have over an older one? or even an old Alloy code base you could try?
  8. Peter Lancaster 2017-07-19

    I'd rather not post the contents of our *tiapp.xml* file on a public ticket - but I'd be happy to go through it over a technical call, or a screen share? Note that Abir's tests do not use the same versions of Node, etc as we are using - as according to your docs anything above 4.6.x is unsupported (see attached screenshot [from this page](http://docs.appcelerator.com/platform/latest/#!/guide/Titanium_Compatibility_Matrix-section-src-29004837_TitaniumCompatibilityMatrix-Node.js)).
  9. Peter Lancaster 2017-07-20

    After a huge amount of trial and error over the last two days, I've hit on what's different between some upgraded apps, and a _vanilla_ app - and what seems to be causing this. If you add something like this:
       <?xml version="1.0" encoding="utf-8"?>
       <resources>
           <style name="Theme.NoActionBar" parent="@style/Theme.Titanium">
              <item name="android:windowBackground">@null</item>
              <item name="android:colorBackground">#FF0000</item>
           </style>
       </resources>
       
    ...to a *platform/android/res/values-v-min-api-level/custom_theme.xml* file - it should be easy to get into this scenario with a *new* 6.1.1.GA app. Remove the custom theme file, and the Android ActionBar reappears (which is undesirable) - but the text fields work as expected. I'm assuming that this is due to a contract change somewhere, and this approach is no longer supported? If so - what's the correct (supported) method of achieving this currently?
  10. Peter Lancaster 2017-07-20

    Looking at this more - it might be custom themes in general that are having issues. Is [this page on Android theming](http://docs.appcelerator.com/platform/latest/#!/guide/Android_Themes-section-src-34636181_AndroidThemes-CustomThemes) still correct?
  11. Chris Bowley 2017-07-20

    [~plancaster] I can replicate the issue using your custom theme. I can't answer what the cause is but if I use a custom theme which inherits from AppCompat it does not affect TextField focus:
        <?xml version="1.0" encoding="utf-8"?>
        <resources>
            <style name="Theme.NoActionBar" parent="@style/Theme.AppCompat">
                <item name="windowActionBar">false</item>
                <item name="windowNoTitle">true</item>
            </style>
        </resources>
        
  12. Peter Lancaster 2017-07-20

    So is the issue is just related to inheritance from *Theme.Titanium*? Is that documentation out of date now? Should *Theme.AppCompat* always be used as a parent instead?
  13. Gary Mathews 2017-07-20

    [~amukherjee] Could you test this with the current build of 6.1.2, there has been some recent changes regarding themes.
  14. Feon Sua Xin Miao 2017-07-20

    [~gmathews], 6.2.0.v20170719160617 works.-, except the textfield has a black background by default.-
  15. Abir Mukherjee 2017-07-20

    [~gmathews] Here is what I saw: SDK 6.1.2.v20170720023139: Keyboard does not appear. SDK 6.2.0.v20170720152752: Keyboard appears.
  16. Joshua Quick 2017-07-25

    [~plancaster], The reason this is happening is because we've modified Titanium 6.1.0 so that its "Theme.Titanium" theme would inherit (via the "parent" attribute) the theme that was applied to your application. https://github.com/appcelerator/titanium_mobile/pull/8592 Since your custom theme inherits from "Theme.Titanium", this is triggering a *recursive* lookup and causing this bad behavior, because "Theme.Titanium" is inheriting your custom theme because it's applied to the application. You can tell when a recursive resource file lookup is happening when the following Android message gets logged...
    ResourceType: Attempt to retrieve bag 0x7f050090 which is invalid or in a cycle.
    You can work-around this and restore the behavior you had before by changing your theme XML to what's shown below. This is a copy-and-paste of our "Theme.Titanium" XML settings and will work on both Titanium 5.x and 6.x. Although you might not want the "android:windowBackground" part since it'll show the Titanium splash screen on all the windows you'll be displaying.
        <?xml version="1.0" encoding="utf-8"?>
        <resources>
        	<style name="Theme.NoActionBar" parent="@style/Theme.AppCompat">
        		<item name="android:windowBackground">@drawable/appicon</item>
        		<item name="android:windowActionBar">false</item>		
        		<item name="android:windowNoTitle">true</item>
        		<item name="windowActionBar">false</item>
        		<item name="windowNoTitle">true</item>
        	</style>
        </resources>
        
  17. Joshua Quick 2017-07-26

    PR (6.1.x): https://github.com/appcelerator/titanium_mobile/pull/9253 PR (6.2.x): https://github.com/appcelerator/titanium_mobile/pull/9254 PR (master): https://github.com/appcelerator/titanium_mobile/pull/9255
  18. Lokesh Choudhary 2017-07-26

    FR Passed for 6.1.2, 6.2.0 & 7.0.0 branch. PR's merged.
  19. Lokesh Choudhary 2017-07-26

    Verified the fix with SDK 6.1.2.v20170726152015. Closing. Studio Ver: 4.9.1.201707200100 SDK Ver: 6.1.2.v20170726152015 OS Ver: 10.12.3 Xcode Ver: Xcode 8.3.3 Appc NPM: 4.2.9 Appc CLI: 6.2.2 Ti CLI Ver: 5.0.14 Alloy Ver: 1.9.11 Node Ver: 6.10.1 Java Ver: 1.8.0_101 Devices: ⇨ google Nexus 5 --- Android 6.0.1, Android 4.4.4

JSON Source