GithubHelp home page GithubHelp logo

nohomey / material-ui-number-input Goto Github PK

View Code? Open in Web Editor NEW
29.0 3.0 8.0 1.25 MB

The <TextField type="number" /> that user really expects.

Home Page: http://nohomey.github.io/material-ui-number-input

License: MIT License

TypeScript 91.63% JavaScript 8.37%
typescript typescript-library react react-components react-library input

material-ui-number-input's People

Contributors

dav-ell avatar falldi avatar nohomey avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

material-ui-number-input's Issues

Fix all bugs introduced with 5.0.13 and 5.0.12

There have been several bugs introduced with 5.0.13 and 5.0.12 releases:

Both 5.0.12 5.0.13 and tried to fix a bug where onError, onValid and onRequestValue are not called when either of there props: min, max, required and strategy changes. But instead they just introduced more bugs which let to onError to not be called on time and old props to be used.

The fix of these bugs is to change all methods that reference this.props to accept props: NumberInputProps argument passed to them which means that those methods that don't reference this other than for props should be made static.

Hint text not behaving correctly

If you have a completely blank field with strategy set to ignore, the hint text is shown. Then, type a letter. The hint text is gone, yet there is still nothing in the box.

input type is text

This looks very promising and I'm happy to have found it. I completely agree a user expects an input type of number, however when I have tried this, and inspected it, it shows it as being of type="text". I see this how it's set in NumberInput.js as well.

I also tried your demo from my phone, where I'd expect the input to bring up a number pad and it does not. Perhaps I've done something wrong. Please let me know if I'm missing something here.

Thanks and regards

Dependency on material-ui 0.17.x

material-ui-number-input specifies a dependency on material-ui of ^0.17.x which effectively locks the dependency to the older 0.17.* versions of material-ui, and in turn locks any application that uses number-input.

If that in not intentional, and versions 0.18.* are compatible, the dependency could be specified as >0.17.1 instead.

Does this package work with stateless components?

Hi, I'm getting the following errors when calling <NumberInput> within a stateless component.

const X = () => (
  <NumberInput ...>
);

Warning: Stateless function components cannot be given refs. Attempts to access this ref will fail.
Check the render method of `NumberInput`.

Uncaught TypeError: Cannot read property 'getInputNode' of undefined

Is this correct? I think the package should work with stateless components.

JSX element type 'NumberInput' is not a constructor function for JSX elements. Types of property 'setState' are incompatible.

Using [email protected], [email protected], material-ui@^0.18.3, @ types/material-ui@^0.17.11.

Stacktrace:

(99,21): error TS2605: JSX element type 'NumberInput' is not a constructor function for JSX elements.
  Types of property 'setState' are incompatible.
    Type '{ <K extends never>(f: (prevState: void, props: NumberInputProps) => Pick<void, K>, callback?: ()...' is not assignable to type '{ <K extends never>(f: (prevState: {}, props: any) => Pick<{}, K>, callback?: () => any): void; <...'.
      Types of parameters 'f' and 'f' are incompatible.
        Type '(prevState: {}, props: any) => Pick<{}, any>' is not assignable to type '(prevState: void, props: NumberInputProps) => Pick<void, any>'.
          Types of parameters 'prevState' and 'prevState' are incompatible.
            Type 'void' is not assignable to type '{}'.

How I used it:

<NumberInput
    required
    hintText="Rate ($/hour)"
    floatingLabelText="Rate ($/hour)"
    strategy="warn"
    min={0}
    errorText={this.state.rateError}
    fullWidth
    value={this.state.rate}
    onChange={(e: React.FormEvent<HTMLInputElement>, value: string) => this.setState({ rate: value })}
    onValid={valid => this.setState({ validRate: valid })}
    onRequestValue={value => this.setState({ rate: value })}
    onError={this.onError}
/>

I believe this happened on upgrade from @ types/material-ui@^0.17.10 to @ types/material-ui@^0.17.11.

Love the component!

Why does onChange return a string?

I thought with this being a NumberInput, that the onChange event would return a valid number rather than a string value?

Is this something in the pipeline?

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.