-
Notifications
You must be signed in to change notification settings - Fork 288
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
FlashList errs when rotating the device with dynamic numColumns
and ListEmptyComponent
#1032
Comments
numColumns
and ListEmptyComponent
numColumns
and ListEmptyComponent
This only happens when I use a And thanks for this project by the way! |
i got same issue pls help me way for resolve it |
Same issue here |
I don't reproduce anymore with FlashList 1.6.3 and react-native 0.73.6 |
I was able to fix the issue by changing the // change the key when the list is empty & numCols changes
const listKey = data?.length === 0 ? `empty-list-${numCols}-cols` : "normal-list"
// be sure to include key={listKey} when rendering
return (
<FlashList
key={listKey}
ListEmptyComponent={
<MyEmptyComponent />
}
numCols={numCols}
data={data}
/>
) It's a bit hacky, but it works 🤷♂ |
When using <FlatList> with dynamic numColumns I get the error:
However, this error doesn't occur in FlashList. Regarding FlashList, I get the same error of "Cannot read property 'y' of undefined" when the list is empty and numColumns is changed (e.g. the devices is rotated while still fetching the data). |
Current behavior
I have the following code:
I run it on an android real tablet device, specifically a Galaxy Tab S5e (SM-T720)
I rotate the device.
There is an error displayed when I do it:
I would expect to have the view properly rotated instead.
To Reproduce
Use react-native to initialize an empty project, add flashlist to it, and replace the default
App
code by the one I posted above.Platform:
It also occurs on iPad (be sure to display the app in the whole screen, https://stackoverflow.com/questions/74907554/ipad-pro-not-showing-full-screen-content-in-react-native-xcode-14-0-1)
Environment
I'm on
@shopify/flash-list": "^1.6.3"
The text was updated successfully, but these errors were encountered: