npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@vincent-hyu-uit/react-native-stack-carousel

v0.1.16

Published

React native stack carousel

Readme

@vincent-hyu-uit/react-native-stack-carousel

A beautiful, performant stack carousel component for React Native with smooth animations and gesture support. Perfect for displaying images or custom content in a stacked card layout.

Demo

Watch Demo Video

Features

  • 🎨 Stacked card layout - Cards stack behind each other with progressive scaling
  • 🎯 Smooth gestures - Swipe left/right to navigate between items
  • High performance - Built with react-native-reanimated for 60fps animations
  • 🎨 Customizable - Customize card size, spacing, scale, and overlay opacity
  • 📱 TypeScript support - Full TypeScript definitions included
  • 🔄 Render props - Flexible rendering with custom components

Installation

npm install @vincent-hyu-uit/react-native-stack-carousel

Peer Dependencies

This library requires the following peer dependencies:

npm install react-native-gesture-handler react-native-reanimated

iOS Setup

Add the Reanimated plugin to your babel.config.js:

module.exports = {
  presets: ['module:@react-native/babel-preset'],
  plugins: ['react-native-reanimated/plugin'],
};

Android Setup

No additional setup required for Android.

Usage

Basic Example with Images

import React from 'react';
import { Image, StyleSheet, View } from 'react-native';
import { StackCarousel } from '@vincent-hyu-uit/react-native-stack-carousel';

const IMAGES = [
  'https://picsum.photos/id/1/400/600',
  'https://picsum.photos/id/2/400/600',
  'https://picsum.photos/id/3/400/600',
];

export default function App() {
  return (
    <View style={styles.container}>
      <StackCarousel
        data={IMAGES}
        renderItem={({ item }) => (
          <Image source={{ uri: item }} style={styles.card} resizeMode="cover" />
        )}
      />
    </View>
  );
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    alignItems: 'center',
    justifyContent: 'center',
  },
  card: {
    width: 220,
    height: 300,
    borderRadius: 24,
  },
});

Custom Content Example

<StackCarousel
  data={myDataArray}
  renderItem={({ item, index }) => (
    <View style={styles.customCard}>
      <Text>{item.title}</Text>
      <Text>{item.description}</Text>
    </View>
  )}
  cardWidth={250}
  cardHeight={350}
  cardOffsetRatio={0.25}
/>

API Reference

StackCarousel<T>

Main component for rendering the stack carousel.

Props

| Prop | Type | Default | Description | |------|------|---------|-------------| | data | T[] | required | Array of data items to render | | renderItem | (info: RenderItemInfo<T>) => React.ReactNode | required | Function to render each item | | cardWidth | number | 220 | Width of each card in pixels | | cardHeight | number | 300 | Height of each card in pixels | | cardOffsetRatio | number | 0.25 | Offset between stacked cards as a ratio of cardWidth (0-1) | | scaleSide | number | 0.8 | Scale multiplier for side cards. Each card behind is scaleSide times smaller | | opacitySide | number | 0.4 | Overlay opacity for inactive cards (0-1) | | containerStyle | ViewStyle | - | Custom style for the container | | cardStyle | ViewStyle | - | Custom style for each card wrapper |

RenderItemInfo<T>

Information passed to the renderItem function.

type RenderItemInfo<T> = {
  item: T;      // The current item from the data array
  index: number; // The index of the current item
};

Examples

Custom Card Dimensions

<StackCarousel
  data={images}
  renderItem={({ item }) => <Image source={{ uri: item }} />}
  cardWidth={280}
  cardHeight={400}
/>

Adjust Stack Spacing

<StackCarousel
  data={images}
  renderItem={({ item }) => <Image source={{ uri: item }} />}
  cardOffsetRatio={0.2} // Closer together
  // or
  cardOffsetRatio={0.4} // Further apart
/>

Custom Scale Effect

<StackCarousel
  data={images}
  renderItem={({ item }) => <Image source={{ uri: item }} />}
  scaleSide={0.85} // Less dramatic scaling
  // or
  scaleSide={0.7} // More dramatic scaling
/>

Custom Overlay Opacity

<StackCarousel
  data={images}
  renderItem={({ item }) => <Image source={{ uri: item }} />}
  opacitySide={0.2} // Lighter overlay
  // or
  opacitySide={0.6} // Darker overlay
/>

How It Works

The carousel uses a progressive scaling system where:

  • The active card (front) has scale 1.0
  • Each card behind is scaled by scaleSide (default 0.8)
  • So if scaleSide = 0.8: Card 1 = 1.0, Card 2 = 0.8, Card 3 = 0.64, Card 4 = 0.512, etc.

Cards also have an overlay that fades in as they move away from the active position, creating a depth effect.

Future Updates

This library is actively being developed. Planned features include:

  • More customization options
  • Additional animation effects
  • Performance optimizations
  • Enhanced gesture controls

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

MIT


Made with ❤️ by vincent-hyu-uit