Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Infinite increasing if disable and readOnly input right after the click. #112

Open
vitpankin opened this issue May 3, 2019 · 1 comment

Comments

@vitpankin
Copy link

vitpankin commented May 3, 2019

    onMouseDown(dir: "up"|"down", callback?: Function): void
    {
        if (dir == 'down') {
            this.decrease(false, callback);
        }
        else if (dir == 'up') {
            this.increase(false, callback);
        }
    }

after click in increase call you set a looping increase call for a long press as I understood

        if (isNaN(this.state.value) || +this.state.value < _max) {
            this._timer = setTimeout(() => {
                this.increase(true);
            }, _recursive ? NumericInput.SPEED : NumericInput.DELAY);
        }

but sometimes in complex forms I have to get new data from API and there's a need to disable Field until getting a response. So if I set input props disable or readOnly to true right after click (which is pretty common I believe not only for my case) input doesn't stops interval and it starts to increasing value infinitely.

@vitpankin
Copy link
Author

made a pull request
#113

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

No branches or pull requests

1 participant