Git Product home page Git Product logo

react-native-story-view's Introduction

Story View - Simform

react-native-story-view

react-native-story-view on npm react-native-story-view downloads react-native-story-view install size Android iOS MIT


This library provides status/stories features like Instagram/WhatsApp or other social media, It is simple to use and fully customizable. It works on both android and iOS platforms.

Quick Access

Installation | StoryView | Usage | Props | Example | License

Installation

1. Install Story View
$ npm install react-native-story-view
# --- or ---
$ yarn add react-native-story-view
2. Install peer dependencies
$ npm install react-native-video react-native-reanimated react-native-gesture-handler react-native-video-cache-control @shopify/flash-list lodash
# --- or ---
$ yarn add react-native-video react-native-reanimated react-native-gesture-handler react-native-video-cache-control @shopify/flash-list lodash

Note: If you already have these libraries installed and at the latest version, you are done here!

3. Install cocoapods in the ios project
cd ios && pod install

Note: Make sure to add Reanimated's babel plugin to your babel.config.js

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

Android Cache control dependency (Mandatory)

In your project's android/app/build.gradle

dependencies {
    implementation 'com.danikula:videocache:2.7.1'
    // Your rest of the code
}

In your project's android/build.gradle

buildscript {
    // Your rest of the code
}
allprojects {
    repositories {
        google()
        mavenCentral()
        maven { url 'https://jitpack.io' }
        jcenter()
    }
}

Extra Step

Android:
If you're facing issue related to 'android-scalablevideoview' or 'videocache' module not found. Add this code in android's build.gradle

jcenter() {
    content {
        includeModule("com.yqritc", "android-scalablevideoview")
        includeModule("com.danikula", "videocache")
    }
}

StoryView

๐ŸŽฌ Preview


SimformSolutions SimformSolutions

Usage

StoryView is divided into several components, MultiStory is the root component. ProfileHeader and Footer are individual components for header and footer. StoryContainer internally used for rendering Story. We'll look usage and customization of all these.


Checkout Multi Story Example here
Checkout Stories Data Format here
Checkout Single Story Example here

Story Data Format

Define the users' stories array in the below format. There will be multiple users and multiple stories inside.

const userStories = [
    {
      id: 1, //unique id (required)
      username: 'Alan', //user name on header
      title: 'Albums', //title below username
      profile: 'https://sosugary.com/wp-content/uploads/2022/01/TheWeeknd_001.jpg', //user profile picture
      stories: [
        {
          id: 0, //unique id (required)
          url: 'https://i1.sndcdn.com/artworks-IrhmhgPltsdrwMu8-thZohQ-t500x500.jpg', // story url
          type: 'image', //image or video type of story
          duration: 5, //default duration
          storyId: 1,
          isSeen: false,
        },
        {
          id: 1,
          url: 'https://storage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4',
          type: 'video',
          duration: 15,
          storyId: 1,
          isSeen: false,
        },
      ],
    },
    {
      id:2,
      username: 'Weekend',
      ...
    }
]

MultiStory

SimformSolutions SimformSolutions

This is the root component of StoryView package. It displays horizontal list of users with pre-defined ui from StoryAvatar component and uses animated flatlist under the hood to display stories. StoryContainer is used under the hood for story so all customization can be done from storyContainerProps.

Basic Usage

const multiStoryRef = useRef<MultiStoryRef>(null);

<MultiStory
  stories={stories}
  ref={multiStoryRef}
  avatarProps={{
    userNameStyle: { fontSize: 16 },
  }}
  // all StoryContainer props applies here
  storyContainerProps={{
    renderHeaderComponent: ({ userStories, progressIndex, userStoryIndex }) => (
      <Header {...{ userStories, progressIndex, multiStoryRef }} />
    ),
    renderFooterComponent: ({ userStories, progressIndex, userStoryIndex }) => (
      <Footer {...{ userStories }} />
    ),
    barStyle: {
      barActiveColor: Colors.red,
    },
  }}
/>;

Checkout Multi Story Example here

ProfileHeader

SimformSolutions

This is an individual component, To display user details on header like instagram/whatsapp. In renderHeaderComponent of StoryContainer, Custom component can be assigned. For MultiStory, renderHeaderComponent receives progressIndex, userStories, story and userStoryIndex for getting current user data.

const multiStoryRef = useRef(null);

<MultiStory
  ref={multiStoryRef}
  storyContainerProps={{
    renderHeaderComponent: ({
      userStories,
      story,
      progressIndex,
      userStoryIndex,
    }) => (
      <ProfileHeader
        userImage={{ uri: userStories?.profile ?? '' }}
        userName={userStories?.username}
        userMessage={userStories?.title}
        onClosePress={() => {
          multiStoryRef?.current?.close?.();
        }}
      />
    ),
  }}
/>;

Footer

SimformSolutions SimformSolutions

This is an individual component, To display footer like instagram. Any TextInput props can be directly passed to Footer. In renderFooterComponent of StoryContainer, Custom component can be assigned.

<MultiStory
  storyContainerProps={{
    renderFooterComponent: ({
      userStories,
      story,
      progressIndex,
      userStoryIndex,
    }) => (
      <Footer
        onIconPress={() => {
          console.log('Share icon clicked');
        }}
        onSendTextPress={() => {
          console.log('Message sent');
        }}
        shouldShowSendImage={true}
        shouldShowTextInputSend={true}
        placeholder="Enter Message"
      />
    ),
  }}
/>

Additional Reference

StoryContainer

This is the core component of StoryView, which provides all functionality of story view and customization. It is used to render all stories in MultiStory. This component is just for reference how storyContainerProps in MultiStory being passed in this component internally.

const [isStoryViewVisible, setIsStoryViewShow] = useState(false);

<StoryContainer
  visible={isStoryViewVisible}
  extended={true}
  // extended enables play & pause feature on single story view default is "true"
  maxVideoDuration={10}
  stories={userStories[0].stories}
  renderFooterComponent={({ story, progressIndex }) => (
    <Footer
      onSendTextPress={() => {
        Alert.alert(`Current Story id ${story?.[progressIndex].id} `);
        Keyboard.dismiss();
      }}
      onIconPress={() => {
        Alert.alert('Current Story progress index' + progressIndex);
      }}
    />
  )}
  renderHeaderComponent={({ story, progressIndex }) => (
    <ProfileHeader
      userImage={{ uri: userStories[0]?.profile ?? '' }}
      userName={userStories[0]?.username}
      userMessage={userStories[0]?.title}
      onImageClick={() => {}}
      onClosePress={() => setIsStoryViewShow(false)}
    />
  )}
  //Callback when all stories completes
  onComplete={() => setIsStoryViewShow(false)}
/>;

MultiStoryContainer

MultiStory is wrapper on this component with extra horizontal user list UI of StoryAvatar. If MultiStory's horizontal list customisation is not sufficient for any use-case, use this base component and add your own customised horizontal user list UI.

SimformSolutions

Basic Usage

const [isStoryViewVisible, setIsStoryViewShow] = useState(false);
const [pressedIndex, setPressedIndex] = useState<number>(0);

