Emre K.
Emre K.

Reputation: 2805

Display keyboard without text input in react native 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?

Upvotes: 6

Views: 6634

Answers (3)

Tin Nguyen
Tin Nguyen

Reputation: 81

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();
}

Upvotes: 4

Emre K.
Emre K.

Reputation: 2805

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

Upvotes: 6

Bill Patterson
Bill Patterson

Reputation: 2548

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.

Upvotes: 1

Related Questions