0.14.0 • Published 4 years ago

react-swipeable-views v0.14.0

Weekly downloads
209,958
License
MIT
Repository
github
Last release
4 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.

customer-query-front-end@avocad0/sdk@igloo_cloud/shared-uitarnet-jumbo-reactminiestorpe@hacktion/test-library@alyz.tech/alyz_js_sdkclarity-toolsdevelapp-regional-frontendoneonone-ui-libcfp-app-skapacfp-app-testcfa-test1-skapabyevolutionkhodroinja-ui-coremewdavellircfppzq-reactuifriday.deaudio-tour-hamadarupertong-react-componentsscanning-portalmaccha.managerparleezy-ui-librarygatsby-theme-eveemagatsby-theme-eveema-dcgatsby-theme-eveema-testspatest-widget-prodtemp-connect-ui-acceltest-connect-bundlerdoc4k_react_uimn-environment@cloudhub-ux/corecra-template-pwa-starter@everything-registry/sub-chunk-2616cloud-air-components@solussaude/core@solussaude/reactjs-ui-corereact-publishable-component-sunil@ascendware/ui-kittaovetarnet-uitemppppppppptest-framework-shreyastest-i3-package2waleed-avocadowaleed-avocado-2webstudio-muiwfacewow-it-workswservice-adminwservice-partnerstonex-uistonelighttestttbuildbabeltestttbuildbabelfinaltestttbuildbabelfinal2testtbredcrumtest-widget-knv-1test-widget-knv-2testconnecttttttttswypeswipable-views-with-paginationswp-ui-kitthe-templateveem-web-sdkvaluex-react-app@donjerson2/prietocomponents@draftcraft/cards@drivekyte/ui-components@drivekyte/web-components@craftercms/studio-uij2mvc-react-uploadivory-app-theme-woronajmap-documentsjmap-donneesclimatiques-jsjmap-js-appjmap-app-jsjingoal-silkjk-ui-corejm-mrc-componentsjazasoftkatejsjumbo-reactkekeewonder-ui@hiab/blocks@hiab/modulessq-componentsstagelightsuguisparcs-react-airbnb-carouseltimeline_pkguikit_by_amirjaliliui-router-react-digestui-kit-v3ui.webhook.yunplus.iotour-guide-shared-libraryticketmelon-webtranslation-helps-patch
0.14.0

4 years ago

0.14.0-alpha.0

5 years ago

0.13.9

5 years ago

0.13.8

5 years ago

0.13.7

5 years ago

0.13.6

5 years ago

0.13.5-rc

5 years ago

0.13.5

5 years ago

0.13.4

5 years ago

0.13.4-rc.2

5 years ago

0.13.4-rc.1

5 years ago

0.13.4-rc.0

5 years ago

0.13.3

6 years ago

0.13.1

6 years ago

0.13.0

7 years ago

0.12.18

7 years ago

0.12.17

7 years ago

0.12.16

7 years ago

0.12.15

7 years ago

0.12.14

7 years ago

0.12.13

7 years ago

0.12.12

8 years ago

0.12.11

8 years ago

0.12.10

8 years ago

0.12.9

8 years ago

0.12.8

8 years ago

0.12.7

8 years ago

0.12.6

8 years ago

0.12.5

8 years ago

0.12.4

8 years ago

0.12.3

8 years ago

0.12.2

8 years ago

0.12.1

8 years ago

0.12.0

8 years ago

0.11.2

8 years ago

0.11.1

8 years ago

0.11.0

8 years ago

0.10.8

8 years ago

0.10.7

8 years ago

0.10.6

8 years ago

0.10.5

8 years ago

0.10.4

8 years ago

0.10.3

8 years ago

0.10.2

8 years ago

0.10.1

8 years ago

0.10.0

8 years ago

0.9.3

8 years ago

0.9.2

8 years ago

0.9.1

8 years ago

0.9.0

8 years ago

0.8.3

9 years ago

0.8.1

9 years ago

0.8.0

9 years ago

0.7.11

9 years ago

0.7.10

9 years ago

0.7.9

9 years ago

0.7.8

9 years ago

0.7.7

9 years ago

0.7.6

9 years ago

0.7.5

9 years ago

0.7.4

9 years ago

0.7.3

9 years ago

0.7.2

9 years ago

0.7.1

9 years ago

0.7.0

9 years ago

0.6.5

9 years ago

0.6.4

9 years ago

0.6.3

9 years ago

0.6.2

9 years ago

0.6.1

9 years ago

0.6.0

9 years ago

0.5.4

9 years ago

0.5.3

9 years ago

0.5.2

9 years ago

0.5.1

9 years ago

0.5.0

9 years ago

0.4.7

9 years ago

0.4.6

9 years ago

0.4.5

9 years ago

0.4.4

9 years ago

0.4.3

9 years ago

0.4.2

9 years ago

0.4.1

9 years ago

0.4.0

9 years ago

0.3.6

9 years ago

0.3.5

10 years ago

0.3.4

10 years ago

0.3.3

10 years ago

0.3.2

10 years ago

0.3.1

10 years ago

0.3.0

10 years ago

0.2.3

10 years ago

0.2.2

10 years ago

0.2.1

10 years ago

0.2.0

10 years ago

0.1.6

10 years ago

0.1.5

10 years ago

0.1.4

10 years ago

0.1.3

10 years ago

0.1.2

10 years ago

0.1.1

10 years ago

0.1.0

10 years ago