Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ctr+a and delete can not fire change event #12

Open
namnguyen2091 opened this issue Mar 14, 2020 · 1 comment
Open

Ctr+a and delete can not fire change event #12

namnguyen2091 opened this issue Mar 14, 2020 · 1 comment

Comments

@namnguyen2091
Copy link

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.

@namnguyen2091
Copy link
Author

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",
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant