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

stories-react

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

stories-react

instagram style stories in react js

  • 1.0.13
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
643
decreased by-14.72%
Maintainers
1
Weekly downloads
 
Created
Source

stories-react

A React component For Instagram like stories

Homepage

hero

Install

npm install --save stories-react

Demo

You can find working demo here

Usage

import React from 'react';
import Stories from 'stories-react';
import 'stories-react/dist/index.css';

export default function ImagesStories() {
  const stories = [
    {
      type: 'image',
      url: 'https://images.pexels.com/photos/9470805/pexels-photo-9470805.jpeg?w=300',
      duration: 5000,
    },
    {
      type: 'image',
      duration: 6000,
      url: 'https://images.pexels.com/photos/9733197/pexels-photo-9733197.jpeg?w=300',
    },
    {
      duration: 7000,
      type: 'image',
      url: 'https://images.pexels.com/photos/9470805/pexels-photo-9470805.jpeg?w=300',
    },
  ];

  return (
      <Stories
        width="400px"
        height="600px"
        stories={stories}
      />
  );
}

Props

PropertyTypeDefaultDescription
storiesIStoryObject[][]An array of story objects. description of IStoryObject is mentioned below
heightstring100%Height of story container
widthstring100%Width of story container
onStoryChangefunction(index:number)-Callback called when story changes
onStoriesStartfunction-Callback called when first story is rendered. it get called only once,
onAllStoriesEndfunction-Callback called when last story gets completed. it will get called only once
currentIndexnumber-Current index of the story which should be selected first
defaultDurationnumber10000default duration in ms of stories if duration is not provided in the IStoryObject

IStoryObject

PropertyTypeDefaultDescription
typeimage , video , component-type of story to render
urlstring-url of a story (image & video only)
durationduration10000duration in ms of the story
componentReact Component-custom component to render as a story
headerReact Component-header of a story
seeMorestring , boolean , React ComponenttrueSee more action text
seeMoreComponentReact Component-see more component opens after clicking see more
onSeeMoreClickfunction(index:number)-Callback called when story see more is clicked

Custom Component Story Props

PropertyTypeDescription
pausefunctioncall it to pause a story
resumefunctioncall it to resume a story
storyIStoryObjectcurrent story properties
isPausedbooleanstate of a story

Keywords

FAQs

Package last updated on 30 Mar 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