New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ReturnKeyType Listener #713
Comments
This comment was marked as abuse.
This comment was marked as abuse.
👍 |
Hi, and how to use this new feature ? there are no next previous button on iOS keyboard, and how to add the listener for moving to next textfield for example ? Thanks |
I did some trial, and maybe the best to remove owner.dismissSoftInput() in the onFocusChange and in the onEditorAction (editable-text-base.android.js) since it automatically go to the next textedit if there is any and dismiss the keyboard when it is the only textedit (on android 5, I don't know in other android version) Havent dig in the iOS yet though |
Try this: <Page xmlns="http://www.nativescript.org/tns.xsd">
<StackLayout>
<TextField id="user-name" returnKeyType="next" returnPress="userNameReturnPress"/>
<TextField id="password" returnKeyType="go" returnPress="performLogin"/>
</StackLayout>
</Page> import pages = require("ui/page");
import textField = require("ui/text-field");
var passwordTextField: textField.TextField
export function pageLoaded(args: observable.EventData)
{
var page = <pages.Page>args.object;
passwordTextField = page.getViewById<textField.TextField>("password");
}
export function userNameReturnPress(args: observable.EventData)
{
passwordTextField.focus();
}
export function performLogin(args: observable.EventData)
{
// Some Code
} |
Thanks Peter, EDIT : Using Peter sample is working great, but I still have to modify the editable-text-base.android.js like above, since using the default file from tns_modules, the keyboard is ALWAYS dismissed even in the "next" setting |
This @PeterStaev solution does not work anymore after upgrade to 1.7, userNameReturnPress is never fired. Tested on real device. Also just to focus() textfield does not show the keyboard, annoying. |
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. |
Currently you can set a ReturnKeyType on a EditableTextBase. This is great, however it's really only cosmetic at this point as you can't listen to when the element "Next" or "Done" is pressed.
Would be good to:
Next
is pressed, listen and then be able to focus on another textFieldDone
is pressed, listen and then run some codeThe text was updated successfully, but these errors were encountered: