Socket
Socket
Sign inDemoInstall

react-native-swipeable-parallax-carousel

Package Overview
Dependencies
0
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    react-native-swipeable-parallax-carousel

React Native Swipeable Parallax Carousel


Version published
Maintainers
1
Created

Changelog

Source

[1.1.0] - 2017-07-31

Added

  • Orientation change support

Readme

Source

npm version

Android & iOS // React Native v0.46+

Preview

Carousel with parallax effect, overlay and dots navigation

Preview

Carousel without parallax effect, without overlay and with bars navigation

Get started

Installation

Run: $ npm install react-native-swipeable-parallax-carousel --save

Usage

import SwipeableParallaxCarousel from 'react-native-swipeable-parallax-carousel';

const datacarousel = [
  {
      "id": 339964,
      "title": "Valerian and the City of a Thousand Planets",
      "imagePath": "https://image.tmdb.org/t/p/w780/o6OhxtsgMurL4h68Uqei0aSPMNr.jpg",
  },
  {
      "id": 315635,
      "imagePath": "https://image.tmdb.org/t/p/w780/fn4n6uOYcB6Uh89nbNPoU2w80RV.jpg",
  },

  ...

  {
      "id": 339403,
      "title": "Baby Driver",
      "subtitle": "More than just a trend",
      "imagePath": "https://image.tmdb.org/t/p/w780/xWPXlLKSLGUNYzPqxDyhfij7bBi.jpg",
  },
];

<SwipeableParallaxCarousel
  data={datacarousel}
/>

Properties

PropDescriptionDefaultRequired
dataAn array with all your items. Read bellow about Data array structure.NoneYes
alignTitle alignment. Could be left, right or center.leftNo
titleColorColor title.#ffffffNo
navigationDisplay a navigation bar or not. Boolean true or false.trueNo
navigationColorColor of the current item in the navigation bar.#ffffffNo
navigationTypeNavigation bar type. 3 types available: dots, bars or squares. See navigationType examples for illustrations.dotsNo
heightCarousel height.200No
parallaxParallax effect while scrolling. Boolean true or false.trueNo
overlayPathImage ressource to overlay item image. For example: {require('../assets/images/itemGradient.png')}NoneNo
onPressA function called when an item is pressedNoneNo
parentScrollViewRefReference of the parent ScrollView. Read bellow about Make your carousel ScrollView friendlyNoneNo

Data array structure

Your data array must be an array of objects with at least an id and an imagePath key.

PropDescriptionRequired
idItem ID.Yes
titleItem title. Omit this prop if you don't want a title.No
subtitleItem subtitle. Omit this prop if you don't want a subtitle.No
imagePathItem image path.Yes
const datacarousel = [
  {
      "id": 339964,
      "title": "Valerian and the City of a Thousand Planets",
      "imagePath": "https://image.tmdb.org/t/p/w780/o6OhxtsgMurL4h68Uqei0aSPMNr.jpg",
  },
  {
      "id": 315635,
      "imagePath": "https://image.tmdb.org/t/p/w780/fn4n6uOYcB6Uh89nbNPoU2w80RV.jpg",
  },
  {
      "id": 339403,
      "title": "Baby Driver",
      "subtitle": "More than just a trend",
      "imagePath": "https://image.tmdb.org/t/p/w780/xWPXlLKSLGUNYzPqxDyhfij7bBi.jpg",
  },
];

navigationType examples

You can easily customize your navigation bar with navigationType: use dots, barsor squares to give a different look at your navigation items. Remember you can also use navigationColor to change the color of the current item in your navigation bar.

Navigation types

Dots, bars and squares navigation

In order to use your carousel component inside a ScrollView and avoid any conflicts while scrolling, you need to use parentScrollViewRef prop.

<ScrollView
  ref={(c) => { this.parentScrollView = c; }}
>

  ...

  <SwipeableCarousel
    data={datacarousel}
    parentScrollViewRef={this.parentScrollView}
  />

  ...

</ScrollView>

Demo

Questions or suggestions?

Feel free to contact me on Twitter or create an issue.

License

This project is licenced under the MIT License.

Keywords

FAQs

Last updated on 31 Jul 2017

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