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-swipeable-views-v18

v1.1.27

Published

A replacement for react swipeable views for react 18

Downloads

659

Readme

React Swipeable Views v18

A replacement for react swipeable views for React 18.

Installation

npm install react-swipeable-views-v18

Usage

import React, { useRef } from 'react';
import {SwipeableViews} from 'react-swipeable-views';

const App = () => {
  const swipeableViewsRef = useRef(null);

  const handleSwipeForward = () => {
    swipeableViewsRef.current.swipeForward();
  };

  const handleSwipeBackward = () => {
    swipeableViewsRef.current.swipeBackward();
  };

  const handleResetPosition = () => {
    swipeableViewsRef.current.resetPosition();
  };

  return (
    <div>
      <SwipeableViews ref={swipeableViewsRef}>
        <div>View 1</div>
        <div>View 2</div>
        <div>View 3</div>
      </SwipeableViews>

      <button onClick={handleSwipeBackward}>Swipe Backward</button>
      <button onClick={handleSwipeForward}>Swipe Forward</button>
      <button onClick={handleResetPosition}>Reset Position</button>
    </div>
  );
};

export default App;

Features

  • Swipeable views for React 18.
  • Auto-swipe feature with customizable interval.
  • Manual navigation with forward and backward buttons.
  • Customizable button text.
  • Adjustable swipe threshold.
  • Looping behavior for infinite swiping.

Props

| Prop | Type | Default | Description | | --------------------- | -------- | ------- | ----------------------------------------------- | | autoSwipe | boolean | false | Enable or disable auto-swipe feature. | | autoSwipeInterval | number | 3000 | Auto-swipe interval in milliseconds. | | backButtonProps | object | | Props for the backward button. | | forwardButtonProps | object | | Props for the forward button. | | swipeThreshold | number | 50 | Drag threshold for swipe action. | | loop | boolean | true | Enable or disable looping behavior. | | hideBackButton | boolean | false | Hide the backward button. | | hideForwardButton | boolean | false | Hide the forward button. |

backButtonProps

| Prop | Type | Default | Description | | -------- | -------- | ------- | ------------------------------------ | | text | string | 'Back' | The text content of the back button. | | disabled | boolean | false | Disable the back button. |

forwardButtonProps

| Prop | Type | Default | Description | | -------- | -------- | ------- | ----------------------------------------- | | text | string | 'Next' | The text content of the forward button. | | disabled | boolean | false | Disable the forward button. |

Customization

You can customize the appearance and behavior of the SwipeableViews component by modifying the CSS classes or adding inline styles. The component uses the following CSS classes:

  • swipeable-container: The container element that wraps the swipeable views.
  • slider-container: The container for the views that is translated to achieve the swipe effect.
  • slide: The individual view elements.
  • pagination: The pagination dots for navigating between views.
  • dot: The individual dot element representing a view in the pagination.
  • dot.active: The active dot element indicating the current view.
  • .buttons-container > button: The forward and backward buttons.
  • .buttons-container > button.disabled: The disabled forward and backward buttons.
  • .buttons-container: The container for the forward and backward buttons. -.buttons-container > button:after: The text content of the forward and backward buttons.
  • .buttons-container > button:disabled:after: The text content of the disabled forward and backward buttons.
  • .buttons-container > button:active:after: The text content of the active forward and backward buttons.

You can override these classes or provide additional styles to achieve the desired look and feel.

Contributing

Contributions are welcome! If you find a bug or want to suggest an enhancement, please open an issue or submit a pull request.

License

This project is licensed under the MIT License.