Skip to content

fix: can't go previous stories when stories has ended#278

Open
d-strygwyr wants to merge 1 commit intomohitk05:masterfrom
d-strygwyr:master
Open

fix: can't go previous stories when stories has ended#278
d-strygwyr wants to merge 1 commit intomohitk05:masterfrom
d-strygwyr:master

Conversation

@d-strygwyr
Copy link
Copy Markdown

@d-strygwyr d-strygwyr commented Apr 19, 2023

Reproduce:

trying with this link https://stackblitz.com/edit/react-insta-stories-mr9yer?file=src%2FApp.js with the latest version

  • when stories have finished, then when I want to go to previous stories, the stories won't back to the previous.
  • props loop={false]

and when i look at the code, i found this on components/Container.tsx

my suggestion in func

  const setCurrentIdWrapper = (callback) => {
    setCurrentId(callback);
    toggleState("pause", true);
  };

and

  const mouseUp =
    (type: string) => (e: React.MouseEvent | React.TouchEvent) => {
      e.preventDefault();
      mousedownId.current && clearTimeout(mousedownId.current);
      if (pause) {
        toggleState("play");
      } else {
        type === "next" ? next() : previous();
      }
    };

when i try to modify the mouseUp func, the problem is if i hold for a pause in the next area, when i up the mouse, function next() will triggered, and otherwise

so i choose remove toggleState("pause", true); on setCurrentIdWrapper func instead

@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 19, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
react-insta-stories ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 19, 2023 11:59am

Copy link
Copy Markdown

@AleTid5 AleTid5 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants