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

react-native-pagination-ui

v1.0.4

Published

A customizable pagination component for React Native that supports page grouping and custom styling. Ideal for projects that need intuitive navigation across multiple pages.

Downloads

4

Readme

Pagination Component for React Native

A customizable pagination component for React Native that supports page grouping and custom styling. Ideal for projects that need intuitive navigation across multiple pages.

Installation

You can install the component via npm:

npm install react-native-pagination-ui

Dependencies

npm i @expo/vector-icons

Usage

Import the Pagination component and use it in your React Native project:

import { useState } from 'react';
import { View } from 'react-native';
import { Pagination } from 'react-native-pagination-ui';

const App = () => {
  const [currentPage, setCurrentPage] = useState(1);

  const handlePageChange = (page: number) => {
    setCurrentPage(page);
    // Add your logic for handling page change
  };

  return (
    <View>
      <Pagination
        total={20}
        initialPage={currentPage}
        handlePageChange={handlePageChange}
        selectedItemColor='primary'
        defaultItemColor='default'
        itemSizes='lg'
      />
    </View>
  );
};

export default App;

Logo

Props

| Prop | Type | Default | Description | | ------------------- | ------------------------ | ----------------------------- | ----------------------------------------------------------------- | | total | number | Required | The total number of pages. | | initialPage | number | Required | The initial page to display. | | handlePageChange | (page: number) => void | Required | Callback function triggered when the page is changed. | | selectedItemColor | PaginationColorsEnum | primary | The color for the selected page. | | defaultItemColor | PaginationColorsEnum | default | The color for the unselected pages. | | itemSizes | PaginationSizesEnum | lg | Size of the pagination items (small, medium, large, extra-large). | | iconProps | IconPropsInterface | { size: 18, color: '#000' } | Properties for the pagination icons (ellipses). |


Customization

Sizes

You can customize the size of the pagination buttons using the itemSizes prop. Available sizes:

  • sm: Small
  • md: Medium
  • lg: Large (default)
  • xl: Extra-large

Colors

Choose from predefined colors by using the selectedItemColor and defaultItemColor props:

  • primary: Blue
  • secondary: Purple
  • success: Green
  • danger: Red
  • warning: Orange
  • info: Cyan
  • default: Grey
  • light: White

Icon Props

You can pass custom properties to the icon using the iconProps prop, such as:

iconProps={{ size: 20, color: '#FF0000' }}

Example

<Pagination
  total={50}
  initialPage={1}
  handlePageChange={(page) => console.log('Current Page:', page)}
  selectedItemColor='success'
  defaultItemColor='light'
  itemSizes='md'
  iconProps={{ size: 16, color: '#123456' }}
/>

Keywords

  • react-native
  • pagination
  • ui
  • component
  • react
  • native
  • expo

Repository

https://github.com/Diego-Fdez/react-native-pagination-ui

Contributors

  • @Diego-Fdez

License

This project is licensed under the MIT License.