Skip to content

Commit

Permalink
feat(Alert) : add ref to Alert (#1092)
Browse files Browse the repository at this point in the history
also fixed PropTypes of Fade
  • Loading branch information
illiteratewriter authored and TheSharpieOne committed Jun 25, 2018
1 parent aceaf22 commit d6b1ca9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
8 changes: 7 additions & 1 deletion src/Alert.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ const propTypes = {
toggle: PropTypes.func,
tag: PropTypes.oneOfType([PropTypes.func, PropTypes.string]),
transition: PropTypes.shape(Fade.propTypes),
innerRef: PropTypes.oneOfType([
PropTypes.object,
PropTypes.string,
PropTypes.func,
]),
};

const defaultProps = {
Expand Down Expand Up @@ -43,6 +48,7 @@ function Alert(props) {
children,
transition,
fade,
innerRef,
...attributes
} = props;

Expand All @@ -63,7 +69,7 @@ function Alert(props) {
};

return (
<Fade {...attributes} {...alertTransition} tag={Tag} className={classes} in={isOpen} role="alert">
<Fade {...attributes} {...alertTransition} tag={Tag} className={classes} in={isOpen} role="alert" innerRef={innerRef}>
{toggle ?
<button type="button" className={closeClasses} aria-label={closeAriaLabel} onClick={toggle}>
<span aria-hidden="true">&times;</span>
Expand Down
6 changes: 5 additions & 1 deletion src/Fade.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@ const propTypes = {
baseClassActive: PropTypes.string,
className: PropTypes.string,
cssModule: PropTypes.object,
innerRef: PropTypes.object,
innerRef: PropTypes.oneOfType([
PropTypes.object,
PropTypes.string,
PropTypes.func,
]),
};

const defaultProps = {
Expand Down

0 comments on commit d6b1ca9

Please sign in to comment.