[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 Issue | n/a |
---|---|
Type | Bug |
Priority | Critical |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2017-07-26T21:37:13.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Release 6.1.2 |
Components | Android |
Labels | android, merge-6.1.2, regression |
Reporter | Peter Lancaster |
Assignee | Joshua Quick |
Created | 2017-07-18T12:03:58.000+0000 |
Updated | 2017-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
File | Date | Size |
---|---|---|
android-text-input.png | 2017-07-18T12:00:36.000+0000 | 130820 |
max-node-version.png | 2017-07-19T07:31:42.000+0000 | 53581 |
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.
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?
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.
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:
So this must be related to the upgrade process / flow?
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.
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.
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?
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)).
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:
...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?
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?
[~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:
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?
[~amukherjee] Could you test this with the current build of
6.1.2
, there has been some recent changes regarding themes.[~gmathews], 6.2.0.v20170719160617 works.-, except the textfield has a black background by default.-
[~gmathews] Here is what I saw: SDK 6.1.2.v20170720023139: Keyboard does not appear. SDK 6.2.0.v20170720152752: Keyboard appears.
[~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...
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.
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
FR Passed for 6.1.2, 6.2.0 & 7.0.0 branch. PR's merged.
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