const openStories = (index: number) => {
  setIsStoryViewShow(true);
  setPressedIndex(index);
};

  <View style={styles.container}>
    <FlatList
      horizontal
      data={userStories}
      keyExtractor={item => item?.id?.toString()}
      renderItem={({ item, index }) => (
        <Pressable onPress={() => openStories(index)}>
          <CustomStoryAvatar {...{ item, index }} />
        </Pressable>
      )}
    />
    {isStoryViewVisible && (
      // add other StoryContainer Props
      <MultiStoryContainer
        visible={isStoryViewVisible}
        onComplete={() => setIsStoryViewShow(false)}
        stories={userStories}
        renderHeaderComponent={...}
        renderFooterComponent={...}
        userStoryIndex={pressedIndex}
      />
    )}
  </View>

ProgressBar

SimformSolutions

ProgressBar customisation can be controlled through StoryContainer itself. enableProgress to make visible the progressbar.progressIndex to start story from any index. barStyle to customize look feel of progressbar.onChangePosition trigger when progressbar index will change returns current index.

<MultiStory
  storyContainerProps={{
    enableProgress: true,
    //Callback when progressbar index changes
    onChangePosition: position => {},
    barStyle: {
      barHeight: 2,
      barInActiveColor: 'green',
      barActiveColor: 'grey',
    },
    maxVideoDuration: 25,
    progressIndex: 0,
  }}
/>

Custom View

SimformSolutions

Pass any custom view in story view. It will be rendered on top of story view as it has an absolute position. In renderCustomView of StoryContainer, Any custom component can be assigned.

<MultiStory
  storyContainerProps={{
    renderCustomView: () => (
      <View
        style={{
          position: 'absolute',
          top: 40,
          right: 50,
        }}>
        <Image
          source={Images.star}
          style={{
            height: 25,
            width: 25,
            tintColor: 'green',
          }}
        />
      </View>
    ),
  }}
/>

Story Data

[{
  id: number;
  username: string;
  title: string;
  profile: string;
  stories:Array<Story>[
    {
      id: number;
      url: string;
      type: 'image' | 'video';
      duration: number
      isReadMore: boolean
      storyId: number,
      isSeen?: boolean,
    }
  ]
}]

Transitions

Cube Scale Default

Props

MultiStory


Name Default Type
Description
stories* undefined StoriesType[] Array of multiple user stories
ref null MultiStoryRef To access close story method
storyContainerProps {} StoryContainerProps Customize all story props, detailed props in below StoryContainer section
avatarProps {} StoryAvatarStyleProps Customize avatar component styles
onChangePosition null (progressIndex, storyIndex) => {} Callback when progress index changes
transitionMode TransitionMode.Cube TransitionMode: {Default, Cube, Scale} To customize user story transition, (TransitionMode.default : no transition, Transition.scale : zoomIn/zoomOut transition, Transition.Cube: 3D cube transition) cube
onComplete null (viewedStories?: Array<boolean[]>) => void Callback when stories closed or completes. viewedStories contains multi array of boolean whether story is seen or not
props - FlatListProps Pass any FlatList props to customize horizontal user list

StoryAvatarStyleProps


Name Default Type
Description
userNameStyle - TextStyle To change style of user name
userImageStyle - ImageStyle To change style of user avatar
containerStyle - ViewStyle To change style of image container
userImageProps - ImageProps To customize image props
userNameProps - ViewStyle To customize text props
rootProps - PressableProps To customize root view props
viewedStoryContainerStyle - ViewStyle To customize story avatar when all stories of it are seen


MultiStoryContainer


Name Default Type
Description
stories* undefined StoriesType[] Array of multiple user stories
visible* false boolean Hide / show story view
userStoryIndex 0 number Pass clicked index of horizontal user list.
storyContainerProps {} StoryContainerProps Customize all story props, detailed props in below StoryContainer section
onChangePosition null (progressIndex, userIndex) => {} Callback when progress index changes
transitionMode TransitionMode.Cube TransitionMode: {Default, Cube, Scale} To customize user story transition, (TransitionMode.default : no transition, Transition.scale : zoomIn/zoomOut transition, Transition.Cube: 3D cube transition) cube
onComplete null () => {} Callback when stories closed or complete
props - StoryContainerProps Pass any StoryContainerProps props to customize story


StoryContainer


Name Default Type
Description
visible* false boolean Hide / show story view
stories* undefined StoryType[] Array of stories
extended* true boolean Enables pause / play feature on single story view
backgroundColor #000000 string Background color of story view
maxVideoDuration null number Override video progress duration (default is actual duration of video)
style {} ViewStyle Style of story view
showSourceIndicator true boolean Display indicator while video loading
sourceIndicatorProps {} ActivityIndicatorProps To override indicator props
onComplete null () => {} Callback when all stories completes
renderHeaderComponent null (callback: CallbackProps) => JSX.Element Render Header component (ProfileHeader) or custom component
renderFooterComponent null (callback: CallbackProps) => JSX.Element Render Footer component (Footer) or custom component
renderCustomView null (callback: CallbackProps) => JSX.Element Render any custom view on Story
renderIndicatorComponent {} () => JSX.Element Render loader when we press on Story, which represent loading state of story
storyContainerViewProps {} ViewProps Root story view props
headerViewProps {} ViewProps Header view wrapper props
footerViewProps {} ViewProps Footer view wrapper props
customViewProps {} ViewProps Custom view wrapper props
videoProps {} VideoProperties To override video properties
ref {} StoryRef To access 'pause' story method and 'viewedStories' stories object (Single Story)
customViewStyle {} ViewStyle Style of custom view container
headerStyle {} ViewStyle Style of header container
footerStyle {} ViewStyle Style of footer container


CallbackProps


Name Default Type
Description
progressIndex 0 number Current progress index of story
story undefined StoryType[] Current story array
userStories undefined StoriesType Current user story array (Only for Multi Story)
userStoryIndex undefined number Current user story index (Only for Multi Story)


StoryContainer: Progressbar


Name Default Type
Description
progressIndex 0 number To start story with any index
barStyle {
barActiveColor: #ffffff'
barInActiveColor: #FFFFFF7F
barHeight : 2
}
BarStyleProps Progressbar Style: (barActiveColor, barInActiveColor, barHeight)
enableProgress true boolean To display progressbar
progressViewProps {} ViewProps ProgressBar view wrapper props
onChangePosition null (position) => {} Callback when progress index changes


ProfileHeader


Name Default Type
Description
userImage {} ImageSourcePropType Circular view image
userName '' string To display username
userMessage '' string Display text below username
customCloseButton null any To render custom close button
closeIconProps {} ViewProps ProgressBar view wrapper props
onImageClick null () => {} Callback on user image click
rootStyle {} ViewStyle root view style changes
containerStyle {} ViewStyle container view style changes
userImageStyle {} ImageStyle To change profile Image view style
userNameStyle {} TextStyle To change profile name style
userMessageStyle {} TextStyle To change profile message/subtext style
closeIconStyle {} ImageStyle To change close icon style
userImageProps {} ImageProps User Image props
userMessageProps {} TextProps User Message Props
userNameProps {} TextProps User Name Props


