bvaughn / react-virtualized

React components for efficiently rendering large lists and tabular data
http://bvaughn.github.io/react-virtualized/
MIT License
26.1k stars 3.05k forks source link

Amji fixes #1827

Open meetamjadsaeed opened 6 months ago

meetamjadsaeed commented 6 months ago

Before submitting a pull request, please complete the following checklist:

Checklist

Description

Add onClick to every list item.

Changes Made

I have added the onClick handler in source\List\List.js. With this change, users can add their own onclick handler to each item based on its index. I have also made it optional, so if the user has not added a handler, it will not throw any errors.

How To use


function MyComponent() {
  const handleItemClick = (index) => {
    console.log(`Clicked on item at index ${index}`);
    // Additional click handling logic...
  };

  return (
    <List
      // ... (other props)
      onClick={handleItemClick}
    />
  );
}

Related Issue

This issue is related to #1734.

Screenshots (if applicable)

image

Closing Note

Thank the maintainers and contributors for their time.

Thank you for reviewing this Pull Request!