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

How can I clear already written code? #129

Open
blockfan7 opened this issue Apr 28, 2021 · 3 comments
Open

How can I clear already written code? #129

blockfan7 opened this issue Apr 28, 2021 · 3 comments

Comments

@blockfan7
Copy link

If the activation code is wrong, I would like to clear the written code.
I put "value" variable to props.
And set the "value" to "" if the activation code is wrong.
But it's not working.

"value" is working for only first time, seems it works like defaultValue.

Please help me to clear already written code.
Thank you.

@rmlevangelio
Copy link

I'm also curious how to clear text.

@rmlevangelio
Copy link

Duplicate: #69

acusti added a commit to acusti/react-code-input that referenced this issue Oct 15, 2021
…#129

makes it possible to reset ReactCodeInput’s internal state and the values it renders in its inputs by passing in an updated this.props.value
acusti added a commit to acusti/react-code-input that referenced this issue Oct 15, 2021
acusti added a commit to acusti/react-code-input that referenced this issue Oct 15, 2021
…#129

makes it possible to reset ReactCodeInput’s internal state and the values it renders in its inputs by passing in an updated this.props.value
acusti added a commit to acusti/react-code-input that referenced this issue Oct 15, 2021
acusti added a commit to acusti/react-code-input that referenced this issue Oct 15, 2021
…#129

makes it possible to reset ReactCodeInput’s internal state and the values it renders in its inputs by passing in an updated this.props.value
acusti added a commit to acusti/react-code-input that referenced this issue Oct 15, 2021
acusti added a commit to acusti/react-code-input that referenced this issue Oct 15, 2021
…#129

makes it possible to reset ReactCodeInput’s internal state and the values it renders in its inputs by passing in an updated this.props.value
acusti added a commit to acusti/react-code-input that referenced this issue Oct 15, 2021
acusti added a commit to acusti/react-code-input that referenced this issue Oct 15, 2021
acusti added a commit to acusti/react-code-input that referenced this issue Oct 15, 2021
…#129

makes it possible to reset ReactCodeInput’s internal state and the values it renders in its inputs by passing in an updated this.props.value
acusti added a commit to acusti/react-code-input that referenced this issue Oct 15, 2021
acusti added a commit to acusti/react-code-input that referenced this issue Oct 15, 2021
…#129

makes it possible to reset ReactCodeInput’s internal state and the values it renders in its inputs by passing in an updated this.props.value
acusti added a commit to acusti/react-code-input that referenced this issue Oct 15, 2021
acusti added a commit to acusti/react-code-input that referenced this issue Oct 15, 2021
…#129

makes it possible to reset ReactCodeInput’s internal state and the values it renders in its inputs by passing in an updated this.props.value
acusti added a commit to acusti/react-code-input that referenced this issue Oct 15, 2021
@acusti
Copy link

acusti commented Oct 15, 2021

i made some updates to support this feature request. here’s a very simple example where the reset is triggered by a “Clear” button:

function Clearable() {
    const [value, setValue] = React.useState(null);

    return (
        <React.Fragment>
            <ReactCodeInput onChange={() => setValue(null)} value={value} />
            <button onClick={() => setValue('')}>Clear</button>
        </React.Fragment>
    );
}

you can try it out via npm i @acusti/react-code-input or yarn add @acusti/react-code-input

acusti added a commit to acusti/react-code-input that referenced this issue Oct 16, 2021
…#129

makes it possible to reset ReactCodeInput’s internal state and the values it renders in its inputs by passing in an updated this.props.value
acusti added a commit to acusti/react-code-input that referenced this issue Oct 16, 2021
acusti added a commit to acusti/react-code-input that referenced this issue Oct 16, 2021
…#129

makes it possible to reset ReactCodeInput’s internal state and the values it renders in its inputs by passing in an updated this.props.value
acusti added a commit to acusti/react-code-input that referenced this issue Oct 16, 2021
acusti added a commit to acusti/react-code-input that referenced this issue Jun 22, 2022
…#129

makes it possible to reset ReactCodeInput’s internal state and the values it renders in its inputs by passing in an updated this.props.value
acusti added a commit to acusti/react-code-input that referenced this issue Jun 22, 2022
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

3 participants