[TIMOB-25671] Android: Not all TextField return key types fire a "return" event
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Critical |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2018-04-19T21:26:57.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Release 7.1.1 |
Components | Android |
Labels | merge-7.1.1 |
Reporter | Prashant Saini |
Assignee | Yordan Banev |
Created | 2018-01-09T15:38:46.000+0000 |
Updated | 2018-04-19T21:27:01.000+0000 |
Description
Setting *returnKeyType* on *TextField* does not fire *return* event in case of some particular values.
Here's a sample code to show it with possible values where return event fired up & for some other values which it doesn't get fired for. I am also aware that not all return-types are not for Android but they should not prevent *return event* to get called.
var win = Ti.UI.createWindow({ backgroundColor : 'white'});
var tf = Ti.UI.createTextField({
top : 40,
left : 20,
right : 20,
returnKeyType : Ti.UI.RETURNKEY_SEARCH,
hintText : 'Hit \'Return\' button'
});
tf.addEventListener('return', function () {
alert('it worked');
});
win.add(tf);
win.open();
/* these values properly fire 'return' event
- RETURNKEY_CONTINUE
- RETURNKEY_DEFAULT
- RETURNKEY_DONE
- RETURNKEY_ROUTE
- RETURNKEY_JOIN
- RETURNKEY_NEXT
// these does not
- RETURNKEY_EMERGENCY_CALL
- RETURNKEY_GO
- RETURNKEY_GOOGLE
- RETURNKEY_SEARCH
- RETURNKEY_SEND
- RETURNKEY_YAHOO
*/
Attachments
File | Date | Size |
---|---|---|
TextAreaReturnTest.js | 2018-03-21T01:14:14.000+0000 | 2352 |
TextFieldReturnTest.js | 2018-03-21T01:14:24.000+0000 | 1846 |
Hello, Tested the issue and able to reproduce this using SDK 7.0.1.GA and android 7 device. *Test steps:* 1. Open Studio and create a classic project. 2. Paste the sample code to app.js. 3. Run the project via android 7 device. 4. Write something on the textfield and then click on the return key, the event is not firing. *Test Environment:* Appcelerator Command-Line Interface, version 7.0.1 Mac OS X 10.13.1 Architecture 64bit CPUs 4 Memory 8589934592 Axway Appcelerator Studio, build: 5.0.0.201712081732 Node.js Version = 8.9.1 npm Version = 5.5.1 SDK 7.0.1.GA, Android 7 Device(Samsung Galaxy J7 ) *Test code:*
Same for SDK 7.0.2.GA
It looks like we are preventing the event to fire twice in [here](https://github.com/appcelerator/titanium_mobile/blame/master/android/modules/ui/src/java/ti/modules/titanium/ui/widget/TiUIText.java#L523), but it looks like that causes other side effects. The last change on this was done in 7.0.0 as part of TIMOB-25580 (cc [~gmathews]), so if it was broken since 7.0.0, that may be the reason why.
Yes, I switched over to using the textArea component instead of textField as the return event is indeed fired (once) there while 0 times for textField...
Hello, Any update on this defect?
Not even a Fix version/s yet... Please fix this soon... Thanks...
Confirmed! Just received feedback from a user after upgrading an app implemenation from 6.3.0 to 7.0.2 GA. In my case using the RETURNKEY_SEARCH.
Can this really be right? Critical bug and Fix version 7.2.0. Nobody can release with this error if they use USB scanners or have any dependency on the return event. Please include this in a earlier Version if at all possible... Just tested with a USB scanner set up to press return after each scan.. And the return event is never fired, no matter the returnKeyType It worked fine before SDK 7 Chers...
Hello [~thomas.neerup@eg.dk] - 7.2.0 is our next build. Due to the need to reschedule some features from 7.1.0, we are making 7.2.0. The team can meet this week to discuss making a small and quick 7.1.1 to expedite this issue and a handful of others.
PR: https://github.com/appcelerator/titanium_mobile/pull/9933
Here is a 7.0.x build that represents the stable 7.0.2.GA build + the above pull request. It can be used for the developers not wanting to wait for 7.2.0 so far. I will do a 7.1.0 one as well once 7.1.0.GA is released. - [Download 7.0.3 build](https://www.dropbox.com/s/inotgrshhdru4lk/mobilesdk-7.0.3-osx.zip?dl=0) - [7_0_X commit](https://github.com/hansemannn/titanium_mobile/commit/f1cf4f715a2731e6b248372f3c327a826038cabb) (for the devs wanting to compile or cherry-pick it themselves)
7_1_X: https://github.com/appcelerator/titanium_mobile/pull/9943
Me again... Just testet the 7.0.3 download above. And everything seems to work when using the software keyboard. But a large part of my customers have: Symbol TC55 or Symbol TC70 with built-in scanners. These scanners are preinstalled with android 4.4.3, and DataWedge app to configure scanner And when they are configured send Enter after scanning, my app receives the return event twice. This worked pre 7.0 and works if a TextArea is used instead of a TextField /Chers
Attached scripts [^TextFieldReturnTest.js] and [^TextAreaReturnTest.js] to test "return" event handling for different
returnKeyType
settings between TextFields and TextAreas.FR passed for master & backport.
PR's merged.
Verified fix in SDK version 7.1.1.v20180326111446 and SDK Version 7.2.0.v20180326104918 Test and other information can be found at: Master: https://github.com/appcelerator/titanium_mobile/pull/9933 7_1_X: https://github.com/appcelerator/titanium_mobile/pull/9943