Playground example: https://play.nativescript.org/?template=play-vue&id=FZ3GR1&v=4
I'm using Nativescript-Vue on an Android device, if you type a value into the first textfield and then press enter, focus is moved to the second textfield.
How do I stop this? I do not want the focus to change at all as I will be handling the Enter keypress. I can move the focus back but I would rather it didn't move at all.
I feel I'm missing something very obvious!?
Nativescript's TextField has a property called returnKeyType that sets the soft keyboard's return type. You can set it to done if you want to just close the keyboard.
<TextField returnKeyType="done"></TextField>
More information about that in the docs
Related
Is there any way to enable onFocus, onBlur etc. on Touchable-Elements on non-TVs devices?
The touchable elements event is not triggered, but the default feedback is visible when I use the physical keyboard.
I need simple dialogs on a Zebra mc3300. This device has a physical keyboard and when I show a dialog with a yes/no question, one button should have focus when the dialog becomes visible.
I'm not sure, maybe ref.current?.focus() works, when I press enter the key onPress is triggered, but i don't get any visible feedback which key has the focus. Only when I use the hardware button to switch to the next element and back again, the button became a different opacity.
Many thanks to you.
I wrapped my form in a <ScrollView> and I set my manifest android:windowSoftInputMode="adjustResize" (default of react native). Now when I manually focus a field with my finger touch event, and the field is covered by keyboard, it successfully scrolls to the field I just pressed.
However, if I pragmatically focus the next field (refToTextInput.focus()), it is not scrolling to that next field (focus does happen). I need the scroll to happen.
How can I trigger the adjustResize again, so it scrolls into view the next field I focused?
Manual focus - good
Here is what happens on manual focusing the password field, screencast:
Programmatic focus - bad - fail
However if my focus is in the "username" field and then I do this.refToPassword.focus() on the onSubmitEditing of the username field. Focus moves to the password input, and the keyboard doesnt flash (this is perfect I don't want the keyboard to flash). HOWEVER, the scroll view doesn't scroll to this field. Here is screencast of programmatic focus:
This is not the exact solution that I am proposing. However, you might consider this as a workaround.
You might consider hiding the keyboard programatically and showing the keyboard again on requesting focus programatically in the next EditText field. So the complete pseudo code for requesting the focus in next field will be something like.
public void requestFocusToNextField(View view) {
view.requestFocus();
hideKeyboard();
showKeyboard();
}
Hope that helps!
I need to create a pin entry. I want the numeric keypad to be visible always. The problem is, I cannot override hardware button behavior which dismisses the keyboard. OnBackButtonPressed isn't entered when the button is pressed for dismissing the keyboard. What can I do? ()
I think that the best option for you is use an specific keyboard.
Maybe you can use this Xamarin component https://components.xamarin.com/view/TestComponent
Most of the time (but not always), when I finish typing in a or and the soft keyboard hides, the view area is left raised with a black space on the bottom. Clicking, tilting or otherwise engaging the phone corrects the screen. However, user's first motion is usually pressing , but if you click submit it jumps down and you actually just click on the text area again. How do you stop this and get the screen to reset after the keyboard closes.
Take a look at you AndroidManifest.xml
http://developer.android.com/guide/topics/manifest/activity-element.html
I think you need to change android:configChanges.
I have the exact same problem what i did was handle hidekeyboard even in javascript and do something like window.scrollTo(0,0) or $("input[type=text],textarea").blur();
This will cause the the screen to get back to normal position
But there is just one problem when click from input field of type = text to a input field password it internally hide the keyboard which causes the hidekeyboard event to fire and scrolls the screen to top. This is the only side effect of this
Let me know if you find the solution for this
This is driving me crazy and I can't find the answer anywhere.
I have forms in my phonegap app. If the input type="text", the text keyboard pops up and "go" is displayed in the corner. When you click go, it submits the form. That all works as I would expect. But if I use input type="number", the number keyboard pops up and "next" is displayed in the corner. When you click next, if there is another input box before the button tag, it goes to that input. That's okay. . . not ideal, but makes sense. But if it is the last input field on the page, click "next" does nothing. It doesn't put focus on the button (even with tabindex) and it doesn't submit the form (ideal).
I'm using phonegap 1.3.0 and jquery 1.7 if any of that helps.
You can detect the next keyboard press by using the following bind in JQuery:
$('input').on('keydown', function(e){
if(e.which === 9) {
//your code here
}
});
The 'next' button emulates the tab keypress event on a keyboard, which is key code 9. Unfortunately, keypress and keyup events do not detect the next key event, so you need to bind it on keydown.
Hope that helps!
Okay, now I do have something that looks like an answer and quacks like an answer.
It's a horrible hack, and I am experiencing some side-effects at this point, but it's a small leap for mankind anyway.
Add an invisible text input to your form, which automatically submits the form as soon as it receives focus. Since it can only receive focus from the user pressing 'Next' or tabbing from the last number field, there should be a pretty solid logic in the user sequence.
<input type='text' style="opacity:0;" onfocus="javascript:$('#thisForm').submit();">
The side effects are:
the hidden form field will briefly be visible. You can avoid this by
using the onfocus handler to also re-focus on the number field that
was just left. Or you can set the width of the input to 0. The latter works best for me.
if you're using jQueryMobile like me, you're inviting horrible page transition ugliness on yourself, so if your form is in a dialog and submitting the form closes the dialog, be sure to set the dialog transition (when it is being opened from a previous screen) to 'none'.