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

@pietile-native-kit/page-slider

Package Overview
Dependencies
Maintainers
2
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@pietile-native-kit/page-slider

Simple page slider

  • 1.2.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
309
decreased by-29.77%
Maintainers
2
Weekly downloads
 
Created
Source

PageSlider

npm version install size

Helps to implement swipeable pages. PageSlider is controlled with selectedPage prop component and can work in two modes: page when page occupies whole width of the screen and card when adjacent pages are visible at sides.

Installation

Using yarn

yarn add @pietile-native-kit/page-slider

or using npm

npm install -S @pietile-native-kit/page-slider

Usage

PageSlider should occupy whole width of the screen. Each element inside will be wrapped with a view and you can safely use all available space in it. PageSlider is controlled so you should pass at least selectedPage and implement onSelectedPageChange. There is also optional onCurrentPageChange callback that fires currently active page (for example while the page is being dragged). By default PageSlider works in page mode.

Example

import React, { useState } from 'react';

import { PageSlider } from '@pietile-native-kit/page-slider';
import { StyleSheet, Text, View } from 'react-native';

function PageSliderExample() {
  const [selectedPage, setSelectedPage] = useState(0);

  return (
    <PageSlider
      style={styles.pageSlider}
      selectedPage={selectedPage}
      onSelectedPageChange={setSelectedPage}
    >
      <View style={[styles.page, { backgroundColor: 'red' }]}>
        <Text>1</Text>
      </View>
      <View style={[styles.page, { backgroundColor: 'orange' }]}>
        <Text>2</Text>
      </View>
      <View style={[styles.page, { backgroundColor: 'yellow' }]}>
        <Text>3</Text>
      </View>
    </PageSlider>
  );
}

const styles = StyleSheet.create({
  pageSlider: {
    width: '100%',
  },
  page: {
    alignItems: 'center',
    height: 128,
    justifyContent: 'center',
    padding: 16,
  },
});

API

Properties

namedescriptiontypedefault
childrenContentNode-
mode"page" or "card"stringpage
contentPaddingVerticalVertical padding of content containernumber-
pageMarginSpace between pagesnumber8
peekSpace between page and edge of the screennumber24
selectedPageSelected page indexnumber-
styleStyle of component itselfstyle-
onCurrentPageChangeFires when current page changedfunction-
onSelectedPageChangeFires when selected page changedfunction-

License

Pietile PageSlider is MIT License.

Keywords

FAQs

Package last updated on 02 Aug 2022

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