Advertisement
ahmadandika

CustomOption;

Jul 1st, 2019
186
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /* eslint-disable jsx-a11y/no-static-element-interactions */
  2. /* eslint-disable class-methods-use-this */
  3. import React, { Component } from 'react';
  4. import { components } from 'react-select';
  5.  
  6. class CustomOption extends Component {
  7.   constructor(props) {
  8.     super(props);
  9.     this.state = {};
  10.     this.handleMouseDown = this.handleMouseDown.bind(this);
  11.     this.handleTouchEnd = this.handleTouchEnd.bind(this);
  12.   }
  13.  
  14.   handleMouseDown(event) {
  15.     event.preventDefault();
  16.     event.stopPropagation();
  17.     // this.props.onSelect(this.props.option, event);
  18.   }
  19.  
  20.   handleTouchEnd(event) {
  21.     event.preventDefault();
  22.     event.stopPropagation();
  23.   }
  24.  
  25.   render() {
  26.     const { data, innerProps, innerRef } = this.props;
  27.     return (
  28.       <div
  29.         className="rs-option needsclick"
  30.         ref={innerRef}
  31.         onMouseDown={this.handleMouseDown}
  32.         onMouseEnter={this.handleMouseEnter}
  33.         onMouseMove={this.handleMouseMove}
  34.         onTouchEnd={this.handleTouchEnd}
  35.         {...innerProps}
  36.       >
  37.         {data.label}
  38.       </div>
  39.     );
  40.   }
  41. }
  42.  
  43. export default CustomOption;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement