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

[TextField] Multiline TextField value cannot be reset using '' #8565

Closed
1 task done
Dreykodoon opened this issue Oct 6, 2017 · 3 comments
Closed
1 task done

[TextField] Multiline TextField value cannot be reset using '' #8565

Dreykodoon opened this issue Oct 6, 2017 · 3 comments
Labels
component: TextareaAutosize The React component. duplicate This issue or pull request already exists

Comments

@Dreykodoon
Copy link

  • I have searched the issues of this repository and believe that this is not a duplicate.

Expected Behavior

I would expect that when I programmatically set the value of the multiline TextField to '', the text inside it would disappear.

Current Behavior

Currently, the previous value inside the multiline TextField is NOT being cleared after setting the value to ''.

Steps to Reproduce

You can directly reproduce the bug here: https://codesandbox.io/s/wwpojv800k

  1. Type something in the multiline TextField.
  2. Press the Reset button

Results:
The content of the multiline TextField is not cleared.

Here is a very simple component you can directly add to your code to reproduce the bug:

import React from 'react';
import TextField from 'material-ui/TextField';
import Button from 'material-ui/Button';

class Test extends React.Component {
    constructor() {
        super();

        this.state = {
            content: '',
        };
    }

    handleChange() {
        return (event) => {
            this.setState({content: event.target.value});
        };
    }

    resetContent() {
        this.setState({content: ''});
    }

    render() {
        return (
            <div>
                <TextField onChange={this.handleChange()} value={this.state.content} rows='5' rowsMax='5' label='Content' multiline fullWidth/>
                <Button raised onClick={this.resetContent.bind(this)}>Reset</Button>
            </div>
        );
    }
}

export default Test;

Your Environment

Tech Version
Material-UI 1.0.0-beta.13
React 15.6.1
browser Firefox 56.0 (32-bit), Firefox Dev Edition 57.0b5 (64-bit), Chrome 61.0.3163.100 (64 bit)
@istarkov
Copy link
Contributor

istarkov commented Oct 6, 2017

I'm 99.99% sure this is fixed here https://github.com/callemall/material-ui/pull/8557/files#diff-deaeb5c7e253bfa4f497fa8ace0b3607L564
And will be available with next material-ui release.

@Dreykodoon
Copy link
Author

I'm not familiar with the code, but seems to be the case. Thanks!

@oliviertassinari oliviertassinari added the duplicate This issue or pull request already exists label Oct 6, 2017
@oliviertassinari
Copy link
Member

I confirm, it's a duplicate. We will cut a new release this week-end with the fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: TextareaAutosize The React component. duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

3 participants