Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-25671] Android: Not all TextField return key types fire a "return" event

GitHub Issuen/a
TypeBug
PriorityCritical
StatusClosed
ResolutionFixed
Resolution Date2018-04-19T21:26:57.000+0000
Affected Version/sn/a
Fix Version/sRelease 7.1.1
ComponentsAndroid
Labelsmerge-7.1.1
ReporterPrashant Saini
AssigneeYordan Banev
Created2018-01-09T15:38:46.000+0000
Updated2018-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

FileDateSize
TextAreaReturnTest.js2018-03-21T01:14:14.000+00002352
TextFieldReturnTest.js2018-03-21T01:14:24.000+00001846

Comments

  1. Mostafizur Rahman 2018-01-10

    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:*
       var win = Ti.UI.createWindow({ backgroundColor : 'black'});
        
       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();
       
  2. John Staunton 2018-02-12

    Same for SDK 7.0.2.GA
  3. Hans Knöchel 2018-02-14

    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.
  4. John Staunton 2018-02-14

    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...
  5. Kanmani Raja 2018-02-27

    Hello, Any update on this defect?
  6. Thomas Neerup 2018-03-06

    Not even a Fix version/s yet... Please fix this soon... Thanks...
  7. Jeroen van Dijk 2018-03-07

    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.
  8. Thomas Neerup 2018-03-14

    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...
  9. Eric Merriman 2018-03-14

    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.
  10. Yordan Banev 2018-03-14

    PR: https://github.com/appcelerator/titanium_mobile/pull/9933
  11. Hans Knöchel 2018-03-14

    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)
  12. Yordan Banev 2018-03-19

    7_1_X: https://github.com/appcelerator/titanium_mobile/pull/9943
  13. Thomas Neerup 2018-03-19

    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
  14. Yordan Banev 2018-03-19

  15. Joshua Quick 2018-03-21

    Attached scripts [^TextFieldReturnTest.js] and [^TextAreaReturnTest.js] to test "return" event handling for different returnKeyType settings between TextFields and TextAreas.
  16. Lokesh Choudhary 2018-03-23

    FR passed for master & backport.
  17. Lokesh Choudhary 2018-03-26

    PR's merged.
  18. Samir Mohammed 2018-03-27

    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

JSON Source