npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

indexed-section-list

v1.1.0

Published

A simple modular section list with index

Downloads

17

Readme

indexed-section-list

A simple modular section list with an index.

CountriesList

Installation

npm install --save indexed-section-list

Usage

import react from 'React';
import IndexedSectionList from 'indexed-section-list';

// See all props options in https://github.com/kfiri/indexed-section-list#props
function App() {
  return (
    <IndexedSectionList
      items={countryItems}
      indexItemHeight={20}
      style={styles.sectionList}
      wrapperStyle={styles.wrapper}
      indexWrapperStyle={styles.indexWrapper}
      showsVerticalScrollIndicator={false}
    />
  );
}

Props

Inherits SectionList props (omits sections, keyExtractor and onScrollToIndexFailed).
For implementing keyExtractor, see getSectionProps below.

| Name | Description | Type | Required | | -------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------- | -------- | | items | The items of the list, either strings or objects with titles. | (string | { title: string; key?: string | number; })[] | yes | | indexItemHeight | The height if an item in the index list (must be a constant). defaults to 25px. | number | no | | indexWrapperStyle | The style of the view that contains the index list. | ViewStyle | no | | indexTextStyle | The style of the view that contains the index text. | TextStyle | no | | scrollEfficiency | The method of the scroll (see Scroll Efficiency Functions). default is "revered". | "reversed" | "initial" | Function | no | | scrollOnSelect | Should the section list scroll to an index when onSelectIndex is fired? (default true). Set to false if you want to manually scroll the section list using onSelectIndex. | boolean | no | | titleKey | The title property name of the items. If the items are strings, this will be ignored. | string | no | | uniqueKey | The unique key property name of the items. If the items are strings, this will be ignored. | string | no | | wrapperStyle | The style of the view that contains both the section list and the index. | ViewStyle | no | | Functional Props | | onSelectIndex | A callback that is fired when the user selects an index. | Function | no | | getSectionProps | A methods that returns a section's properties (see Section Properties). Any change in this prop would cause the whole component to rerender (React.useCallback is recommended). | Function | no |

Ref

The ref prop behave exactly the same as the prop ref in SectionList props.

Scroll Efficiency Functions

Given the height of the index container and the height of the index list, return a number that resembles the correlation between the movement of the user's touch on the list and the scroll of the list.
Signature (containerHeight: number, listHeight: number) => number.

Built in methods-

reversed - Set the scroll of the indexes list to the opposite of the user's scroll direction, so when the user scroll from one edge of the container to the other, the list would complete a full scroll within the container in the opposite direction.

initial - The normal scroll. Scroll the indexes list with the user's scroll. simply returns 1.

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT