react-numeric
react-numeric copied to clipboard
Ctr+a and delete can not fire change event
When I ctr+a and press delete button, sometimes I see it can not fire change event, please let me know how to fix this.
I see your code is too complicated to manage, I rewrite this very simple but it resolves my problem. I think this problem may be happen in getValue function, nothing return when this.autonumeric is can not find.
import React from "react";
import AutoNumeric from "autonumeric";
export class Numeric extends React.Component {
constructor(props) {
super(props);
}
componentDidMount() {
this.numeric = new AutoNumeric(this.input, {
currencySymbol : '$',
onInvalidPaste: 'truncate'
});
}
componentWillUnmount() {
this.numeric.remove();
}
render() {
return (
<input
type="text"
ref={ref => this.input = ref}
className="bp3-input"
onChange={e => console.log(e.target.value)}
/>
);
}
}
Numeric.defaultProps = {
type: "text",
outputFormat: "number",
preDefined: {},
className: "asdf",
};