• Stars
    star
    411
  • Rank 105,247 (Top 3 %)
  • Language
    TypeScript
  • License
    MIT License
  • Created over 4 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A simple and fully customizable React Native component that implements a status/stories feature similar to Whatsapp & Instagram ⭐✨🌟

React Native Stories View ⚡

npm version Platform - Android and IOS


A simple and fully customizable React Native components that provides a status/stories feature like Whatsapp, Instagram. For navigation across all the stories you can touch the left or right portion of the screen similar to what we see on Whatsapp or Instagram. The library works seemleslly across both Android as well as IOS platform developed with ❤️ in Typescript & React 🔥.

Feature's include :

  • Progress bar with custom duration & styling options.
  • Story Image view with custom styling options.
  • A fully customizable Header View, you can use default one or pass in your choice of component.
  • A fully customizable Footer View, you can use default one or pass in your choice of component.

Spread Your ❤️:

GitHub followers Twitter Follow

Demo

IOS Android

Screenshots

Example One Example Two Example Three Example Four Example Five

Installation

If using yarn:

yarn add react-native-stories-view

If using npm:

npm i react-native-stories-view

Usage

For example code, Click here

  • ProgressBar

This individual component can be used to display progressive bar with controlled duration, style & motion. To programatically enable or disable the progress pass boolean value to enableProgress & to change the position of progress use progressIndex prop along with duration prop to control the motion. On every change of propress position onChange function will be invoked for any customization.

<ProgressBar
   images={['','']}
   onChange={() => {}}
   progressIndex={0}
   enableProgress={true}
   duration={20} 
   barStyle={{
      barActiveColor: BAR_ACTIVE_COLOR,
      barInActiveColor: BAR_INACTIVE_COLOR,
      barWidth: 100, 
      barHeight: 4
   }}
/>
  • StoryContainer

This component provides you with entire functionality of Status/Stories feature along with flexible customization.

Basic Usage

This simply display's only the Progress Bar & the Story view images without any header or footer view. The container can be given style by providing containerStyle props.

import { StoryContainer } from 'react-native-stories-view';

<StoryContainer
   visible={true}
   enableProgress={true}
   images={images}
   duration={20}  
   onComplete={() => alert("onComplete")}
   containerStyle={{
       width: '100%',
       height: '100%',
   }}
/>

Header View

You can use the inbuilt header view which can display basic user details by simply providing userProfile props with specified parameters.

// User Information in header
<StoryContainer
   visible={true}
   enableProgress={true}
   images={images}
   duration={20} 
   onComplete={() => alert("onComplete")}
   userProfile={{
      userImage: PROFILE,
      userName: 'Yuvraj Pandey',
      userMessage: 'Work hard & success will follow !!',
      imageArrow: BACK,
      onImageClick: () => {
         console.log('lskndclksnc');
         Alert.alert('User profile image tapped');
      },
   }}
/>

However if you wish to add your own custom component, you can pass your own component in headerComponent prop and this will replace the header described above.

<StoryContainer
   visible={true}
   enableProgress={true}
   images={images}
   onComplete={() => alert("onComplete")}
   duration={20} 
   headerComponent={<View />}
/>

In case neither of the prop i.e userProfile or headerComponent is passed then header view will be not be displayed.

Footer View

The in built footer view provides you with a reply option where in you can accept user input for the status user just viewed. isShowReply boolean prop can be used to programaically show or hide the footer reply view. The onReplyTextChange & onReplyButtonClick function provides callback for the action performed by the user along with the progressIndex of the particular story currently viewed.

// Reply option in Footer
<StoryContainer
   visible={true}
   enableProgress={true}
   images={images}
   duration={20} 
   onComplete={() => alert("onComplete")}
   replyView={{
      isShowReply: true,
      onReplyTextChange: (textReply, progressIndex) => {
          console.log(`Text : ${textReply} , position : ${progressIndex}`);
      },
      onReplyButtonClick: (buttonType, progressIndex) => {
         switch (buttonType) {
            case 'send':
               console.log(`Send button tapped for position : ${progressIndex}`);
               break;

             case 'smiley':
               console.log(`Smiley button tapped for position : ${progressIndex}`);
               break;
          }
       },
   }}
/>

