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

chore: example of non virtualized manual grid #51

Merged
merged 5 commits into from
Jan 30, 2024

Conversation

JulienIzz
Copy link
Contributor

New page in the example app with a non-virtualized grid

image

@JulienIzz JulienIzz force-pushed the chore/non-virtualized-grid branch from 1f50df4 to f1c7edb Compare January 30, 2024 15:05

const ShortProgramList = () => {
const navigation = useNavigation<NativeStackNavigationProp<RootStackParamList>>();
const programs = getPrograms().slice(0, 6);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couldn't you use a lodash.chunk() to transform a 1D list into a 2D list with rows of size 6, and iterate on the rows?
Here you hardcoded 3 ShortProgramList, it would be better to generalize a little bit ;) (we're lucky to have static data here but it's not a real world example)

);

export const NonVirtualizedGridPage = () => {
const programsList = chunk(getPrograms(), 7);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could extract this into a local constant in the file to make it more obvious 😁

Suggested change
const programsList = chunk(getPrograms(), 7);
const programsList = chunk(getPrograms(), ROW_SIZE);

@pierpo pierpo merged commit 7b16ff3 into main Jan 30, 2024
1 check passed
@pierpo pierpo deleted the chore/non-virtualized-grid branch January 30, 2024 16:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants