All Downloads are FREE. Search and download functionalities are using the official Maven repository.

components.controls.Select.Select.jsx Maven / Gradle / Ivy

There is a newer version: 7.27.7
Show newest version
import React from 'react';
import PropTypes from 'prop-types';
import Select from '@atlaskit/select';

class SelectExample extends React.Component {
  constructor(props) {
    super(props);
    this.state={
      value: this.props.options.find((option) => option.value === this.props.value)
    };

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

  onChange(target) {
    this.setState({
      value: target
    });

    if (this.props.onChange) {
      this.onChange(target)
    }
  }

  render() {
    const {
      autoFocus,
      disabled,
      options
    } = this.props;

    return (