Skip to content
This repository has been archived by the owner on Oct 1, 2021. It is now read-only.
This repository has been archived by the owner on Oct 1, 2021. It is now read-only.

Bi-Directional Infinite Scrolling #148

Open
@daniel-nagy

Description

Some 1d collections need bi-directional infinite scrolling. A good example is a calendar that is initialized with today's date but allows the user to view past dates. Allowing negative indexes would be one way to implement this. Where 0 is today and -1 is yesterday and so on.

import { ItemSource } from 'virtual-scroller';
import { addDays, startOfToday } from 'date-fns';

new ItemSource({
  getLength(): number {
    return Infinity;
  },
  item(index: number): Date {
    return addDays(startOfToday(), index);
  }
});

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions