You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
On android only, when user add a new TextInput inside a ScrollView, the scrollview is expected to scroll to the new added TextInput. It doesn't always work on android.
Note: I don't know the exact reproduction conditions, but it seems that the added item should be outside of the visible screen.
Steps to reproduce
Create a sample app with a list of inside a .
You should be able to append a new with a button to reproduce the issue.
When a new is added I expect the ScrollView scroll to the newly added
On android this is randomly working. On iOS, It always works.
I had the issue originally on 0.79, but I reproduce it on a react-native only sample on 0.81.0 (see linked repo)
Here is an extract of JSX code:
<ScrollView>
<!-- Append a new TextInput -->
<PressableonPress={()=>{setCount(c=>c+1);}}><Text>Press me</Text></Pressable>
<!-- display a list of textInput -->
{Array.from({length: count}).map((_,i)=>(<TextInputstyle={{height:50}}key={i}autoFocus={i===count-1}> <!-- ensure only the last item added has autofocus (this is also reproduced if autoFocus={true} )-->
Item {i+1}</TextInput>))}</ScrollView>
Description
On android only, when user add a new TextInput inside a ScrollView, the scrollview is expected to scroll to the new added TextInput. It doesn't always work on android.
Note: I don't know the exact reproduction conditions, but it seems that the added item should be outside of the visible screen.
Steps to reproduce
Create a sample app with a list of inside a .
You should be able to append a new with a button to reproduce the issue.
When a new is added I expect the ScrollView scroll to the newly added
On android this is randomly working. On iOS, It always works.
I had the issue originally on 0.79, but I reproduce it on a react-native only sample on 0.81.0 (see linked repo)
Here is an extract of JSX code:
React Native Version
0.81.0, but also 0.79.1
Affected Platforms
Runtime - Android
Output of
npx @react-native-community/cli infoStacktrace or Logs
MANDATORY Reproducer
https://github.com/freeboub/bug-react-native-Append-TextInput-In-ScrollView
Screenshots and Videos
You can see that the last added TextInput doesn't correctly focus on last item:
bugFocusTextInputScrollView.mp4