question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

focus a TextInput from another TextInput makes the keyboard jump

See original GitHub issue

Description

I have a simple View with two TextInputs in it. They both have a ref. The first TextInput has 'email' as ref and the second one has 'password'. The email field has returnKeyType='next' and onSubmitEditing={() => this.refs.password.focus() }. This works fine. I tap in the email, then tap the next button on the keyboard and the password field becomes active for editing.

The problem is that the keyboard jumps. While the transition of focus is happening, the keyboard starts hiding and showing again. This looks weird, and also causes some relayout to jump around.

What I expect to happen is that the keyboard stays put while the focus changes. Either by me specifying it, or (better) by detecting that we need the keyboard on the next view, so keep the keyboard shown.

Reproduction

https://rnplay.org/apps/3wvzeg In rnplay it doesnt jump because its slow, but try it on an ios device. Make a new react native app and paste the code, to see.

Solution

I guess check the next focus, and if its a TextInput, dont dismiss the keyboard? I dont know exactly.

Additional Information

  • React Native version: 0.38.0
  • Platform: iOS
  • Operating System: MacOS

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

4reactions
SPATAN18commented, Oct 4, 2017

Have you tried blurOnSubmit={false} ?

0reactions
jasbir-codeparkingcommented, May 21, 2018

Guys, Any Solution found ??

Read more comments on GitHub >

github_iconTop Results From Across the Web

Focus on the Next TextInput when Next Keyboard Button is ...
Indicating that there is another field to move to that they need to fill out. The onSubmitEditing is called when that button is...
Read more >
React Native: How to select the next TextInput after pressing ...
Set the second TextInput focus, when the previous TextInput 's onSubmitEditing is triggered. Try this. Adding a Ref to second TextInput
Read more >
How to make your React Native app respond gracefully when ...
Today I'll show you 3 different ways you can avoid the keyboard in React ... import React from 'react'; import { View, TextInput,...
Read more >
SetFocus function in Power Apps - Microsoft Learn
The SetFocus function gives a control the input focus. The user's keystrokes are then received by that control, allowing them to type into...
Read more >
Keyboard shortcut to jump out of text input box (i.e. to remove ...
Performing a tab before the ctrl+home can work sometimes, but not always, since the cursor could simply move to another input box. Pressing...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found