Footer


Name Default Type
Description
customInput null TextInput Render any custom text input
shouldShowSendImage true bool Show/hide send icon image
onIconPress null () => {} Callback on send icon press
sendIconProps {} ImageProps Additional props to customize 'send' image view
sendText 'Send' string To change text 'send' with any other string
shouldShowTextInputSend true bool Show/hide send text inside text input (like instagram)
onSendTextPress null () => {} Callback on send text press
sendTextProps {} TextProps Additional props to customize 'send' text view
sendTextStyle {} TextStyle To change style of send text
sendIconStyle {} ImageStyle To change style of send icon
inputStyle {} StyleProp To change style of input
containerStyle {} ViewStyle To change style of root view
containerViewProps {} ViewProps Root view props
props - TextInputProps Pass any TextInput props on Footer component

Example

A full working example project is here Example

yarn
yarn example ios   // For ios
yarn example android   // For Android

TODO

  • Customize StoryAvatar in reference of Instagram
  • Customized Story example
  • Refactor Cube transition (make perfect cube in reference of Instagram)
  • Landscape support
  • Optimize video loading on android

Find this library useful? โค๏ธ

Support it by joining stargazers for this repository.โญ

Bugs / Feature requests / Feedbacks

For bugs, feature requests, and discussion please use GitHub Issues, GitHub New Feature, GitHub Feedback

๐Ÿค How to Contribute

We'd love to have you improve this library or fix a problem ๐Ÿ’ช Check out our Contributing Guide for ideas on contributing.

Awesome Mobile Libraries

License

react-native-story-view's People

Contributors

aawolf1099 avatar dhruv-h-simform avatar gururaj-simformsolutions avatar keval-g-simform avatar mukesh-simform avatar prince-d-simform avatar sagar-simformsolutions avatar shalin-simform avatar simform-solutions avatar virajpsimformsolutions avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

react-native-story-view's Issues

how to render a component

hello @dhruv-h-simform
how would i render a component like the progress bar in my own style, i do not want to use the given props, i want to make one from scratch,
i see you do same with the footer and header in the example folder,

renderHeaderComponent: ({ userStories }) => (
              <Header {...{ userStories, multiStoryRef }} />
            ),
            renderFooterComponent: ({ userStories, story, progressIndex }) => (
              <Footer {...{ userStories, story, progressIndex }}/>
            ),

but the same dosnt work for just the progress bar. i would like to bring it to the bottom

Display avatars vertically

hello @simform-solutions @tejas-ardeshna @BirjuVachhani @DevarshRanpara @virajpsimformsolutions

which prop can i use to display the story avatar list virtically, its set to horizontal by default

<FlatList
horizontal
data={stories}
showsHorizontalScrollIndicator={false}
keyExtractor={item => item?.id?.toString()}
renderItem={({ item, index }) => (
<StoryAvatar
{...{
item,
index,
isStoryViewVisible,
pressedIndex,
openStories,
viewedStories,
...avatarProps,
}}
/>
)}
{...props}
/>

crash bug: Invariant Violation: [3129,"RCTView",{"width":"<<NaN>>"}] is not usable as a native method argument

Hi I suddenly got this crash, can u help:

Screen Shot 2023-01-06 at 16 48 05

 Invariant Violation: [5507,"RCTView",{"width":"<<NaN>>"}] is not usable as a native method argument

This error is located at:
    in ProgressBar (at ProgressView.tsx:26)
    in RCTView (at View.js:32)
    in View (at createAnimatedComponent.js:211)
    in AnimatedComponent (at createAnimatedComponent.js:264)
    in AnimatedComponentWrapper (at ProgressView.tsx:24)
    in ProgressView (at StoryContainer.tsx:133)
    in RCTView (at View.js:32)
    in View (at StoryContainer.tsx:130)
    in RCTView (at View.js:32)
    in View (at StoryContainer.tsx:96)
    in RCTView (at View.js:32)
    in View (at KeyboardAvoidingView.js:209)
    in KeyboardAvoidingView (at StoryContainer.tsx:196)
    in RCTSafeAreaView (at SafeAreaView.js:51)
    in SafeAreaView (at StoryContainer.tsx:195)
    in Unknown (at MultiStoryContainer.tsx:56)
    in RCTView (at View.js:32)
    in View (at createAnimatedComponent.tsx:682)
    in AnimatedComponent(View) (at createAnimatedComponent.tsx:693)
    in Unknown (at MultiStoryContainer.tsx:55)
    in RCTView (at View.js:32)
    in View (at createAnimatedComponent.tsx:682)
    in AnimatedComponent(View) (at createAnimatedComponent.tsx:693)
    in Unknown (at MultiStoryContainer.tsx:54)
    in Unknown (at MultiStoryContainer.tsx:188)
    in RCTView (at View.js:32)
    in View (at createAnimatedComponent.tsx:682)
    in AnimatedComponent(View) (at createAnimatedComponent.tsx:693)
    in Unknown (at FlatList.tsx:18)
    in cellRenderer (at VirtualizedList.js:2068)
    in VirtualizedListCellContextProvider (at VirtualizedList.js:2078)
    in CellRenderer (at VirtualizedList.js:816)
    in RCTScrollContentView (at ScrollView.js:1682)
    in RCTScrollView (at ScrollView.js:1800)
    in ScrollView (at ScrollView.js:1826)
    in ScrollView (at VirtualizedList.js:1267)
    in VirtualizedListContextProvider (at VirtualizedList.js:1099)
    in VirtualizedList (at FlatList.js:644)
    in FlatList (at createAnimatedComponent.tsx:682)
    in AnimatedComponent(FlatList) (at createAnimatedComponent.tsx:693)
    in Unknown (at FlatList.tsx:43)
    in Unknown (at MultiStoryContainer.tsx:161)
    in PanGestureHandler (at MultiStoryContainer.tsx:158)
    in RCTView (at View.js:32)
    in View (at GestureHandlerRootView.tsx:17)
    in GestureHandlerRootView (at MultiStoryContainer.tsx:157)
    in RCTView (at View.js:32)
    in View (at AppContainer.js:92)
    in RCTView (at View.js:32)
    in View (at AppContainer.js:119)
    in AppContainer (at Modal.js:242)
    in RCTView (at View.js:32)
    in View (at Modal.js:271)
    in VirtualizedListContextResetter (at Modal.js:269)
    in RCTModalHostView (at Modal.js:248)
    in Modal (at MultiStoryContainer.tsx:153)
    in MultiStoryContainer (at StoryDetailScreen.js:163)
    in RCTView (at View.js:32)
    in View (at StoryDetailScreen.js:153)
    in StoryDetailScreen (at SceneView.tsx:132)
    in StaticContainer
    in EnsureSingleNavigator (at SceneView.tsx:124)
    in SceneView (at useDescriptors.tsx:217)
    in RCTView (at View.js:32)
    in View (at DebugContainer.native.tsx:22)
    in RCTView (at View.js:32)
    in View (at AppContainer.js:92)
    in RCTView (at View.js:32)
    in View (at AppContainer.js:119)
    in AppContainer (at DebugContainer.native.tsx:21)
    in DebugContainer (at NativeStackView.native.tsx:76)
    in MaybeNestedStack (at NativeStackView.native.tsx:247)
    in RNSScreen (at createAnimatedComponent.js:211)
    in AnimatedComponent (at createAnimatedComponent.js:264)
    in AnimatedComponentWrapper (at src/index.native.tsx:281)
    in MaybeFreeze (at src/index.native.tsx:280)
    in Screen (at NativeStackView.native.tsx:180)
    in SceneView (at NativeStackView.native.tsx:299)
    in RNSScreenStack (at src/index.native.tsx:202)
    in ScreenStack (at NativeStackView.native.tsx:290)
    in NativeStackViewInner (at NativeStackView.native.tsx:344)
    in RCTView (at View.js:32)
    in View (at SafeAreaProviderCompat.tsx:42)
    in SafeAreaProviderCompat (at NativeStackView.native.tsx:343)
    in NativeStackView (at createNativeStackNavigator.tsx:72)
    in Unknown (at createNativeStackNavigator.tsx:71)
    in NativeStackNavigator (at App.js:416)
    in RCTView (at View.js:32)
    in View
    in Unknown (at App.js:415)
    in EnsureSingleNavigator (at BaseNavigationContainer.tsx:430)
    in BaseNavigationContainer (at NavigationContainer.tsx:132)
    in ThemeProvider (at NavigationContainer.tsx:131)
    in NavigationContainerInner (at App.js:410)
    in RCTView (at View.js:32)
    in View (at ActionSheet/index.ios.tsx:16)
    in ActionSheet (at ActionSheetProvider.tsx:35)
    in ActionSheetProvider (at App.js:408)
    in RNCSafeAreaProvider (at SafeAreaContext.tsx:76)
    in SafeAreaProvider (at App.js:403)
    in RCTView (at View.js:32)
    in View (at GestureHandlerRootView.tsx:17)
    in GestureHandlerRootView (at App.js:402)
    in Provider (at SignalrContext.js:63)
    in SignalrWrapper (at App.js:399)
    in Unknown (at App.js:397)
    in Provider (at App.js:396)
    in App (at renderApplication.js:50)
    in RCTView (at View.js:32)
    in View (at AppContainer.js:92)
    in RCTView (at View.js:32)
    in View (at AppContainer.js:119)
    in AppContainer (at renderApplication.js:43)
    in VedaxLink(RootComponent) (at renderApplication.js:60)
 ERROR  Invariant Violation: [5507,"RCTView",{"width":"<<NaN>>"}] is not usable as a native method argument

