0.14.0 • Published 3 years ago

react-swipeable-views-utils v0.14.0

Weekly downloads
236,066
License
MIT
Repository
github
Last release
3 years ago

react-swipeable-views

A React component for swipeable views.

PackageVersionDownloadSize (kB gzipped)
react-swipeable-viewsnpm versionnpm downloads5.08
react-swipeable-views-utilsnpm versionnpm downloads3.52
react-swipeable-views-nativenpm versionnpm downloads?

Build Status Dependencies DevDependencies Donate TypeScript definitions on DefinitelyTyped Coverage Status

Installation

Browser

npm install --save react-swipeable-views

Native (experimental)

npm install --save react-swipeable-views-native

The problem solved

Check out the demos from a mobile device (real or emulated). It's tiny (<10 kB gzipped), it quickly renders the first slide, then lazy-loads the others.

Simple example

usage

Browser

import React from 'react';
import SwipeableViews from 'react-swipeable-views';

const styles = {
  slide: {
    padding: 15,
    minHeight: 100,
    color: '#fff',
  },
  slide1: {
    background: '#FEA900',
  },
  slide2: {
    background: '#B3DC4A',
  },
  slide3: {
    background: '#6AC0FF',
  },
};

const MyComponent = () => (
  <SwipeableViews>
    <div style={Object.assign({}, styles.slide, styles.slide1)}>
      slide n°1
    </div>
    <div style={Object.assign({}, styles.slide, styles.slide2)}>
      slide n°2
    </div>
    <div style={Object.assign({}, styles.slide, styles.slide3)}>
      slide n°3
    </div>
  </SwipeableViews>
);

export default MyComponent;

Native (experimental)

react-native support is experimental and I have no plan pushing it forward. I start to think that lower level abstraction to share the implementation between the platforms are more appropriate. We have two different implementations of the react-swipeable-views API.

import React from 'react';
import {
  StyleSheet,
  Text,
  View,
} from 'react-native';

import SwipeableViews from 'react-swipeable-views-native';
// There is another version using the scroll component instead of animated.
// I'm unsure which one give the best UX. Please give us some feedback.
// import SwipeableViews from 'react-swipeable-views-native/lib/SwipeableViews.scroll';

const styles = StyleSheet.create({
  slideContainer: {
    height: 100,
  },
  slide: {
    padding: 15,
    height: 100,
  },
  slide1: {
    backgroundColor: '#FEA900',
  },
  slide2: {
    backgroundColor: '#B3DC4A',
  },
  slide3: {
    backgroundColor: '#6AC0FF',
  },
  text: {
    color: '#fff',
    fontSize: 16,
  },
});

const MyComponent = () => (
  <SwipeableViews style={styles.slideContainer}>
    <View style={[styles.slide, styles.slide1]}>
      <Text style={styles.text}>
        slide n°1
      </Text>
    </View>
    <View style={[styles.slide, styles.slide2]}>
      <Text style={styles.text}>
        slide n°2
      </Text>
    </View>
    <View style={[styles.slide, styles.slide3]}>
      <Text style={styles.text}>
        slide n°3
      </Text>
    </View>
  </SwipeableViews>
);

export default MyComponent;

Who's using react-swipeable-views?

License

This project is licensed under the terms of the MIT license.

doc4k_react_ui@everything-registry/sub-chunk-2616pwa-storefrontqubryx-react-component@pagopa/pagopa-editorial-components@randy.tarampi/jsx@rart/25d0661d@robrkerr/react-swipeable-views@rohanprasad/react-swipeable-viewsstonex-ui@smart-link/corereact-1appreact-1app-forkedreact-airbnb-carouselradman-kitpotanica-componentsreact-windy-uireact18-swipeable-viewsreact-storefrontreact-swipeable-views-iss258react-swipeable-views-vertical-modifiedreact-swipeable-views-with-hooksreact-swipeable-views-workspacereact-swipeable-viewssparcs-react-airbnb-carousel@scvl/react-storefront@stream7/react-swipeable-views@xuhaojun/react-swipeable-viewsthe-templatesdk-motorv3@tecsinapse/carouseleskolare-uigatsby-theme-auth-appgatsby-theme-spudnikgatsby-theme-contentfulgatsby-theme-coverflowfuse-react-appfinal-radman-kitfinal-radman-kit-maryfinal-radman-kittmcbbs-clientmui-simplelos-design-systemlumen-cms-basematerial-ui-next-datepickermaterial-ui-next-pickersmetahkg-webmcbbs-client-scriptsjm-mrc-componentskekee@fintailui/reactup-material-ui-next-datepickerunc-react-creator@aceandtate/styled-uiui.webhook.yunplus.iouikit_by_amirjaliliui-kit-v3@backlight-dev/another-one.bricks-2htydw13pkxg0gsvc@backlight-dev/hdn-test.hdn-bricks@backlight-dev/cent-undress-o9ffc.bricks-l6ngliw7@backlight-dev/human-apple-pfrt9.bricks-l0gqrlz3@backlight-dev/icky-boys-h9rid.bricks-lglce3zu@valpunk/core@vito.falco/pagopa-editorial-components@hedviginsurance/react-swipeable-views@hdriel/mui-simple@gotamedia/fluffy@gdjiami/jm-mrc-components@didi-santa/didisam-moduleswebstudio-mui@backlight-dev/setbrain.ink-forego-vnavb.bricks-l5gkcnmk@backlight-dev/sillyleo.bricks-lccvkr2p@backlight-dev/soap-distribute-dux20.rjid@backlight-dev/rapid-sweater-1n8dt.bricks-l3yzvl9g@backlight-dev/power-drive-tgm7r.bricks-lo057i5n@backlight-dev/various-trouble-hjmth.bricks-l6ngliw7-fork-lgq24azv@backlight-dev/various-trouble-hjmth.bricks-lgq27cpj@backlight-dev/veil-steal-hej64.bricks-l7gtkkiy@huebert/react-swipeable-viewsdiabelb-material-ui-next-pickers@byhuz/huz-ui-castorcf-react-uicheckout-loadz@komemichael/komecodes@datatiger/react-swipeable-views@claimini/ui-components@bitspro/eventview-ui@craftercms/studio-ui@merchantlabs/react-carousel@merchantlabs/ui@metapair/ui@metahkg/web@mlabs.io/ui@nlabs/gothamjs@nlabs/material-ui-pickers@leuven2030/ui@levi-m/ide-kit@mahpooya/react-swipeable-views@nuragic/react-swipeable-views
0.14.0

3 years ago

0.14.0-alpha.0

4 years ago

0.13.9

4 years ago

0.13.7

4 years ago

0.13.6

4 years ago

0.13.5

4 years ago

0.13.4

4 years ago

0.13.3

5 years ago

0.13.1

5 years ago

0.13.0

6 years ago

0.12.18

6 years ago

0.12.17

6 years ago

0.12.16

6 years ago

0.12.14

6 years ago

0.12.13

6 years ago

0.12.11

6 years ago

0.12.9

6 years ago

0.12.8

7 years ago

0.12.7

7 years ago

0.12.5

7 years ago

0.12.0

7 years ago

0.11.1

7 years ago

0.11.0

7 years ago

0.10.1

7 years ago

0.10.0

7 years ago

0.9.2

7 years ago

0.9.1

7 years ago

0.9.0

7 years ago