- handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {
- const [base, fraction] = event.target.value.split('.');
- this.setState({ endsWithDecimalSeparator: fraction === '' });
- this.props.input.onChange(event);
- }
-
- render() {
- const props = {
- ...this.props,
- input: {
- ...this.props.input,
- value: this.props.input.value + (this.state.endsWithDecimalSeparator ? '.' : ''),
- onChange: this.handleChange,
- },
- };
- return <GenericInput
- component={Input}
- {...props} />;
- }
-}