This error is located at:
    in ProgressBar (at ProgressView.tsx:26)
    in RCTView (at View.js:32)
    in View (at createAnimatedComponent.js:211)
    in AnimatedComponent (at createAnimatedComponent.js:264)
    in AnimatedComponentWrapper (at ProgressView.tsx:24)
    in ProgressView (at StoryContainer.tsx:133)
    in RCTView (at View.js:32)
    in View (at StoryContainer.tsx:130)
    in RCTView (at View.js:32)
    in View (at StoryContainer.tsx:96)
    in RCTView (at View.js:32)
    in View (at KeyboardAvoidingView.js:209)
    in KeyboardAvoidingView (at StoryContainer.tsx:196)
    in RCTSafeAreaView (at SafeAreaView.js:51)
    in SafeAreaView (at StoryContainer.tsx:195)
    in Unknown (at MultiStoryContainer.tsx:56)
    in RCTView (at View.js:32)
    in View (at createAnimatedComponent.tsx:682)
    in AnimatedComponent(View) (at createAnimatedComponent.tsx:693)
    in Unknown (at MultiStoryContainer.tsx:55)
    in RCTView (at View.js:32)
    in View (at createAnimatedComponent.tsx:682)
    in AnimatedComponent(View) (at createAnimatedComponent.tsx:693)
    in Unknown (at MultiStoryContainer.tsx:54)
    in Unknown (at MultiStoryContainer.tsx:188)
    in RCTView (at View.js:32)
    in View (at createAnimatedComponent.tsx:682)
    in AnimatedComponent(View) (at createAnimatedComponent.tsx:693)
    in Unknown (at FlatList.tsx:18)
    in cellRenderer (at VirtualizedList.js:2068)
    in VirtualizedListCellContextProvider (at VirtualizedList.js:2078)
    in CellRenderer (at VirtualizedList.js:816)
    in RCTScrollContentView (at ScrollView.js:1682)
    in RCTScrollView (at ScrollView.js:1800)
    in ScrollView (at ScrollView.js:1826)
    in ScrollView (at VirtualizedList.js:1267)
    in VirtualizedListContextProvider (at VirtualizedList.js:1099)
    in VirtualizedList (at FlatList.js:644)
    in FlatList (at createAnimatedComponent.tsx:682)
    in AnimatedComponent(FlatList) (at createAnimatedComponent.tsx:693)
    in Unknown (at FlatList.tsx:43)
    in Unknown (at MultiStoryContainer.tsx:161)
    in PanGestureHandler (at MultiStoryContainer.tsx:158)
    in RCTView (at View.js:32)
    in View (at GestureHandlerRootView.tsx:17)
    in GestureHandlerRootView (at MultiStoryContainer.tsx:157)
    in RCTView (at View.js:32)
    in View (at AppContainer.js:92)
    in RCTView (at View.js:32)
    in View (at AppContainer.js:119)
    in AppContainer (at Modal.js:242)
    in RCTView (at View.js:32)
    in View (at Modal.js:271)
    in VirtualizedListContextResetter (at Modal.js:269)
    in RCTModalHostView (at Modal.js:248)
    in Modal (at MultiStoryContainer.tsx:153)
    in MultiStoryContainer (at StoryDetailScreen.js:163)
    in RCTView (at View.js:32)
    in View (at StoryDetailScreen.js:153)
    in StoryDetailScreen (at SceneView.tsx:132)
    in StaticContainer
    in EnsureSingleNavigator (at SceneView.tsx:124)
    in SceneView (at useDescriptors.tsx:217)
    in RCTView (at View.js:32)
    in View (at DebugContainer.native.tsx:22)
    in RCTView (at View.js:32)
    in View (at AppContainer.js:92)
    in RCTView (at View.js:32)
    in View (at AppContainer.js:119)
    in AppContainer (at DebugContainer.native.tsx:21)
    in DebugContainer (at NativeStackView.native.tsx:76)
    in MaybeNestedStack (at NativeStackView.native.tsx:247)
    in RNSScreen (at createAnimatedComponent.js:211)
    in AnimatedComponent (at createAnimatedComponent.js:264)
    in AnimatedComponentWrapper (at src/index.native.tsx:281)
    in MaybeFreeze (at src/index.native.tsx:280)
    in Screen (at NativeStackView.native.tsx:180)
    in SceneView (at NativeStackView.native.tsx:299)
    in RNSScreenStack (at src/index.native.tsx:202)
    in ScreenStack (at NativeStackView.native.tsx:290)
    in NativeStackViewInner (at NativeStackView.native.tsx:344)
    in RCTView (at View.js:32)
    in View (at SafeAreaProviderCompat.tsx:42)
    in SafeAreaProviderCompat (at NativeStackView.native.tsx:343)
    in NativeStackView (at createNativeStackNavigator.tsx:72)
    in Unknown (at createNativeStackNavigator.tsx:71)
    in NativeStackNavigator (at App.js:416)
    in RCTView (at View.js:32)
    in View
    in Unknown (at App.js:415)
    in EnsureSingleNavigator (at BaseNavigationContainer.tsx:430)
    in BaseNavigationContainer (at NavigationContainer.tsx:132)
    in ThemeProvider (at NavigationContainer.tsx:131)
    in NavigationContainerInner (at App.js:410)
    in RCTView (at View.js:32)
    in View (at ActionSheet/index.ios.tsx:16)
    in ActionSheet (at ActionSheetProvider.tsx:35)
    in ActionSheetProvider (at App.js:408)
    in RNCSafeAreaProvider (at SafeAreaContext.tsx:76)
    in SafeAreaProvider (at App.js:403)
    in RCTView (at View.js:32)
    in View (at GestureHandlerRootView.tsx:17)
    in GestureHandlerRootView (at App.js:402)
    in Provider (at SignalrContext.js:63)
    in SignalrWrapper (at App.js:399)
    in Unknown (at App.js:397)
    in Provider (at App.js:396)
    in App (at renderApplication.js:50)
    in RCTView (at View.js:32)
    in View (at AppContainer.js:92)
    in RCTView (at View.js:32)
    in View (at AppContainer.js:119)
    in AppContainer (at renderApplication.js:43)
    in VedaxLink(RootComponent) (at renderApplication.js:60)
 ERROR  Error: Exception in HostFunction: Malformed calls from JS: field sizes are different.

