D
D
Damir Balgabaev2020-03-10 05:50:54
Android
Damir Balgabaev, 2020-03-10 05:50:54

How to make TextInput always in focus?

The page has a TextInput that works like a calculator. It is necessary that it be automatically in focus,
when entering the page and in the future, the keyboard does not disappear.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Alexander, 2020-03-10
@NeiroNx

On a loss of focus event, set focus again.

A
Alexander Cheremkhin, 2020-03-10
@Che603000

autofocus
react autofocus

R
Roman Alexandrovich, 2020-03-10
@RomReed

Well, firstly, TextInput has a property https://reactnative.dev/docs/textinput#autofocus
and secondly, there is a method https://reactnative.dev/docs/textinput#onblur for which you can hook on and use ref to focus on your field . I think in this way the user will always be in the focus of the input. But you must understand that he will not even be able to press the button.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question