Code Monkey home page Code Monkey logo

Comments (7)

darenju avatar darenju commented on August 28, 2024

Hello @mcarreon, you can use the onPageChange callback to re-enable your button. On click, use a state entry that holds either the button can be clicked (e.g. canClick), set it to false, and assign your disabled prop on button accordingly (!canClick). On the onPageChange callback, re-enable the button by setting canClick state member to true.

from react-flip-page.

mcarreon avatar mcarreon commented on August 28, 2024

from react-flip-page.

darenju avatar darenju commented on August 28, 2024

@mcarreon Just put it in an actual button tag, it's better for UX anyway.

But I agree there should be a state property inside the FlipPage component that says if you can move or not. Going to work on that.

from react-flip-page.

darenju avatar darenju commented on August 28, 2024

I made a fix for this in v1.2.2. @mcarreon Care to check out?

from react-flip-page.

mcarreon avatar mcarreon commented on August 28, 2024

I haven't converted them to buttons yet, will do that soon, thanks for the suggestion.

I tried it out, the issue still seems to happen. Is there a way to block the page index changing on method spam? The pages are double incrementing on double click

I think the animation bug might be due to these lines in index.jsx, as the animation seems to cancel on a second method press.

    const gotoPreviousPage = (e) => {
      this.stopMoving(e);
      this.gotoPreviousPage();
    };
    const gotoNextPage = (e) => {
      this.stopMoving(e);
      this.gotoNextPage();
    };

I'll be working on it, I'll let you know if I figure out anything

from react-flip-page.

darenju avatar darenju commented on August 28, 2024

So, has the behavior actually changed? Is there any evolution from what was done before?

The index shouldn't even change before the previous animation has completed.

from react-flip-page.

mcarreon avatar mcarreon commented on August 28, 2024

Visually the behavior is the same as before, I did see the added canAnimate state toggle from true to false.
It seemed like the index changed after the animation completed, but the spammed increments still went through

from react-flip-page.

Related Issues (20)

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.