Skip to content

TextField returnPress event not working on Android #1721

Closed

Description

@rajagottumukkala

Just to make sure I am not doing anything wrong in my project, I have taken {N} sample Tap Achievement app and added a text field. I am trying to use returnPress event with the TextField and I cannot make it work.

<TextField text="This is a test" returnKeyType="next" returnPress="{{ search }}" autocorrect="false"/>

If I attache the same function to a tap event of a button, it works:
<Button text="TAP" tap="{{ search }}" />

HelloWorldModel.prototype.search = function(){
        console.log("In search");
    }

I am on NativeScript 1.6 and I don't have a Mac to test this for iOS.

Activity

  1. self-assigned this
    on Mar 9, 2016
  2. added this to the 1.7.0 milestone on Mar 9, 2016
  3. Daxito commented on Mar 17, 2016

    @Daxito

    ok, fyi, you fixed the binding issue but now you broke the other way:
    returnPress="{{ onDone }}" <--- Now works in 1.7.0, thank you
    returnPress="onDone" <--- Does not work anymore :-(, it was ok in 1.6.2

  4. enchev commented on Mar 18, 2016

    @enchev
    Contributor

    Hey @Daxito,

    I've just tested this and everything seems to work as expected:

    <Page>
      <StackLayout>
        <TextField returnPress="press" />
      </StackLayout>
    </Page>
    exports.press = function(args) {
        console.log("HERE")
    }
  5. Daxito commented on Mar 18, 2016

    @Daxito

    @enchev
    Please take a look the attached sample app, it does not even work with binding.
    I added two text fields, one with a reference to a function in the code behind and the other one bound to the view model, after tapping the "Done" keyboard key nothing is displayed in the console, maybe I am missing something here?
    Using {N} 1.7.0 and using a real android device.

    Also, I did a test using {N} 1.6.2 (by uninstalling 1.7.0), and guess what, it worked for both scenarios! Let me know if you need more information.

    SampleApp.zip

  6. lock commented on Aug 29, 2019

    @lock

    This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

  7. locked and limited conversation to collaborators on Aug 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions