react-insta-stories
A React component for Instagram like stories.
'See more' and video playback added! Watch the demo below!
Install
Usage
Props
Property | Type | Default | Description |
---|---|---|---|
stories |
[String/Object] | required |
An array of image urls or array of story objects (options described below) |
defaultInterval |
Number | 1200 | Milliseconds duration for which a story persists |
loader |
Component | 'Loading..' | A loader component as a fallback until image loads from url |
header |
Component | Default header as in demo | A header component which sits at the top of each story. It receives the header object from the story object. Data for header to be sent with each story object. |
width |
Number | 360 | Width of the component in pixels |
height |
Number | 640 | Height of the component in pixels |
storyStyles |
Object | none | Override the default story styles mentioned below. |
Story object
Instead of simple string url, a comprehensive 'story object' can also be passed in the stories
array.
Property | Description |
---|---|
url |
The url of the resource, be it image or video. |
duration |
Optional. Duration for which a story should persist. |
header |
Optional. Adds a header on the top. Object with heading , subheading and profileImage properties. |
seeMore |
Optional. Adds a see more icon at the bottom of the story. On clicking, opens up this component. |
type |
Optional. To distinguish a video story. type: 'video' is necessary for a video story. |
styles |
Optional. Override the default story styles mentioned below. |
Default story styles
Following are the default story content styles. Override them by providing your own style object with each story or a global override by using the storyStyles
prop.