<commit_before>import React from 'react';
import PropTypes from 'prop-types';
import { forbidExtraProps } from 'airbnb-prop-types';
import { Grid, Row, Col, FormGroup, FormControl, Button, ButtonToolbar } from 'react-bootstrap';

const propTypes = forbidExtraProps({
  onSubmit: PropTypes.func,
  value: PropTypes.string,
});

export const defaultProps = {
  onSubmit: () => {},
  value: '',
};


export default class TextBox extends React.Component {
  constructor(props) {
    super(props);

    this.placeholder = '请输入...';
    this.state = {
      value: props.value,
    };

    this.handleChange = this.handleChange.bind(this);
  }

  componentDidMount() {
  }

  /**
   *
   *
   * @param {any} nextProps
   *
   * @memberof TextBox
   */
  componentWillReceiveProps(nextProps) {
    if (nextProps.value !== this.state.value) {
      this.setState({
        value: nextProps.value,
      });
    }
  }

  /**
   *
   *
   * @param {any} nextProps
   * @param {any} nextState
   *
   * @memberof TextBox
   */
  // shouldComponentUpdate() {
  // }

  /**
   *
   *
   * @param {any} prevProps
   * @param {any} prevState
   *
   * @memberof TextBox
   */
  componentDidUpdate() {
  }

  handleChange(event) {
    this.setState({
      value: event.target.value,
    });
  }

  render() {
    return (
      <div>
        <Grid fluid>
          <Row>
            <Col xs={10} md={10}>
              <FormGroup controlId="formControlsTextarea">
                {/* <ControlLabel>Textarea</ControlLabel>*/}
                <FormControl
                  componentClass="textarea"
                  inputRef={(c) => { this.textarea = c; }}
                  placeholder={this.placeholder}
                  value={this.state.value}
                  onChange={this.handleChange}
                /><commit_msg>make textbox auto height<commit_after>import React from 'react';
import PropTypes from 'prop-types';
import { forbidExtraProps } from 'airbnb-prop-types';
import { Grid, Row, Col, FormGroup, FormControl, Button, ButtonToolbar } from 'react-bootstrap';

const propTypes = forbidExtraProps({
  onSubmit: PropTypes.func,
  value: PropTypes.string,
});

export const defaultProps = {
  onSubmit: () => {},
  value: '',
};


export default class TextBox extends React.Component {
  constructor(props) {
    super(props);

    this.placeholder = '请输入...';
    this.state = {
      value: props.value,
    };

    this.handleChange = this.handleChange.bind(this);
  }

  componentDidMount() {
  }

  /**
   *
   *
   * @param {any} nextProps
   *
   * @memberof TextBox
   */
  componentWillReceiveProps(nextProps) {
    if (nextProps.value !== this.state.value) {
      this.setState({
        value: nextProps.value,
      });
    }
  }

  /**
   *
   *
   * @param {any} nextProps
   * @param {any} nextState
   *
   * @memberof TextBox
   */
  // shouldComponentUpdate() {
  // }

  /**
   *
   *
   * @param {any} prevProps
   * @param {any} prevState
   *
   * @memberof TextBox
   */
  componentDidUpdate() {
  }

  handleChange(event) {
    this.setState({
      value: event.target.value,
    });
  }

  render() {
    // 让输入框高度自动
    // How can I make Bootstrap columns all the same height?
    // https://stackoverflow.com/a/22892773/4685522
    return (
      <div>
        <Grid fluid>
          <Row style={{ display: 'flex', flexWrap: 'wrap' }}>
            <Col xs={10} md={10}>
              <FormGroup controlId="formControlsTextarea" style={{ height: '100%' }}>
                {/* <ControlLabel>Textarea</ControlLabel>*/}
                <FormControl
                  style={{ height: '100%' }}
                  componentClass="textarea"
                  inputRef={(c) => { this.textarea = c; }}
                  placeholder={this.placeholder}
                  value={this.state.value}
                  onChange={this.handleChange}
                />
{'fraction_non_alphanumeric': 0.1438144329896907, 'fraction_numerical': 0.007474226804123712, 'mean_word_length': 2.1072858286629303, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 23, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5365491', 'n_tokens_mistral': 1248, 'n_tokens_neox': 1205, 'n_words': 234}