Need help with react-swipeable-views?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

oliviertassinari
3.7K Stars 400 Forks MIT License 588 Commits 63 Opened issues

Description

A React component for swipeable views. :snowflake:

Services available

!
?

Need anything else?

Contributors list

react-swipeable-views

A React component for swipeable views.

| Package | Version | Download | Size (kB gzipped) | |---------|:--------|:---------|:------------------| | react-swipeable-views | npm version | npm downloads | 5.08 | | react-swipeable-views-utils | npm version | npm downloads | 3.52 | | react-swipeable-views-native | npm version | npm downloads | ? |

Build Status Dependencies DevDependencies Donate TypeScript definitions on DefinitelyTyped Coverage Status

Documentation

Get started

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 = () => (

slide n°1
slide n°2
slide n°3
);

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 = () => ( slide n°1 slide n°2 slide n°3 );

export default MyComponent;

Who's using react-swipeable-views?

License

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

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.