MCPcopy Index your code
hub / github.com/dozsolti/react-native-use-list

github.com/dozsolti/react-native-use-list @v0.2.1

Chat with this repo
repository ↗ · DeepWiki ↗ · release v0.2.1 ↗ · + Follow
28 symbols 79 edges 24 files 0 documented · 0%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Alt text

Expo supported npm GitHub issues npm

Features

  • :open_book: Pagination
  • Navigate to next or previous page.
  • Go to a specific page (via index).
  • Page looping
  • Item alignment
  • :repeat: Pull to Refresh
  • isRefreshing state
  • :bulb: Open for more. Request a feature in the issues tab.

Supported components

  • FlatList
  • VirtualizedList
  • SectionList

Installation

Using npm:

npm install --save react-native-use-list

Using yarn:

yarn add react-native-use-list

Quickstart - Pagination

import { useList } from 'react-native-use-list';


const ref = useRef(null);

const { pageIndex, nextPage, prevPage, indexController } = useList({ ref });

return (
  <>
    <FlatList
      ...
      ref={ref} // <---
      {...indexController} // <---
    />
    <View style={styles.footer}>
      <Button text="<" onPress={prevPage} />
      <Text style={styles.footerIndex}>{pageIndex}</Text>
      <Button text=">" onPress={nextPage} />
    </View>
  </>
);

Quickstart - Pull to refresh

import { useList } from 'react-native-use-list';


const [data, setData] = useState([...]);

const updateData = async () => {
  ...
  setData([...])
}

const { isRefreshing, refreshController } = useList({
  onRefresh: updateData // <---
});

return (
  <>
    <Text>isRefreshing: {isRefreshing}</Text>
    <FlatList
      data={data}
      ...
      {...refreshController} // <---
    />
  </>
);

Folders

/example/examples
    /Flatlist
      Pagination.tsx
      AdvancedPagination.tsx
      PullToRefresh.tsx
    /VirtualizedList
      Pagination.tsx
      PullToRefresh.tsx
    /SectionList
      Pagination.tsx
      PullToRefresh.tsx

/example/templates (coming soon)

Contributing

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

License

MIT


Made with create-react-native-library

Core symbols most depended-on inside this repo

Shape

Function 27
Enum 1

Languages

TypeScript100%

Modules by API surface

src/usePagination.tsx5 symbols
example/examples/VirtualizedList/PullToRefresh.tsx4 symbols
example/examples/VirtualizedList/Pagination.tsx3 symbols
src/utils.ts2 symbols
example/examples/SectionList/PullToRefresh.tsx2 symbols
example/examples/FlatList/PullToRefresh.tsx2 symbols
src/usePullToRefresh.tsx1 symbols
src/types.ts1 symbols
src/index.tsx1 symbols
example/src/utils/colors.tsx1 symbols
example/src/components/PaginationFooter.tsx1 symbols
example/src/components/ListItem.tsx1 symbols

For agents

$ claude mcp add react-native-use-list \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page