If you have your own custom component to use in Footer, simply pass your component in footerComponent prop as below which will replace the inbuilt Footer with your own custom style.

// Custom Footer component option
<StoryContainer
   visible={true}
   enableProgress={true}
   images={images}
   duration={20} 
   onComplete={() => alert("onComplete")}
   footerComponent={<View />}
/>

However if neither of the prop i.e replyView or footerComponent is passed then footer view will be not be displayed.

Documentation :

ProgressBar

PropName PropType Purpose Required
images Array<String> Story images array to render count of bar Mandatory
progressIndex number Starts progress for a particular index item Mandatory
enableProgress Boolean Start/Stop the progress bar motion Optional
duration Number Control's the speed of progress bar Optional
barStyle Object Progress Bar style Optional
barActiveColor String Active progress color Optional
barInActiveColor String In Active progress color Optional
barWidth number Default 100, Always > 10 but < 100 Optional
barHeight number Default 7, Always > 4 but < 10 Optional
onChange Function Function executes after change in progressIndex Optional

Basic

PropName PropType Purpose Required
visible Boolean Toggle visibility of Story Container Mandatory
enableProgress Boolean Enable/disable the top progress bar visibility Optional
images Array<String> Story Images Mandatory
duration Number Control's the speed of progress bar Optional
containerStyle Object Container style Optional
onComplete Function Function executes after all status is completed Optional

Header

PropName PropType Purpose Required
userProfile Object Default user detail view Optional
userImage String Image URL Optional
userName String Display's user name Optional
userMessage String Display's user information Optional
imageArrow String Image Url Optional
onImageClick Function Function that executes imageArrow click event Optional
headerComponent Component Custom component Optional

Footer

PropName PropType Purpose Required
replyView Object Default reply view with Input text Optional
isShowReply Object Toggle's the display of footer view Mandatory
onReplyTextChange String Callback for user entered text with posotion Optional
onReplyButtonClick String Callback for emoji & send click with posotion Optional
footerComponent Component Custom component Optional

About Me

Yuvraj Pandey

I am a passionate Engineer which likes to push himself on various fronts of technologies.

For more exciting updates follow me,

                                    

More Repositories

1

WhatsApp-Clone

WhatsApp Clone provides an in-depth view of implementation on how to create a full-stack, mobile, hybrid web application from scratch using React Native, ReactJs, Typescript, NodeJs, ExpressJs, MongoDB, Socket.io, Heroku & Firebase Deployment. 🔥🔥
JavaScript
381
star
2

LiveSmashBar

An elegant looking and easy to use informative library with LiveData integration for Android.
Kotlin
119
star
3

SwiftNotes

Creating notes was never so smooth, just check out this demo developed in XCode 9 & Swift 4.
Swift
33
star
4

Fluttereo

This repository explores various fundamentals of Flutter from scratch developed in Dart with Android Studio & Visual Code 🔥.
Dart
26
star
5

EStoreline

EStoreLine is an eCommerce platform that provides an in-depth view of implementation on how to create a Full Stack Web application from scratch using Reactjs, Html5, CSS3, Bootstrap4, React-Redux, NodeJs, ExpressJs, MySQL.
JavaScript
9
star
6

React-Food-App

React-Food-App is a sample UI Design-Kit implementation build in React Native for both Android & iOS platform's.
JavaScript
7
star
7

react-native-picker-calendar-view

A simple and fully customizable React Native library that can be used as a Date picker or a simple Calendar view 📅
TypeScript
6
star
8

SwiftSocial

A deep dive into Social login integration including Facebook, Google & Firebase Authentication in SWIFT for IOS.
Swift
5
star
9

MVPCodeDemo

Java
4
star
10

ArchComponents

The repository covers the concepts regarding ViewModel, LiveData, LifeCycle along with Retrofit & RxJava in a Kotlin
Kotlin
4
star
11

recipe-rest-apis

Python
2
star
12

AndroidFundamentals

Kotlin
2
star
13

MovieCreator

MovieCreator demonstrates simple implementation of MERN (MongoDb | ExpressJs | ReactJs | NodeJs) Stack for complete end-to-end web app development ⚡️ 🔥
JavaScript
2
star
14

CircularSearchAnimation

Kotlin
2
star
15

Reactify

A sample repository exploring the basics of React Native 🔥🔥🔥
Objective-C
1
star