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 🙏

© 2026 – Pkg Stats / Ryan Hefner

react-tiga-swiper

v1.0.10

Published

一个轻巧、好用的react swiper组件

Readme

react-tiga-swiper

a fantastic react swiper component

NPM JavaScript Style Guide

Install

npm install --save react-tiga-swiper

Usage

import React, { useRef, useState } from "react";
import Swiper,{SwipeRef} from 'react-tiga-swiper';
import 'react-tiga-swiper/dist/index.css';

function App() {
  const swiperRef = useRef<SwipeRef>(null);
  const [index, setIndex] = useState<any>();
  const swiperData = ["#99CCCC", "#FFCC99", "#FFCCCC", "#FFFFCC","#CCFFFF"];

  const swipeTo = () => {
    const swiperInstance = swiperRef.current;
    const currPage: string = index * 1 + '';
    swiperInstance?.swipeTo(parseInt(currPage, 10));
  };

  const prev = () => {
    const swiperInstance = swiperRef.current;
    swiperInstance?.prev();
  };

  const next = () => {
    const swiperInstance = swiperRef.current;
    swiperInstance?.next();
  };

  const onChange = (currPage: number, prevPage: number) => {
    console.log(currPage, prevPage);
  };

  return (
    <>
      <div style={{ marginBottom: 20 }}>
        <div className="manu-action">
          <input
            type="number"
            value={index}
            onChange={(e) => setIndex(e.target.value)}
          />
          <span className="btn" onClick={swipeTo}>swipe to (index start 0)</span>
        </div>
        <div className="more-action">
          <span className="btn" onClick={prev}>prev</span>
          <span className="btn" onClick={next}>next</span>
        </div>
      </div>
      <Swiper
        className="demo-swiper-container"
        autoPlay={3000}
        selectedIndex={0}
        showIndicators={true}
        indicator={null}
        dots={null}
        direction="vertical"
        loop={false}
        ref={swiperRef}
        onChange={onChange}
      >
        {swiperData.map((item: string, key) => (
          <div key={key} style={{backgroundColor: item}}>{key + 1}</div>
        ))}
      </Swiper>
    </>
  );
}

API

| attribute | desc | type | default | others | | ------------------ | -------------------------- | ------------------------------------- | ---------- | ----------------------------------------------- | | duration | Animation duration(ms) | number | 300 | | | autoPlay | Autoplay interval(ms) | number | 3000 | | | selectedIndex | index of initial swiper, start from 0 | number | 0 | | | direction | scroll direction | string | horizontal | 'vertical | | | loop | whether to enable loop | bool | true | | | touchable | whether to enable touchable | bool | true | | | showIndicators | whether to enable show indicators | bool | true | | | showDots | whether to enable show dots | bool | true | | | dots | bottom dots | React.ReactNode | null | | | indicator | indicator | React.ReactNode | null | | | style | style | React.CSSProperties | {} | | | className | className | string | '' | | | onChange | emitted when currage swipe changed | (current: number, prev: number): void | noop | |

Swipe Methods

| methods | desc | argument | desc | | ------- | ------------------ | ------ | ------------------------------ | | swipeTo | swipe to target index | index | start 0 | | prev | swipe to prev item | | | | next | swipe to next item | | |

License

MIT © xigua1994