Guest User

Untitled

a guest
Feb 16th, 2019
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. export default class CustomGraphComponent extends React.Component {
  2.  
  3. constructor(props) {
  4. super(props);
  5. this.state = {
  6. selectedOption: iconsData[0]
  7. };
  8. }
  9.  
  10. handleSelect = (eventKey) => {
  11. this.props.onSelectOption(iconsData[eventKey]);
  12. console.log(iconsData[eventKey]);
  13. this.setState({ selectedOption: iconsData[eventKey] });
  14.  
  15. }
  16.  
  17. render() {
  18. var {onSelectOption} = this.props;
  19.  
  20. return (
  21. <div style={{paddingTop:20}} >
  22. <DropdownButton title ={this.state.selectedOption} onSelect={this.handleSelect} >
  23. {
  24. iconsData.map((indexName, i) => {
  25. return (
  26. <MenuItem key={i} eventKey={i}>
  27. {indexName}
  28. </MenuItem>
  29. );
  30. })
  31. }
  32. </DropdownButton>
  33.  
  34. </div>
  35. );
  36. }
  37. }
  38. CustomGraphComponent.propTypes = {
  39. onSelectOption : PropTypes.func
  40. }
Add Comment
Please, Sign In to add comment