[[114,91,91,91,117],[1,6,6,6,16],[[7806],[5503,"RCTView",{"width":187}],[5507,"RCTView",{"width":0}],[319,"onTransitionProgress",4]],52022]

This error is located at:
    in AnimatedComponent (at createAnimatedComponent.js:264)
    in AnimatedComponentWrapper (at src/index.native.tsx:281)
    in MaybeFreeze (at src/index.native.tsx:280)
    in Screen (at NativeStackView.native.tsx:180)
    in SceneView (at NativeStackView.native.tsx:299)
    in RNSScreenStack (at src/index.native.tsx:202)
    in ScreenStack (at NativeStackView.native.tsx:290)
    in NativeStackViewInner (at NativeStackView.native.tsx:344)
    in RCTView (at View.js:32)
    in View (at SafeAreaProviderCompat.tsx:42)
    in SafeAreaProviderCompat (at NativeStackView.native.tsx:343)
    in NativeStackView (at createNativeStackNavigator.tsx:72)
    in Unknown (at createNativeStackNavigator.tsx:71)
    in NativeStackNavigator (at App.js:416)
    in RCTView (at View.js:32)
    in View
    in Unknown (at App.js:415)
    in EnsureSingleNavigator (at BaseNavigationContainer.tsx:430)
    in BaseNavigationContainer (at NavigationContainer.tsx:132)
    in ThemeProvider (at NavigationContainer.tsx:131)
    in NavigationContainerInner (at App.js:410)
    in RCTView (at View.js:32)
    in View (at ActionSheet/index.ios.tsx:16)
    in ActionSheet (at ActionSheetProvider.tsx:35)
    in ActionSheetProvider (at App.js:408)
    in RNCSafeAreaProvider (at SafeAreaContext.tsx:76)
    in SafeAreaProvider (at App.js:403)
    in RCTView (at View.js:32)
    in View (at GestureHandlerRootView.tsx:17)
    in GestureHandlerRootView (at App.js:402)
    in Provider (at SignalrContext.js:63)
    in SignalrWrapper (at App.js:399)
    in Unknown (at App.js:397)
    in Provider (at App.js:396)
    in App (at renderApplication.js:50)
    in RCTView (at View.js:32)
    in View (at AppContainer.js:92)
    in RCTView (at View.js:32)
    in View (at AppContainer.js:119)
    in AppContainer (at renderApplication.js:43)
    in VedaxLink(RootComponent) (at renderApplication.js:60)
 ERROR  Error: Exception in HostFunction: Malformed calls from JS: field sizes are different.
``

create customview => can not click

Hi, I create customview like this:

renderCustomView={() => (
                <Pressable onPress={() => {
                  alert('btn clicked')
                }} style={{
                    position: 'absolute',
                    backgroundColor: 'green',
                    top: 46,
                    right: 55,
                  }}>
                  <FontAwesome5Icon name='heart' size={20} color='white'/>
                </Pressable>
              )}

But I can not get click event, even i change to using TouchableOpacity, here is image:
210929346-d0cc044d-37a9-40a6-9904-051f17866fb6

Video duration don't change

I have a video m3u8 the duration not change, always are 15 seconds but not change.
How can I change this?

Thanks

Types mismatching

export type StoryType = {
id: number;
url?: string;
thumbnail?: string;
type?: string | 'image' | 'video' | 'text';
duration?: number;
isReadMore?: boolean;
isSeen?: boolean;
isPaused?: boolean;
created?: string;
storyId?: number;
title?: string;
};

export type StoriesType = {
username?: string;
profile?: string;
title?: string;
id: number;
stories: StoryType[];
};

Doc:
[{
id: string;
username: string;
title: string;
profile: string;
stories:Array[
{
id: string;
url: string;
type: 'image' | 'video';
duration: number
isReadMore: boolean
storyId: number,
isSeen?: boolean,
}
]
}]

How to modify the progress bar of multistory screen

@simform-solutions @virajpsimformsolutions Given the current constraints of our UI component library, I can presently adjust only the height and color of the progress bar through the provided properties. In order to enhance the user experience and align with our branding, I am interested in rendering a custom animated progress bar. Could you provide guidance or recommendations on how best to develop and implement a bespoke progress bar to replace the default one, ensuring seamless integration with our existing framework?

Wrap FlatList of storyavatar

@mukesh-simform thank you very much for the response earlier. in the props of the avatar

avatarProps={{
    userNameStyle: { fontSize: 16 },
  }}

the story avatars have a overflow of scroll, i want it to wrap instead so there wont be any scroll to left or right, but from top to buttom.
like this
Screenshot 2023-07-26 at 11 27 11 AM

how do i edit that in the avatarProps when theres no prop for the whole Flatlist

Android can not swipe to other story( using MultiStoryContainer)

Hi, I tested with android, I can not swipe to see other story, please see the video attach below:
https://user-images.githubusercontent.com/8202437/210930824-6af44e49-3164-4e0e-b5d4-29b6a41ed3cb.MOV

Here is my code:

<Modal 
          transparent
          visible={focusStory != null}>
             <MultiStoryContainer
              visible
              showSourceIndicator={false}
              isShowReply={false}
              onRequestClose={closeStory}
              statusBarTranslucent={true}
              viewedStories={[]}
              stories={storiesDataTest}
              maxVideoDuration={60}
              onComplete={closeStory} />
        </Modal>

Data sample from your example, It's work normally with ios, smooth swipe

