-
Notifications
You must be signed in to change notification settings - Fork 283
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
Enable cached layouts #319
Conversation
…h-list into enableCachedLayouts
@@ -156,7 +156,7 @@ describe("Twitter", () => { | |||
}); | |||
|
|||
const scrollAndRotate = async (id: string) => { | |||
await element(by.id(id)).scroll(500, "down"); | |||
await element(by.id(id)).scroll(240, "down"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When we scroll beyond our render window and change orientation FlashList may not render all items and use cached heights. This means that currently visible items can be different from FlatList. And given the layout is async there's some inconsistency. I've changed the scroll offset to be less than our renderAheadOffset of 250. Hopefully, this will resolve the issue.
This is a quick fix and full solution will come with #18
...cachedLayouts[i], | ||
// helps in updating the fixed dimension of layouts e.g, width in case of horizontal list | ||
// updating them in advance will make sure layout manager won't try to fit more items in the same row or column | ||
...layoutManager.getStyleOverridesForIndex(i), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Problem is that GridLayoutManager is based on WrapGridLayoutManager. After orientation change, if the existing widths of items are less than half of the list width then layout manager may try to fit more than one item in a row.
I'm correcting the layouts in advance to avoid this problem.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎩''d, looks good 👌
} | ||
|
||
// making sure extra keys don't make their way to layout unnecessarily | ||
expect(Object.keys(layout).length).toBe(6); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: maybe worth using jest's toStrictEqual
instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll discuss this with you separately
Description
resolves #299
During orientation change, we were ignoring previous layouts that our layout manager had. This PR makes use of existing values to improve user experience. When item sizes change due to orientation change there are two possible scenarios -
This PR also fixes the orientation change e2e test. More context inline.
Reviewers’ hat-rack 🎩
Screenshots or videos (if needed)
Screen.Recording.2022-04-27.at.13.42.11.mov
Checklist