Socket
Socket
Sign inDemoInstall

react-native-page-swiper

Package Overview
Dependencies
0
Maintainers
2
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    react-native-page-swiper

Page Swiper component for React Native.


Version published
Maintainers
2
Install size
153 kB
Created

Readme

Source

react-native-page-swiper

Page Swiper component for React Native.

Getting Started

  • Installation
  • Basic Usage
  • Properties
  • Examples
  • Development

Installation

$ npm i react-native-page-swiper --save

Basic Usage

  • Install react-native first
$ npm i react-native -g
  • Initialization of a react-native project
$ react-native init myproject
  • Then, edit myproject/index.ios.js, like this:
var Swiper = require('react-native-page-swiper')
// es6
// import Swiper from 'react-native-page-swiper'

var React = require('react-native');
var {
  AppRegistry,
  StyleSheet,
  Text,
  View,
} = React;

var styles = StyleSheet.create({
  wrapper: {
  },
  slide1: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
    backgroundColor: '#9DD6EB',
  },
  slide2: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
    backgroundColor: '#97CAE5',
  },
  slide3: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
    backgroundColor: '#92BBD9',
  },
  text: {
    color: '#fff',
    fontSize: 30,
    fontWeight: 'bold',
  }
})

var swiper = React.createClass({
  render: function() {
    return (
      <Swiper style={styles.wrapper}>
        <View style={styles.slide1}>
          <Text style={styles.text}>Hello Swiper</Text>
        </View>
        
        <View style={styles.slide2}>
          <Text style={styles.text}>Beautiful</Text>
        </View>
        
        <View style={styles.slide3}>
          <Text style={styles.text}>And simple</Text>
        </View>
      </Swiper>
    )
  }
})

AppRegistry.registerComponent('swiper', () => swiper)

Properties

PropDefaultTypeDescription
index0numberIndex number of initial slide. Changing this number after the component loads will cause the slide to change.
pagertruebooleanShow pager.
onPageChangefunctionCallback when page changes.
activeDotColorbluestringCSS color of the dot for the current page.
threshold25numberThreshold before the swiper captures the pan responder

Examples

See code in examples.

Questions

Feel free to contact us or create an issue

Inspired by leecade/react-native-swiper & brentvatne/react-native-scrollable-tab-view.

Keywords

FAQs

Last updated on 18 Jun 2019

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc