react-insta-stories icon indicating copy to clipboard operation
react-insta-stories copied to clipboard

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

Open d-string opened this issue 1 year ago • 1 comments

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

d-string avatar Apr 19 '23 11:04 d-string

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

vercel[bot] avatar Apr 19 '23 11:04 vercel[bot]