Display keyboard without text input in react native iOS - ios

I want to keep the keyboard displayed at the bottom by default without using a text input which the user needs to tap.
I need to keep the keyboard at the bottom at all times.
Then I need to listen to the events of the keyboard.
How can I do this?

The workaround I implemented was adding an invisible text box somewhere on the screen and then set it as focused manually.

Just in case someone else might stumble upon this, OP's self answer works. In order to set focus manually, you'll need to get the ref to the hidden input.
<TextInput
ref={input => (this.textinput = input)}
style={{ display: 'none' }}
/>
then elsewhere in the code, you focus manually by
if (this.textinput) {
this.textinput.focus();
}

This answer is way too late to do the OP any good, but for others:
You can't do this. In iOS, the operating system, keyboards simply don't/can't work this way. iOS never shows a keyboard without an active text input focus, and there is no way for even a native iOS app to override this OS-level behavior. The OS itself prevents this from happening.

Related

iPhone Safari keyboard to say next vs go

I have a website that is optimized to work on iOS devices. But the problem is that the keyboard always says Go as user fills the form. How do I get the keyboard to say Next until the last entry on the form, where it should say Go? Or alternatively, how do I disable the Enter button entirely?
Again, this is a website. It works everywhere websites work: in browsers. Except I have having this particular problem in Safari on mobile devices.
while changing the input type gives you some control of the keyboard layout the return key label in IOS cannot be customized.
Other than changing it to say Search there are no customizations available. You can disable the functionality of the button using something like this injQuery:
$("#myForm input").live("keyup", function(evt) {
if (evt.keyCode === 13) {
$("#myForm").trigger("submit");
}
});

keyboard language button in UITextView

Just noticed that in UITextView keyboard comes without change language button, unlike in UITextField. Why Apple removed this button from UITextView keyboard? Is there any way to enable this button? I want people to be able to write notes on any keyboard language added in phone settings.
EDITED: Maybe it will help somebody in the future. Just noticed that I set keyboard type to UIKeyboardTypeAlphabet and this option eliminates language button. Closing this question.
P.S. I have 3 languages enabled in test iPhone.
You are completely wrong. there is no difference in UIKeyboard in iOS whatsoever. It only depends on what keyboard types you use.
UIKeyboardTypeDefault and UIKeyboardTypeEmailAddress and UIKeyboardTypeTwitter all have those.
You set it like this:
txtField.keyboardType = UIKeyboardTypeTwitter;
UIKeyboardTypeDefault is obviously the default one for any UITextView or UITextField in iOS.
For anyone have this problem even when using UIKeyboardTypeDefault on a UITextView, go into the storyboard and make sure "Secure Text Entry" is unchecked. After unchecking this, the keyboard selector will return as well as the quick type keyboard.

PhoneGap IOS Keyboard Done Key Event

I'm using JQuery Mobile within a PhoneGap IOS App. I'm currently successfully capturing the IOS Keyboard return within a search key as follows.
JS
function blah()
{
if(window.event.keyCode == 13 )
{ do something }
}
HTML
<input type="search" id="searchBox" value="" onblur="dothis()" data-inline="true" onKeyPress="blah();" />
I would like to capture the 'Done' key on the keyboard as well. I cant seem to find any information on this.
Thanks.
Unfortunately, pressing the "Done" key does not fire a keyCode event. So, I can't seem to find a way to detect it either.
I think the only option is to detect the "blur" event on your field. If the event occurs, then fire whatever action you need. Of course, this is only useful if you have a single field. If you have more than one field, using "blur" to be the equivalent of "Go" or "Submit" is useless.
Let us know if you found a better workaround.
I've suggested using the blur event in my original answer. However, I think a better idea is simply to listen for the keyboard hiding - which will happen after the "Done" button is pressed.
window.addEventListener('keyboardDidHide', function () {
// Describe your logic which will be run each time keyboard is closed.
});
https://github.com/cjpearson/cordova-plugin-keyboard#keyboarddidhide
Also, be sure the deregister this listener after you've done whatever you need to do after the keyboard hides. Otherwise, it will fire every time the keyboard hides in other parts of your app.

iOS 5: Input placeholder doesn't clear on focus, only on input, bug or feature?

Playing around with my web application in the iOS 5 simulator, I noticed that iOS 5 doesn't clear placeholders immediately, only after the first input. On all other version of iOS as well as on all desktop browsers, the placeholder is immediately cleared when the user focuses on the input. I don't have access to an iOS 5 device right now but I highly doubt this is a simulator error.
Is this a bug or intended? Oddly I only found one reference to this behavior on the net, right here on SO: clearing input placeholder in iOS5
Is there a workaround for this problem? It's quite frustrating for the user when the placeholder doesn't clear immediately.
I think you are mistaken - iOS text fields always behave this way.
I don't see why this would be frustrating for the user. If anything it is helpful that the helper text stays visible until they begin typing, in case they missed it before selecting the field.
What may be confusing you is that iOS fields have a separate optional behaviour where the text is cleared when the field is selected, but note that this is the actual text that clears, not the placeholder text.
Placeholder text is the light grey text, and this always appears until the user types something.
Content text (usually black) sometimes clears when the field is focussed and sometimes doesn't, depending on how the UITextField was configured.
The jQuery solution in the SO question you linked to should let you replicate any variant of this functionality that you desire, but personally I'd advise sticking with the iOS convention of not clearing helper text until the user types something.
It is not a bug, it is a feature. You can use delegate methods to clear placeholder. (UITextFieldDelegate http://developer.apple.com/library/ios/#documentation/uikit/reference/UITextFieldDelegate_Protocol/UITextFieldDelegate/UITextFieldDelegate.html)
- (void)textFieldDidBeginEditing:(UITextField *)textField
{
[textField setPlaceholder:#""];
}
adn you should control its emptiness after finish editing.
- (void)textFieldDidEndEditing:(UITextField *)textField
{
if ([textField.text isEqualToString:#""])
[textField setPlaceholder:#"Placeholder Text"];
}

How to set primefaces virtual keyboard?

Is there any option for primefaces keyboard component to accept numbers form both keyboard and mouse?
I'm using primefaces keyboard component with keypadonly option to enter numbers only.
I should be able to enter numbers either from physical keyboard or virtual keyboard.
If keypadonly is set to true, I'm not able to enter data using physical keyboard.
I don't have this problem if keypadonly only attribute is not used. Did someone experience this problem? If so please let me know how to handle it.
It seems to be intentional, if keypadonly is set to true a javascript will set the input to readonly="readonly".
You may try to use a custom layout (see http://www.primefaces.org/showcase/ui/keyboard.jsf ).
This migth work:
<p:keyboard value="#{keyboardBean.value}"
layout="custom"
layoutTemplate="123-close,456-clear,789-back,0"/>
or removing the readonly attribute with a custom javascript.

Resources