Skip to content
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

scrollToEnd throws an error when called after a list goes from >0 to 0 items #1295

Open
stevengoldberg opened this issue Jul 31, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@stevengoldberg
Copy link

stevengoldberg commented Jul 31, 2024

Current behavior

When a re-render causes the FlashList's data array to change from from >0 length to 0 length, calling scrollToEnd throws:

TypeError: Cannot read properties of undefined (reading 'x')
    at t.getOffsetForIndex (@shopify/flash.list:3:11758)
    at t.scrollToIndex (@shopify/flash.list:3:21974)
    at t.scrollToEnd (@shopify/flash.list:3:22939)
    at t.scrollToEnd (@shopify/flash.list:3:56165)

Expected behavior

scrollToEnd should have no effect when the list is empty.

To Reproduce

Repro here

Press the "toggle data" to set state and produce the error.

Platform:

  • [ x ] iOS
  • [ x ] Android

Environment

1.6.4

Tasks

No tasks being tracked yet.
@stevengoldberg stevengoldberg added the bug Something isn't working label Jul 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant