import React from 'react' ; import classnames from 'classnames' ; import { CommonSelectProps } from './BaseSelect' ; type RefCallback < T > = ( node : T | null ) => void ; export interface NativeSelectProps extends CommonSelectProps , React . HTMLProps < HTMLSelectElement > { innerRef ? : RefCallback < HTMLSelectElement > | React . RefObject < HTMLSelectElement > ; value ? : string ; ref ? : React . Ref < any > ; } export default class NativeSelect extends React . Component < NativeSelectProps , { } > { NativeSelect : React . RefObject < HTMLSelectElement > = React . createRef ( ) ; static defaultProps : Partial < NativeSelectProps > = { className : '' , children : null , disabled : false , value : '' , } ; get classes ( ) { return classnames ( 'mdc-select__native-control' , this . props . className ) ; } attachRef = ( node ) => { const { innerRef } = this . props ; this . NativeSelect . current = node ; if ( ! innerRef ) { return ; } if ( typeof innerRef !== 'function' ) { innerRef . current = node ; } else { innerRef ( node ) ; } } ; render ( ) { const { className , children , foundation , innerRef , ... otherProps } = this . props ; return ( < select className = { this . classes } ref = { this . attachRef } { ... otherProps } > { children } < /select>); } }