Skip to content

Commit

Permalink
chore(select): forward refs to select dom element
Browse files Browse the repository at this point in the history
  • Loading branch information
mhuggins committed Aug 25, 2018
1 parent 23b0f41 commit 9484a26
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions src/renderer/shared/components/Forms/Select/Select.js
Original file line number Diff line number Diff line change
@@ -1,26 +1,34 @@
import React from 'react';
import classNames from 'classnames';
import { string } from 'prop-types';
import { string, func } from 'prop-types';

import styles from './Select.scss';

export default class Select extends React.PureComponent {
class Select extends React.PureComponent {
static propTypes = {
className: string
className: string,
forwardedRef: func
};

static defaultProps = {
className: null
className: null,
forwardedRef: null
};

render() {
const { className, ...passDownProps } = this.props;
const { className, forwardedRef, ...passDownProps } = this.props;

return (

<select
{...passDownProps}
ref={forwardedRef}
className={classNames(styles.select, className)}
/>
);
}
}

export default React.forwardRef((props, ref) => {
return <Select {...props} forwardedRef={ref} />;
});

0 comments on commit 9484a26

Please sign in to comment.