1.0.2 • Published 9 months ago

ino-listview v1.0.2

Weekly downloads
-
License
MIT
Repository
-
Last release
9 months ago

ino-listview

A customizable ListView component for React applications.

Installation

Install the package using npm:

## Usage

Here's a basic example of how to use the ListView component:

import React from "react";
import { ListView } from "ino-listview";
const data = [
  { id: 1, name: "Item 1" },
  { id: 2, name: "Item 2" },
  { id: 3, name: "Item 3" },
];
const MyComponent = () => {
  const renderItem = ({ item, index, isActive }) => (
    <div className={isActive ? "active" : ""}>{item.name}</div>
  );
  return (
    <ListView
      itemsCount={10}
      itemsTotal={data.length}
      itemWidth={10}
      itemHeight={5}
      renderItem={renderItem}
      data={data}
    />
  );
};

Props

The ListView component accepts the following props:

PropTypeDefaultDescription
idstring-Unique identifier for the list
uniqueKeystring'list-'Prefix for item keys
listType'horizontal' | 'vertical''horizontal'Orientation of the list
nativeControlebooleanfalseEnable native keyboard control
debouncenumber300Debounce time for keyboard events (ms)
itemsCountnumber-Number of items visible at once
itemsTotalnumber-Total number of items in the list
buffernumber-Number of extra items to render for smooth scrolling
itemWidthnumber-Width of each item (in rem)
itemHeightnumber-Height of each item (in rem)
isActiveboolean-Whether the list is currently active
initialActiveIndexnumber0Initial active item index
onBackScrollIndexnumbernullIndex to scroll to on 'back' action
startScrollIndexnumber0Initial scroll position
direction'ltr' | 'rtl''ltr'Text direction
onMouseEnterfunction() => {}Callback when mouse enters an item
onUpfunction() => {}Callback for 'up' action
onDownfunction() => {}Callback for 'down' action
onLeftfunction() => {}Callback for 'left' action
onRightfunction() => {}Callback for 'right' action
onBackfunction() => {}Callback for 'back' action
renderItemfunction-Function to render each item
dataarray-Array of data to render

Customization

You can customize the appearance of the ListView by styling the following classes:

  • .scroll-view-parent: The parent container of the list
  • .scroll-view: The scrollable container
  • .list-view: Applied to horizontal lists

License

This project is licensed under the MIT License.

1.0.2

9 months ago

1.0.1

9 months ago