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

Unable to enter minus "-" sign manually when there is a callback method in onChange() #122

Open
mpeng opened this issue Jan 17, 2020 · 0 comments

Comments

@mpeng
Copy link

mpeng commented Jan 17, 2020

Below is my code. Once the this.props.callbackFromParent(a); is added, it won't take "-" sign if I don't change the default value from "0.0" to something like "2.0" first. However if I comment out this.props.callbackFromParent(a); then I am able to enter "-" before "0.0", without any issues.

I just could not figure out how the callback method can cause the issue.

  test = (a) => {
       console.log(a);
       // ToDo Why with below line, the minus "-" sign can not be entered.**
       this.props.callbackFromParent(a);
  }

  render() {
    const { o } = this.state;

    return (
    <NumericInput
        value={o}
        format={o => o}
        onChange={this.test}
        precision={this.props.precision}
        size={8}
        step={this.props.step}
        mobile={false}
        min={this.props.min}
        max={this.props.max}

Here is the version I am using:
"react-numeric-input": "^2.2.3

This is an important requirement for my app. My users often want to enter a negative number manually using keyboard without using arrows first.

Please help when you can,

Thanks

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