Autoscroll to TextInput working partially when blurOnSubmit={false}
See original GitHub issueI noticed that if you use blurOnSubmit={false}, auto scroll to next focused input will be triggered only when its value is not empty.
Pseudo code example :
<KeyboardAwareScrollView>
<TextInput
ref='input1'
onSubmitEditing={this.input2.focus()}
blurOnSubmit={false}
returnKeyType='next' />
<View style={{ height: 500 }} /> /** Make the scroll **/
<TextInput ref='input2'/>
Tested on Android only.
Expected behavior :
- Write something on input1
- Click on Next button from keyboard
- input2 get the focus
- auto scroll to input2.
Current behavior :
- Write something on input1
- Click on Next button from keyboard
- input2 get the focus
- auto scroll to input2 not done
- Write something on input2
- Auto scroll to input2 done.
Seems related to the fact input1 does not blur() before to give focus.
If you ask why using blurOnSubmit=false: it avoids keyboard to close/reopen everytime we switch of input, on Android at least.
Issue Analytics
- State:
- Created 7 years ago
- Comments:13
Top Results From Across the Web
Auto scroll on tabbing to input leaving it partially hidden
My issue is when tabbing through each element. The tab order is correct, but when reaching the end of a horizontal row, it...
Read more >How to auto-scroll to a focused TextInput in a ScrollView
In this blog post I'll show you how to auto-scroll to a focused TextInput in a ScrollView . ProblemPermalink. What I'm working on...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Here’s the code. For simple, I remove the code about style. I implement next function by myself, so when I click next button, it will focus on next input. The library can work as expected if current input and next input are both in visible region. For example, click next button on input1, it will scroll to input2 automatically. But if the next input is not in visible region, i.e. user need to scroll to see it, auto-scroll will not work.
What worked for iOS, is calling blur on the existing input before calling focus on the next one. Haven’t tested android yet. This auto-focused inputs that are not viewable. Ex: