yuvraj24 / react-native-stories-view

A simple and fully customizable React Native component that implements a status/stories feature similar to Whatsapp & Instagram ⭐✨🌟
MIT License
416 stars 62 forks source link

This would help to add multiple user stories using this single container #52

Open rahul-mahato opened 1 year ago

rahul-mahato commented 1 year ago

Hi! πŸ‘‹

Firstly, thanks for your work on this project! πŸ™‚

Today I used patch-package to patch react-native-stories-view@1.0.9 for the project I'm working on.

Here is the diff that solved my problem:

diff --git a/node_modules/react-native-stories-view/src/stories/StoryContainer.tsx b/node_modules/react-native-stories-view/src/stories/StoryContainer.tsx
index 7abad0d..7439285 100644
--- a/node_modules/react-native-stories-view/src/stories/StoryContainer.tsx
+++ b/node_modules/react-native-stories-view/src/stories/StoryContainer.tsx
@@ -30,8 +30,8 @@ const StoryContainer = (props: StoryContainerProps) => {

    useEffect(() => {
        // Alert.prompt("Called")
-       setProgressIndex(progressIndex);
-   }, [props.enableProgress]);
+       if(props.enableProgress ){ setProgressIndex(0); }
+   }, [props.enableProgress, props.toggleProgressFromStart]);

    useEffect(() => {
        let listener1 = Keyboard.addListener("keyboardDidShow", onShowKeyboard);
@@ -149,7 +149,7 @@ const StoryContainer = (props: StoryContainerProps) => {
                        duration={props.duration ? props.duration : DEFAULT_DURATION}
                        barStyle={props.barStyle}
                        progressIndex={progressIndex}
-                       onChange={(position: number) => onChange(position)}
+                       onChange={onChange}
                    />
                </View>
            </View>
diff --git a/node_modules/react-native-stories-view/src/utils/interfaceHelper.tsx b/node_modules/react-native-stories-view/src/utils/interfaceHelper.tsx
index 45ddbad..5b3191d 100644
--- a/node_modules/react-native-stories-view/src/utils/interfaceHelper.tsx
+++ b/node_modules/react-native-stories-view/src/utils/interfaceHelper.tsx
@@ -23,7 +23,7 @@ export interface StoryContainerProps extends CommonProps {
     isShowReply?: boolean | undefined,
     duration?: number | undefined,
     barStyle?: BarStyleProps | undefined,
- 
+    toggleProgressFromStart?: boolean | undefined,
     headerComponent?: FunctionComponentElement<CommonProps> | undefined
     userProfile?: UserProps | undefined

This issue body was partially generated by patch-package.