react-numeric-input icon indicating copy to clipboard operation
react-numeric-input copied to clipboard

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

Open vitpankin opened this issue 6 years ago • 1 comments

    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 avatar May 03 '19 01:05 vitpankin

made a pull request https://github.com/vlad-ignatov/react-numeric-input/pull/113

vitpankin avatar May 05 '19 15:05 vitpankin