hide seen stories to the left

Screenshot_20230727_002834_Gallery.jpg

after the first story is viewed, and page navigated to a new page.
On return to the stories list, how can i show the stories starting from the second story in the list. the first story would be scrolled to left and frozen on first glimpse, which can be swiped left and right to reveal or conceal previous stories.

Screenshot_20230727_002834_Gallery.jpg

unable to import into node_modules

hello @simform-solutions, @tejas-ardeshna, @BirjuVachhani, @DevarshRanpara
i cloned this repo, added one line change, and decided to import my repo link to my package.json as the version. but it keeps failing. when i add their repo to the node modules i dont get the folders that contain the components. just package.json and readme file appears. theres nothing wrong with internet connection or how i added it. ive been doing it for long. is there any other way to do it ??

Every thing hides and also stops when we click on send message footer

b798b9e9-cfde-4f82-8f05-17e21e0779b0.mp4
  • When we click on send message textInput everything hide and stops also.
  • Also i cannot find method to pause story it is in your documentation but i access it in the in storyContainerProps.
  • Also please add swipe down gesture properly. We have to hold story first then swipe down.

this is my package.json
{
"name": "geeLink",
"version": "0.0.1",
"private": true,
"scripts": {
"android": "react-native run-android",
"ios": "react-native run-ios",
"start": "react-native start",
"test": "jest",
"lint": "eslint .",
"postinstall": "patch-package"
},
"dependencies": {
"@babel/plugin-transform-template-literals": "^7.22.5",
"@baronha/react-native-photo-editor": "^1.1.6",
"@birdwingo/react-native-instagram-stories": "^1.0.7",
"@leafletui/rn-image-video-grid-viewer": "^0.0.4",
"@notifee/react-native": "5.3.0",
"@openspacelabs/react-native-zoomable-view": "^2.1.1",
"@react-native-async-storage/async-storage": "^1.17.4",
"@react-native-community/checkbox": "^0.5.12",
"@react-native-community/clipboard": "^1.5.1",
"@react-native-community/datetimepicker": "^7.0.1",
"@react-native-community/netinfo": "^9.3.0",
"@react-native-community/push-notification-ios": "^1.10.1",
"@react-native-community/slider": "^4.3.2",
"@react-native-firebase/app": "^15.2.0",
"@react-native-firebase/messaging": "^15.2.0",
"@react-native-masked-view/masked-view": "^0.2.6",
"@react-native-picker/picker": "^2.4.1",
"@react-navigation/bottom-tabs": "^6.3.1",
"@react-navigation/native": "^6.1.9",
"@react-navigation/stack": "^6.2.1",
"@rntext/more-or-less": "^2.0.1",
"@twotalltotems/react-native-otp-input": "^1.3.11",
"@zegocloud/react-native-callkeep": "^4.3.9",
"@zegocloud/zego-uikit-prebuilt-call-rn": "^4.2.12",
"@zegocloud/zego-uikit-rn": "^2.3.1",
"axios": "^0.27.2",
"i18next": "^23.3.0",
"lodash": "^4.17.21",
"lottie-ios": "3.4.0",
"lottie-react-native": "^5.1.5",
"moment": "^2.29.3",
"native-base": "^3.4.5",
"patch-package": "^6.4.7",
"postinstall-postinstall": "^2.1.0",
"quickblox-react-native-sdk": "^0.9.1",
"react": "17.0.2",
"react-delegate-component": "^1.0.0",
"react-final-form": "^6.5.0",
"react-i18next": "^13.0.2",
"react-native": "0.68.2",
"react-native-compressor": "^1.6.1",
"react-native-create-thumbnail": "^1.6.4",
"react-native-dropdown-picker": "^5.4.6",
"react-native-encrypted-storage": "^4.0.3",
"react-native-enhanced-popup-menu": "^0.7.0",
"react-native-fade-in-image": "^1.6.1",
"react-native-fast-image": "^8.6.1",
"react-native-fb-image-grid": "^0.0.5",
"react-native-flash-message": "^0.1.15",
"react-native-floating-action": "^1.22.0",
"react-native-geocoding": "^0.5.0",
"react-native-geolocation-service": "^5.3.1",
"react-native-gesture-handler": "^2.4.2",
"react-native-gifted-chat": "^1.0.3",
"react-native-google-places-autocomplete": "^2.5.1",
"react-native-head-tab-view": "^4.0.0-rc.13",
"react-native-image-crop-picker": "^0.36.2",
"react-native-image-viewing": "^0.2.2",
"react-native-incall-manager": "^3.3.0",
"react-native-insta-story": "^1.1.9",
"react-native-keyboard-aware-scroll-view": "^0.9.5",
"react-native-localization": "^2.3.2",
"react-native-maps": "^1.7.1",
"react-native-modal": "^13.0.1",
"react-native-pager-view": "^6.1.0-rc.2",
"react-native-permissions": "^3.8.4",
"react-native-phone-number-input": "^2.1.0",
"react-native-push-notification": "^8.1.1",
"react-native-radial-slider": "^0.0.4",
"react-native-raw-bottom-sheet": "^2.2.0",
"react-native-reanimated": "^3.2.0",
"react-native-responsive-screen": "^1.4.2",
"react-native-restart": "^0.0.27",
"react-native-safe-area-context": "^4.2.5",
"react-native-screens": "^3.13.1",
"react-native-snap-carousel": "^3.9.1",
"react-native-sound": "^0.11.2",
"react-native-splash-screen": "^3.3.0",
"react-native-stories-view": "^1.0.9",
"react-native-story-view": "^0.0.3",
"react-native-svg": "^13.4.0",
"react-native-tab-view": "^3.1.1",
"react-native-tab-view-collapsible-header": "^2.0.1",
"react-native-toast-message": "^2.1.6",
"react-native-vector-icons": "^9.2.0",
"react-native-video": "^5.2.1",
"react-native-video-cache-control": "^1.2.2",
"react-native-video-player": "^0.14.0",
"react-native-voip-push-notification": "^3.1.0",
"react-native-wheel-pick": "^1.2.0",
"react-redux": "^7.2.0",
"redux": "^4.0.5",
"redux-logger": "^3.0.6",
"redux-persist": "^6.0.0",
"redux-saga": "^1.1.3",
"redux-thunk": "^2.4.1",
"reselect": "^4.1.5",
"rn-range-slider": "^2.2.2",
"seamless-immutable": "^7.1.4",
"socket.io-client": "^4.5.0",
"zego-express-engine-reactnative": "3.2.0",
"zego-zim-react-native": "2.10.0",
"zego-zpns-react-native": "2.5.0-alpha"
},
"devDependencies": {
"@babel/core": "^7.23.2",
"@babel/runtime": "^7.17.9",
"@react-native-community/eslint-config": "^3.0.1",
"babel-jest": "^28.1.0",
"eslint": "^8.15.0",
"jest": "^28.1.0",
"metro-react-native-babel-preset": "^0.77.0",
"react-test-renderer": "17.0.2"
},
"jest": {
"preset": "react-native"
}
}

And this my MultiStory Code.

