| 101 | |
| 102 | // extracted the rendering of the Tag component |
| 103 | const returnFunction = ({ ref }) => { |
| 104 | const handleRef = (tagRef) => { |
| 105 | ref(tagRef); |
| 106 | const { onToggleRef } = this.context; |
| 107 | if (onToggleRef) onToggleRef(tagRef); |
| 108 | }; |
| 109 | |
| 110 | return ( |
| 111 | <Tag |
| 112 | {...props} |
| 113 | {...{ [typeof Tag === 'string' ? 'ref' : 'innerRef']: handleRef }} |
| 114 | className={classes} |
| 115 | onClick={this.onClick} |
| 116 | aria-expanded={this.context.isOpen} |
| 117 | aria-haspopup={this.getRole()} |
| 118 | children={children} |
| 119 | /> |
| 120 | ); |
| 121 | }; |
| 122 | |
| 123 | // No Reference component if the component is in Navbar |
| 124 | if (this.context.inNavbar) { |