mirror of
https://github.com/Stremio/stremio-web.git
synced 2026-03-11 21:27:05 +00:00
using newest react api to forward a dom ref
This commit is contained in:
parent
e7982594cd
commit
201fff78ec
2 changed files with 4 additions and 4 deletions
|
|
@ -1,7 +1,7 @@
|
|||
import React from 'react';
|
||||
|
||||
const Label = ({ children, forwardedRef, onClick }) => {
|
||||
return React.cloneElement(React.Children.only(children), { ref: forwardedRef, onClick });
|
||||
};
|
||||
const Label = React.forwardRef(({ children, onClick }, ref) => {
|
||||
return React.cloneElement(React.Children.only(children), { ref, onClick });
|
||||
});
|
||||
|
||||
export default Label;
|
||||
|
|
|
|||
|
|
@ -127,7 +127,7 @@ class Popup extends PureComponent {
|
|||
return (
|
||||
<Fragment>
|
||||
{React.Children.map(this.props.children, (child) => {
|
||||
return child.type === Label ? React.cloneElement(child, { forwardedRef: this.labelRef, onClick: this.open }) : null;
|
||||
return child.type === Label ? React.cloneElement(child, { ref: this.labelRef, onClick: this.open }) : null;
|
||||
})}
|
||||
{this.renderMenu()}
|
||||
</Fragment>
|
||||
|
|
|
|||
Loading…
Reference in a new issue