mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
* 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)
19 lines
512 B
TypeScript
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"
|
|
/>
|
|
);
|
|
}
|
|
}
|