0.14.0 • Published 3 years ago

react-swipeable-views v0.14.0

Weekly downloads
209,958
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.

customer-query-front-endcozy-ui@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-kitengageme-uieskolare-uifinal-radman-kittfinal-radman-kitfinal-radman-kit-maryflipper-plugin-react-native-recoilfoh5fancy-weui-boxexcelym-core-uifuse-react-appfront-mdprjk-ui-corejm-mrc-componentsjmap-app-jsjmap-documentsjmap-donneesclimatiques-jsjmap-js-appjmap-infortu-jskekeekatejsintegrationengineuijazasoftj2mvc-react-uploadkokolibkuky-cmskuky-dashboardhbss-rydelog-screenhomemaster-jslibhippo-fwgatsby-theme-coverflowgatsby-theme-spudnikgatsby-theme-contentfulgatsby-theme-contentful-gallerygatsby-theme-material-foundrygk-page-builderglenns-meathandling-dashboardgatsby-theme-auth-appgh-did-app-web3jumbo-reactjingoal-silkivory-app-theme-woronaih-portaliis-hubhh-cloudmaterial-dashboard-reactmaterial-dashboard-react-darkm-dash-uinext-bottom-sheetnewdavellirnbugs-image-upload-ossneighbourhoodmaterial-ui-next-datepickermaterial-ui-next-pickersmaterial-kit-react-packagelumen-cms-baselos-design-systemloopring-weblpdesignsystemmcbbs-client
0.14.0

3 years ago

0.14.0-alpha.0

4 years ago

0.13.9

4 years ago

0.13.8

4 years ago

0.13.7

4 years ago

0.13.6

4 years ago

0.13.5-rc

4 years ago

0.13.5

4 years ago

0.13.4

4 years ago

0.13.4-rc.2

4 years ago

0.13.4-rc.1

4 years ago

0.13.4-rc.0

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.15

6 years ago

0.12.14

6 years ago

0.12.13

6 years ago

0.12.12

6 years ago

0.12.11

6 years ago

0.12.10

6 years ago

0.12.9

6 years ago

0.12.8

7 years ago

0.12.7

7 years ago

0.12.6

7 years ago

0.12.5

7 years ago

0.12.4

7 years ago

0.12.3

7 years ago

0.12.2

7 years ago

0.12.1

7 years ago

0.12.0

7 years ago

0.11.2

7 years ago

0.11.1

7 years ago

0.11.0

7 years ago

0.10.8

7 years ago

0.10.7

7 years ago

0.10.6

7 years ago

0.10.5

7 years ago

0.10.4

7 years ago

0.10.3

7 years ago

0.10.2

7 years ago

0.10.1

7 years ago

0.10.0

7 years ago

0.9.3

7 years ago

0.9.2

7 years ago

0.9.1

7 years ago

0.9.0

7 years ago

0.8.3

7 years ago

0.8.1

7 years ago

0.8.0

7 years ago

0.7.11

7 years ago

0.7.10

8 years ago

0.7.9

8 years ago

0.7.8

8 years ago

0.7.7

8 years ago

0.7.6

8 years ago

0.7.5

8 years ago

0.7.4

8 years ago

0.7.3

8 years ago

0.7.2

8 years ago

0.7.1

8 years ago

0.7.0

8 years ago

0.6.5

8 years ago

0.6.4

8 years ago

0.6.3

8 years ago

0.6.2

8 years ago

0.6.1

8 years ago

0.6.0

8 years ago

0.5.4

8 years ago

0.5.3

8 years ago

0.5.2

8 years ago

0.5.1

8 years ago

0.5.0

8 years ago

0.4.7

8 years ago

0.4.6

8 years ago

0.4.5

8 years ago

0.4.4

8 years ago

0.4.3

8 years ago

0.4.2

8 years ago

0.4.1

8 years ago

0.4.0

8 years ago

0.3.6

8 years ago

0.3.5

8 years ago

0.3.4

8 years ago

0.3.3

8 years ago

0.3.2

8 years ago

0.3.1

8 years ago

0.3.0

8 years ago

0.2.3

9 years ago

0.2.2

9 years ago

0.2.1

9 years ago

0.2.0

9 years ago

0.1.6

9 years ago

0.1.5

9 years ago

0.1.4

9 years ago

0.1.3

9 years ago

0.1.2

9 years ago

0.1.1

9 years ago

0.1.0

9 years ago