New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FlatList scrollToIndex not able to scroll properly for indexes that is in stickyHeaderIndices #43587
Comments
|
|
UPDATE: tried latest version 0.73.6, and the issue still persists. |
|
same here, ended up using scrollToOffset or you can insert a dummy View component right before stickyHeader and use that index to scrollto. |
Description
Hi,
We are trying to upgrade our application from React Native 0.68 to current latest version of 0.73.4.
We have encountered a bug with FlatList, which was not an issue on RN version 0.68.
If we have items in the flatlist, that is defined in its
stickyHeaderIndices
, then we won't be able to use scrollToIndex to scroll to that sticky item. Instead, it will scroll you back to the top of the FlatList. Which is not an issue on RN 0.68.To better demo this bug, I have created a simple app. The following is the App.js file. No other dependencies needed.
As you can see from the code, each item in the flatlist is a textinput field, whenever user focus on any of the input field. We would like to have that text field scroll to the top position of the screen, to save space in the bottom half of the screen for displaying the keypad.
For any item that is not in the
stickyHeaderIndices
, scrollToIndex works as expected. But for any item that is instickyHeaderIndices
, it will scroll you to the top of the list, rather than scroll you to the correct position.For security reasons, my company laptop will not allow me to upload any video to public GitHub repos. But you can take the follow code and easily reproduce this issue.
Steps to reproduce
Use code provided in the description.
Start app.
Scroll through the list.
Tap on the sticky item's text input.
Scroll you back to the top of the list.
React Native Version
0.73.4
Affected Platforms
Runtime - Android, Runtime - iOS
Output of
npx react-native info
Stacktrace or Logs
Reproducer
code in description
Screenshots and Videos
For security reasons, my company laptop will not allow me to upload any video to public GitHub repos. But you can take the follow code and easily reproduce this issue.
The text was updated successfully, but these errors were encountered: