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

[docs] Add an example demonstrating scrollbar integration with React Virtuoso #938

Closed
cheton opened this issue Oct 16, 2024 · 1 comment
Closed

Comments

@cheton
Copy link
Member

cheton commented Oct 16, 2024

React Virtuoso: https://github.com/petyosi/react-virtuoso

import React from "react";
import { Virtuoso } from "react-virtuoso";
import CustomScrollbar from "./CustomScrollbar";

export default function App() {
  return (
    <Virtuoso
      components={{
        Scroller: CustomScrollbar,
      }}
      style={{ height: 400 }}
      totalCount={200}
      itemContent={(index) => <div>Item {index}</div>}
    />
  );
};

CustomScrollbar.jsx:

import { Scrollbar } from "@tonic-ui/react";
import React from "react";

const CustomScrollbar = React.forwardRef((
  {
    style,
    ...rest
   },
  ref,
) => {
  const { height } = style;
  return (
    <Scrollbar
      scrollViewRef={ref}
      height={height}
      {...rest}
    />
  );
});

export default CustomScrollbar;
@cheton cheton closed this as completed Oct 17, 2024
@cheton
Copy link
Member Author

cheton commented Oct 17, 2024

Added in #939

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

No branches or pull requests

1 participant