palantir/blueprint

NumericInput controlled mode warns about invalid value too often

Open

#4 327 ouverte le 10 sept. 2020

Voir sur GitHub
 (1 commentaire) (9 réactions) (0 assignés)TypeScript (2 167 forks)batch import
P2Package: coreType: enhancementhelp wanted

Métriques du dépôt

Stars
 (20 263 stars)
Métriques de merge PR
 (Merge moyen 43j 10h) (27 PRs mergées en 30 j)

Description

Environment

  • Package version(s): core 3.31.0

Steps to reproduce

  1. set up <NumericInput value={this.state.value} onChange={(_v, value) => this.setState({ value })) />
  2. type 0.

Actual behavior

in dev mode, the component complains that

<NumericInput> controlled value prop does not adhere to stepSize, min, and/or max constraints. 

2020-09-10 13 38 22

Expected behavior

this should be allowed. what it actually means is that the string passed was not a full numeric entity, but it can still be parsed as a valid number, so it's ok.

Possible solution

change the validation logic

Guide contributeur