Search code examples
react-nativekeyboardreact-native-textinput

How can I keep my on-screen keyboard open after tapping submit?


I am using React Native and TextInput component to search products. When tapping on the input, keyboard opens, I write something and then press submit. Keyboard closes. I want it to stay open until i explicitly tell it to close so a user could keep searching and adding products to the list. Something similar to an iOS Notes app.

Everything related to this topic I was able to find talked about having some scrollable view be the problem, but my input in the screen header is wrapped with regular View. I even tried wrapping the input component with ScrollableView to try the keyboardShouldPersistTaps="handled" but this didn't work either.

Currently the only way i got this to work was to add a timeout to a function that focuses on the input after submitting, but this makes the keyboard dismiss and reappear.

How can I keep the keyboard open until the user decides to dismiss it?


Solution

  • Have you tried setting blur on submit to false? https://reactnative.dev/docs/textinput#bluronsubmit