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 🙏

© 2026 – Pkg Stats / Ryan Hefner

react-native-insta-story-viewer

v1.0.1

Published

A highly customizable, Instagram-like 3D cube story viewer for React Native and Expo.

Downloads

243

Readme

React Native Insta Story Viewer

A highly customizable, production-ready, Instagram-like 3D cube story viewer for React Native and Expo.

It handles complex 3D cube transitions, gestures, network loading states, and is fully typed with Generics so you can drop in your own data structures without mapping!


📸 Demo

▶️ Click here to watch the Video Demo!


🚀 Installation

This package relies on a few peer dependencies (Reanimated, Gesture Handler) that you likely already have installed.

1. Install the package:

npm install react-native-insta-story-viewer

2. Install Peer Dependencies (if you don't have them):

npx expo install react-native-reanimated react-native-gesture-handler react-native-safe-area-context expo-linear-gradient expo-haptics @expo/vector-icons

(Make sure you configure react-native-reanimated in your babel.config.js!)


🛠️ Usage

The component uses TypeScript Generics and Accessors (just like FlatList). You pass your raw data array and tell the component how to extract the data it needs using functions like getUserId.

Basic Example

import React from 'react';
import { View } from 'react-native';
import { StoryTray } from 'react-native-insta-story-viewer';

// Your raw API data!
const myData = [
  {
    accountId: 'u1',
    handle: 'john_doe',
    profilePic: 'https://i.pravatar.cc/150?img=12',
    feed: [
      { id: 's1', image: 'https://images.unsplash.com/photo-1506905925346?w=800', ms: 5000 },
      { id: 's2', image: 'https://images.unsplash.com/photo-1511884642898?w=800', ms: 4000 },
    ],
  }
];

export default function App() {
  return (
    <View style={{ flex: 1, backgroundColor: '#fff', paddingTop: 50 }}>
      <StoryTray
        users={myData}
        
        // 1. Tell the component how to read your data:
        getUserId={(u) => u.accountId}
        getUserAvatarUrl={(u) => u.profilePic}
        getUserName={(u) => u.handle}
        getUserStories={(u) => u.feed}
        
        getStoryId={(s) => s.id}
        getStoryMediaUrl={(s) => s.image}
        getStoryDuration={(s) => s.ms}

        // 2. Add some callbacks!
        onLikePress={(user, story) => console.log('Liked!', user.handle)}
        onReplySubmit={(user, story, text) => console.log('Reply:', text)}
      />
    </View>
  );
}

⚙️ Props & Configuration

Data Accessors (Required)

Because the component is Generic (<U, S>), you must provide these functions to extract data:

| Prop | Type | Description | |------|------|-------------| | getUserId | (user: U) => string | Returns the unique ID for the user. | | getUserAvatarUrl | (user: U) => string | Returns the profile picture URL. | | getUserName | (user: U) => string | Returns the display name. | | getUserStories | (user: U) => S[] | Returns the array of stories for the user. | | getStoryId | (story: S) => string | Returns the unique ID for the story. | | getStoryMediaUrl | (story: S) => string | Returns the image URL for the story. |

Optional Accessors

| Prop | Type | Description | |------|------|-------------| | getStoryDuration | (story: S) => number | Story duration in ms. Falls back to defaultStoryDuration. |

UI Configuration Props

| Prop | Type | Default | Description | |------|------|---------|-------------| | defaultStoryDuration | number | 5000 | Default duration if story has none. | | unviewedRingColors | string[] | ['#f09433', ...] | Instagram-style gradient colors for the Avatar Ring. | | viewedRingColor | string | '#E0E0E0' | Ring color when all stories are viewed. | | showsReplyInput | boolean | true | Show/Hide the bottom reply text input. | | showsOptionsIcon | boolean | true | Show/Hide the top right menu icon. | | showsLikeIcon | boolean | true | Show/Hide the bottom heart icon. | | showsShareIcon | boolean | true | Show/Hide the bottom paper plane icon. |

Callbacks (with Auto-Haptics 📳)

| Prop | Type | Description | |------|------|-------------| | onReplySubmit | (user, story, text) => void | Fired when the user submits a message in the input field. | | onLikePress | (user, story) => void | Fired when the heart icon is tapped. | | onSharePress | (user, story) => void | Fired when the share icon is tapped. | | onOptionsPress | (user, story) => void | Fired when the icon is tapped. | | onAllStoriesViewed | (userId: string) => void | Fired when the user watches the very last story in the queue. |


🎨 Advanced Customization

You can inject styles to heavily customize the built-in layout:

<StoryTray
  // ...
  usernameStyle={{ color: '#FFE0B2', fontSize: 16 }}
  progressBarFillStyle={{ backgroundColor: '#FF9800' }}
  replyInputStyle={{ borderColor: 'red' }}
/>

Complete Render Overrides

If you need complete control, bypass our UI entirely using Render Props:

  • renderAvatar: Replace the circular tray avatars entirely.
  • renderHeader: Replace the top user info bar inside the viewer.
  • renderFooter: Replace the bottom interaction bar inside the viewer.

Contributing

Pull requests are welcome!

License

MIT