DefinitelyTyped/types/react-numeric-input/react-numeric-input-tests.tsx
Aarni Koskela 30b5b642f9 [react-numeric-input] Fix up typing:
* No longer inherit from deprecated React.Props
* Derive from React.InputHTMLAttributes<HTMLInputElement> to avoid duplication
* Fix min/max/precision/step props
* Fix the type of the "numeric value" state; it can be `null`
* Clean out `any`s
* Expose the internal state (as used by function props)
2018-08-30 12:42:21 +03:00

19 lines
512 B
TypeScript

import { Component } from 'react';
import NumericInput = require('react-numeric-input');
export class NumericInputTest extends Component {
render() {
return (
<NumericInput
min={-10}
max={(comp) => (comp.state.value || 1) + 1}
format={(x) => `EUR ${x}`}
parse={(s) => parseFloat(s.replace(/EUR /, ''))}
step={(comp, dir) => (dir === NumericInput.DIRECTION_UP ? 9 : 1)}
style={{wrap: {color: 'orange'}}}
className="hello"
/>
);
}
}