<MultiStory stories={storyData} ref={multiStoryRef} onChangePosition={(progressIndex, userStoryIndex) => { createUserView( storyData[userStoryIndex]?.stories[progressIndex]?.id ); setCurrentStoryID( storyData[userStoryIndex]?.stories[progressIndex]?.id ); console.log( "checkkkkkdkakdka", progressIndex, storyData[userStoryIndex]?.stories[progressIndex]?.id ); }} storyContainerProps={{ renderFooterComponent: ({ userStories, progressIndex, userStoryIndex, }) => { // console.log("--da-d-a-da-d-a", userStories); return userStories?.id == userData?.userID ? ( <> {hadleViewStory ? null : ( <TouchableOpacity onPress={() => { sethadleViewStory(true); // storyRef?.current?.pause(); }} style={{ width: "100%", height: Metrix.VerticalSize(80), backgroundColor: "transparent", justifyContent: "center", alignItems: "center", }} > <Image source={Images.ArrowUp} style={{ width: Metrix.customImageSize(30), height: Metrix.customImageSize(30), }} /> <CustomText.MediumBlackText customStyle={{ color: "#ffffff", }} > {${
storyData[userStoryIndex]?.stories[progressIndex]
?.storiesView?.length || 0
} Views`}
</CustomText.MediumBlackText>

)}

                  {hadleViewStory ? (
                    <View
                      style={{
                        width: "100%",
                        height: screenHeight / 2,
                        backgroundColor: "#fff",
                        justifyContent: "center",
                        alignItems: "center",
                        borderTopLeftRadius: 13,
                        borderTopRightRadius: 13,
                      }}
                    >
                      <TouchableOpacity
                        onPress={() => sethadleViewStory(false)}
                        style={{
                          height: Metrix.VerticalSize(40),
                          width: "100%",
                          // borderWidth:1,
                          alignItems: "center",
                          justifyContent: "center",
                        }}
                      >
                        <Image
                          source={Images.ArrowDown}
                          style={{
                            width: Metrix.customImageSize(30),
                            height: Metrix.customImageSize(30),
                          }}
                        />
                      </TouchableOpacity>
                      <FlatList
                        renderItem={storyViewsRenderItem}
                        keyExtractor={(item) => item?.fullName}
                        data={
                          userStories?.stories[progressIndex]?.storiesView
                        }
                        contentContainerStyle={{
                          paddingHorizontal: Metrix.VerticalSize(10),
                        }}
                      />
                    </View>
                  ) : (
                    <></>
                  )}
                </>
              ) : (
                <>
                  <Footer
                    {...{ userStories }}
                    onSendTextPress={() => {
                      console.log("da--da-d-a-");
                    }}
                    onIconPress={() => {
                      console.log("workin ---------");
                      let body = {
                        storyID: userStories?.stories[progressIndex]?.id,
                        message: storyReplyMessage,
                      };
                      handleStoryReply(body);
                    }}
                    shouldShowTextInputSend={false}
                    value={storyReplyMessage}
                    onChangeText={(replyMessage) => {
                      setStoryReplyMessage(replyMessage);
                    }}
                  />
                  {isSending && (
                    <Animated.View
                      style={{
                        position: "absolute",
                        bottom: 0,
                        // left: screenWidth / 2,
                        backgroundColor: Colors.BlackOpacity(0.6),
                        borderRadius: Metrix.VerticalSize(50),
                        padding: 16,
                        // borderWidth: 1,
                        alignSelf: "center",
                        flexDirection: "row",
                        transform: [
                          {
                            translateY: animation.interpolate({
                              inputRange: [0, 1],
                              outputRange: [100, 0],
                            }),
                          },
                        ],
                      }}
                    >
                      {sentReplyStatusMsg !== "Sent" && (
                        <ActivityIndicator
                          size={"small"}
                          color={"#ffffff"}
                        />
                      )}
                      <CustomText.RegularBlackText
                        customStyle={{
                          color: "#ffffff",
                          marginLeft: Metrix.HorizontalSize(10),
                        }}
                      >
                        {sentReplyStatusMsg}
                      </CustomText.RegularBlackText>
                    </Animated.View>
                  )}
                </>
              );
            },

            renderHeaderComponent: ({
              userStories,
              progressIndex,
              userStoryIndex,
            }) => {
              // console.log("-header", userStories);
              return userStories?.id == userData?.userID ? (
                <>
                  <ProfileHeader
                    userImage={{ uri: userStories?.profile }}
                    userName={userStories?.username}
                    closeIconProps={{
                      source: Images.ThreeDot,
                    }}
                    // containerStyle={{
                    //   backgroundColor: "red",
                    // }}
                    // userMessage={userStories[0]?.title}
                    // onImageClick={() => { }}
                    onClosePress={() => setDelStory((prev) => !prev)}
                    onImageClick={() => {
                      multiStoryRef?.current?.close();
                      setTimeout(
                        () =>
                          NavigationService.navigate("Profile", {
                            userId: userStories?.id,
                          }),
                        200
                      );
                    }}
                  />
                  {delStory && (
                    <TouchableOpacity
                      onPress={() =>
                        storyDelete(userStories, progressIndex)
                      }
                      style={styles.delCot}
                    >
                      <View style={styles.ThreeDotItemImage}>
                        <Image
                          source={Images.Trash}
                          style={styles.ThreeDotItemImageStyles}
                        />
                      </View>
                      <View style={styles.ThreeDotItemTextView}>
                        <Text
                          style={{
                            fontSize: fontsSize.FontSmall,
                            color: Colors.BlackOpacity("0.9"),
                          }}
                        >
                          Delete Story
                        </Text>
                      </View>
                    </TouchableOpacity>
                  )}
                </>
              ) : (
                <ProfileHeader
                  // containerStyle={{
                  //   backgroundColor: "red",
                  // }}
                  // closeIconStyle={{
                  //   backgroundColor: "red",
                  // }}
                  // userMessageStyle={{
                  //   backgroundColor: "red",
                  // }}
                  // userImageStyle={{
                  //   backgroundColor: "red",
                  // }}
                  userImage={{ uri: userStories?.profile }}
                  userName={userStories?.username}
                  // closeIconProps={}
                  // userMessage={userStories[0]?.title}
                  // onImageClick={() => {}}
                  onClosePress={() => multiStoryRef?.current?.close()}
                  onImageClick={() => {
                    multiStoryRef?.current?.close();
                    setTimeout(
                      () =>
                        NavigationService.navigate("Profile", {
                          userId: userStories?.id,
                        }),
                      200
                    );
                  }}
                />
              );
            },
            // renderCustomView: ({
            //   userStories,
            //   progressIndex,
            //   userStoryIndex,
            // }) => {
            //   // console.log("chduaudauduaud", userStories);
            //   return userStories?.stories[progressIndex]?.text ? (
            //     <View
            //       style={{
            //         position: "absolute",
            //         width: screenWidth - 100,
            //         height: screenHeight - 200,
            //         alignSelf: "center",
            //         backgroundColor: 'transparent',
            //         alignItems: "center",
            //         justifyContent: "center",
            //         zIndex: -10,
            //         top: 100,
            //         // alignSelf:'flex-end'
            //       }}
            //     >
            //       <CustomText.MediumBlackText
            //         customStyle={{
            //           color: "#ffffff",
            //         }}
            //       >
            //         {userStories?.stories[progressIndex]?.text || ""}
            //       </CustomText.MediumBlackText>
            //     </View>
            //   ) : (
            //     <></>
            //   );
            // },
            barStyle: {
              barHeight: 2,
              barActiveColor: Colors.Primary,
            },

            // progressViewProps: {
            //   style: {
            //     zIndex: 100,
            //     position: "absolute",
            //     height: 20,
            //     justifyContent: "center",
            //     width: "100%",
            //   },
            // },
          }}
          avatarProps={{
            userNameStyle: {
              fontSize: Metrix.customFontSize(9),
              fontWeight: "700",
              textAlign: "center",
              color: Colors.SecondaryTextColor,
              // borderWidth: 1,
              width: Metrix.customImageSize(60),
            },
            userNameProps: {
              ellipsizeMode: "tail",
              numberOfLines: 1,
            },
            containerStyle: {
              // borderWidth:2
              width: Metrix.customImageSize(60),
              height: Metrix.customImageSize(60),
              marginTop: Metrix.VerticalSize(3),
              borderColor: Colors.Primary,
              alignSelf: "center",
            },
            viewedStoryContainerStyle: {
              borderWidth: 1,
              borderColor: Colors.PrimaryTextColor,
            },
          }}
        />
      `

[feature] FlashList instead of FlatList / suggestions

Hi,

are there any plans to make a more performant solution with FlashList, or is this out of scope for you guys?
I think FlatList at this point is being omitted by most of the devs and while I think your library is neat, I would not use it because of the underlying FlatList library.

FlashList adds another dependency, which I understand, but since this library already has native dependencies, adding FlashList should be really a tiny thing. Usually, everything works out of the box when using FlashList with little changes, most props are supported, some can even be omitted. Usually, just tiny steps are needed to support proper recycling.

I am thinking to fork this project and just adjust to my needs in order to support FlashList - but if you guys are open to support FlashList, we might be able to work on a solution together.

FlatList is only inside MultiStory and MultiStoryContainer, we might be able to just export two different Component and let the user pick. I would take care of supporting FlashList initially if you are interested.

change the default values of the useState variables

hello @dhruv-h-simform
please I want to change the values of a useState in the component of the library without accessing it directly. I imported from the react-native-story-view library, and it has useStates that have default values like

const [pressedIndex, setPressedIndex] = useState(-1);

and

 const [isStoryViewVisible, setIsStoryViewShow] = useState(false);

I want to change isStoryViewVisible default to true, and pressedIndex to 0.

Cant add react-native-video-cache to project.

#Issue Encountered while Adding React-Native-Video-Cache to Project on IOS

I encountered a challenge when attempting to integrate the "react-native-video-cache" package into my IOS project. Following the instructions outlined in the README.md file, I executed the command mentioned below to install the required dependencies:

$ npm install react-native-video react-native-reanimated react-native-gesture-handler react-native-video-cache-control
# --- or ---
$ yarn add react-native-video react-native-reanimated react-native-gesture-handler react-native-video-cache-control

However, I noticed that although the other packages were successfully added to the project dependencies, "react-native-video-cache-control" was missing. Consequently, when I proceeded to build the project, the Metro bundler displayed the following error:
Screenshot 2023-07-12 at 2 15 16 PM

I kindly request assistance in professionally addressing this issue without altering any symbols or information provided.

Thank you for your support.

getting error when clicking on a story. "Cannot add new property __reanimatedHostObjectRef"

Simulator Screenshot - iPhone 14 Pro Max 6 7 - 2023-11-21 at 13 05 41

I am getting this error every time i click on the story.

Here is the code snippet.
// The state
setStoriesCustom(JSON.parse(JSON.stringify(array)));

//The component
<MultiStory
stories={storiesCustom}
transitionMode={TransitionMode.Cube}
ItemSeparatorComponent={() => }
ref={multiStoryRef}
/* callback after multi story is closed
viewedStories contains multi dimension array of booleans whether story is seen or not
*/
onComplete={closeStory}
avatarProps={{
viewedStoryContainerStyle: {
borderColor: Colors.lightGrey,
},
}}
storyContainerProps={{
renderHeaderComponent: ({userStories}) => (
<Header {...{userStories, multiStoryRef}} />
),
renderFooterComponent: ({userStories, story, progressIndex}) => (
<Footer {...{userStories, story, progressIndex}} />
),
renderIndicatorComponent: () => ,
barStyle: {
barActiveColor: Colors.red,
},
}}
/>

ReanimatedError: Tried to synchronously call a non-worklet function on the UI thread.

I'm using the MultiStoryContainer like below:

{isStoryViewVisible && (
      <MultiStoryContainer
       visible={isStoryViewVisible}
	onComplete={() => setIsStoryViewShow(false)}
	userStoryIndex={pressedIndex}
	stories={storiesData}
	imageStyle={{
	    height: '100%',
	}}
	renderFooterComponent={undefined}
	barStyle={{
	    barHeight: 2,
	    barInActiveColor: '#fff',
	    barActiveColor: '#F2C80A',
	}}
	/>
)}

it shows the story without any problem but in my console I receive the following error and after that my whole animations of the screen stops working :

ReanimatedError: Tried to synchronously call a non-worklet function on the UI thread.

Possible solutions are:
  a) If you want to synchronously execute this method, mark it as a worklet
  b) If you want to execute this function on the JS thread, wrap it using `runOnJS`, js engine: reanimated
