Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-native-pages

Package Overview
Dependencies
Maintainers
1
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-pages

Easy to use page view component

  • 0.9.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
567
decreased by-25.59%
Maintainers
1
Weekly downloads
 
Created
Source

react-native-pages

npm license travis codeclimate

Easy to use page view component for React Native

example

Features

  • Easy to use
  • Consistent look and feel on iOS and Android
  • Landscape and portrait orientation support
  • Parallax and complex animation support
  • Animated page indicator
  • Configurable scroll direction
  • Configurable page indicator position, color and opacity
  • RTL support
  • Pure javascript implementation

Installation

npm install --save react-native-pages

Usage

import React, { Component } from 'react';
import { Pages } from 'react-native-pages';

class Example extends Component {
  render() {
    return (
      <Pages>
        <View style={{ flex: 1, backgroundColor: 'red' }} />
        <View style={{ flex: 1, backgroundColor: 'green' }} />
        <View style={{ flex: 1, backgroundColor: 'blue' }} />
      </Pages>
    );
  }
}

Properties

namedescriptiontypedefault
horizontalScroll directionBooleantrue
rtlRTL mode for horizontal scrollBooleanfalse
startPageStart pageNumber0
indicatorColorPage indicator colorStringrgb(255, 255, 255)
indicatorOpacityPage indicator opacity (inactive dots)Number0.30
indicatorPositionPage indicator positionStringbottom
containerStyleStyle for container viewObject-
progressAnimated.Value updated with progressObject-
onScrollStartScroll start callbackFunction-
onScrollEndScroll end callbackFunction-
onHalfwayDominant page change callbackFunction-
renderPagerRender pager callbackFunction-

Possible values for indicatorPosition are none, top, right, bottom and left

Methods

namedescriptionreturns
scrollToPageScroll to page with optional animation-
isDraggingReturns whether the user has begun scrollingBoolean
isDeceleratingReturns whether content is moving after scrollingBoolean

Replacing page indicator

import { Indicator, Pages } from 'react-native-pages';

class Example extends Component {
  _renderPager = (options) => {
    let {
      rtl,
      pages,
      progress,
      horizontal,
      indicatorColor,
      indicatorOpacity,
      indicatorPosition,
    } = options;

    if ('none' === indicatorPosition) {
      return null;
    }

    return (
      <Indicator {...options} />
    );
  };

  render() {
    let { children, ...props } = this.props;

    return (
      <Pages {...props} renderPager={this._renderPager}>
        {children}
      </Pages>
    );
  }
}

For implementation details take look at Indicator component

Parallax and other animations

All child components receive the following props

namedescriptiontype
indexPage indexNumber
pagesPage countNumber
progressAnimated.Value with current progressObject

For usage example take look at example app source code

Example

git clone https://github.com/n4kz/react-native-pages
cd react-native-pages/example
npm install
npm run ios # or npm run android

BSD License

Copyright 2017-2019 Alexander Nazarov. All rights reserved.

Keywords

FAQs

Package last updated on 07 Oct 2019

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc