How to use the simple-react-form.ArrayComponent.defaultProps function in simple-react-form

To help you get started, we’ve selected a few simple-react-form examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github nicolaslopezj / simple-react-form / material-ui / src / fields / array.jsx View on Github external
label: {
    color: 'rgba(0,0,0,0.5)',
    marginBottom: 5,
    fontSize: 12,
  },
};

const propTypes = {
  ...ArrayComponent.propTypes,
  parentClassName: React.PropTypes.string,
  childrenClassName: React.PropTypes.string,
  useSmallSpace: React.PropTypes.bool,
};

const defaultProps = {
  ...ArrayComponent.defaultProps,
  childrenClassName: '',
  parentClassName: '',
  useSmallSpace: false,
};

export default class MaterialArray extends ArrayComponent {
  renderChildrenItem({ index, component }) {
    if (this.props.useSmallSpace) return this.renderChildrenSmallItem({ index, component });
    return (
      <div className={this.props.childrenClassName} key={`${this.props.fieldName}.${index}`}>
        <Paper style={{ marginTop: 20, marginBottom: 20, padding: 20 }}>
          {component}
          <div style={{ marginTop: 10, textAlign: 'right' }}>
            {this.renderRemoveButton(index)}
          </div>
        </Paper>
github nicolaslopezj / simple-react-form-material-ui / src / array.jsx View on Github external
color: 'rgba(0,0,0,0.5)',
    marginBottom: 5,
    fontSize: 12
  }
}

const propTypes = {
  ...ArrayComponent.propTypes,
  parentClassName: React.PropTypes.string,
  childrenClassName: React.PropTypes.string,
  useSmallSpace: React.PropTypes.bool,
  smallRemoveButtonTooltipPosition: React.PropTypes.string
}

const defaultProps = {
  ...ArrayComponent.defaultProps,
  childrenClassName: '',
  parentClassName: '',
  useSmallSpace: false,
  smallRemoveButtonTooltipPosition: 'bottom-center'
}

export default class MaterialArray extends ArrayComponent {

  renderChildrenItem ({ index, children }) {
    if (this.props.useSmallSpace) return this.renderChildrenSmallItem({ index, children })
    return (
      <div className={this.props.childrenClassName} key={`${this.props.fieldName}.${index}`}>
        <Paper style={{ marginTop: 20, marginBottom: 20, padding: 20 }}>
          {this.renderChildrenItemWithContext({index, children})}
          <div style={{ marginTop: 10, textAlign: 'right' }}>
            {this.renderRemoveButton(index)}