"react-native-reanimated": "^3.3.0",
"react-native-story-view": "^0.0.3",

Pause doesn't work when on hold pressing

Hi there, thanks for your great effort with this awesome package. It works great and smooth.

I have one question, when i press on hold the story view it doesn't pause the video or image. Is there a property that i am not passing or is there any extra step to use the pause feature ?
I tried to pause the story from ref too.

Here is my story container;

<StoryContainer
              visible
              maxVideoDuration={10}
              stories={userStories[0].stories}
 />

package.json
"react-native": "0.71.4",
"react-native-story-view": "^1.0.0"

Screen.Recording.2024-02-09.at.10.16.41.mov

Custom View Cannot Click (No response when Click CustomView)

Hi there,
I create customview like this :

renderCustomView={() => ( <Pressable onPress={() => { console.log('Pressed); }} style={{ position: 'absolute', top: 40, right: 50, }}> <FontAwesome5Icon name='menu-horizontal' size={20} color='white'/> </Pressable> )}

But nothing happen when I press the Icon.
Any solution for this case?

Package.json:

"react-native-gesture-handler": "2.9.0",
"react-native-reanimated": "^2.14.4",
"react-native-story-view": "^0.0.2",
"react-native-video": "^5.2.1",
"react-native-video-cache-control": "^1.2.0",

horizontalview layout issues

Hi, thanks for great lib. Today I tested the IOS app in landscape mode but I got this problem, can u help?

IMG_A2B6E1730038-1

with portrait it work fine

IMG_DCFF50758A3D-1

I am using MultiStoryContainer

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.