forward ref to MetaRow

This commit is contained in:
nklhrstv 2022-05-17 12:10:15 +03:00
parent 92ed0cdaa7
commit 473ccafee3
2 changed files with 10 additions and 6 deletions

View file

@ -10,9 +10,9 @@ const CONSTANTS = require('stremio/common/CONSTANTS');
const MetaRowPlaceholder = require('./MetaRowPlaceholder');
const styles = require('./styles');
const MetaRow = ({ className, title, message, items, itemComponent, deepLinks, ...props }) => {
const MetaRow = React.forwardRef(({ className, title, message, items, itemComponent, deepLinks, ...props }, ref) => {
return (
<div {...props} className={classnames(className, styles['meta-row-container'])}>
<div {...props} ref={ref} className={classnames(className, styles['meta-row-container'])}>
{
(typeof title === 'string' && title.length > 0) || (deepLinks && (typeof deepLinks.discover === 'string' || typeof deepLinks.library === 'string')) ?
<div className={styles['header-container']}>
@ -59,7 +59,9 @@ const MetaRow = ({ className, title, message, items, itemComponent, deepLinks, .
}
</div>
);
};
});
MetaRow.displayName = 'MetaRow';
MetaRow.Placeholder = MetaRowPlaceholder;

View file

@ -8,9 +8,9 @@ const Button = require('stremio/common/Button');
const CONSTANTS = require('stremio/common/CONSTANTS');
const styles = require('./styles');
const MetaRowPlaceholder = ({ className, title, deepLinks, ...props }) => {
const MetaRowPlaceholder = React.forwardRef(({ className, title, deepLinks, ...props }, ref) => {
return (
<div {...props} className={classnames(className, styles['meta-row-placeholder-container'])}>
<div {...props} ref={ref} className={classnames(className, styles['meta-row-placeholder-container'])}>
<div className={styles['header-container']}>
<div className={styles['title-container']} title={typeof title === 'string' && title.length > 0 ? title : null}>
{typeof title === 'string' && title.length > 0 ? title : null}
@ -37,7 +37,9 @@ const MetaRowPlaceholder = ({ className, title, deepLinks, ...props }) => {
</div>
</div>
);
};
});
MetaRowPlaceholder.displayName = 'MetaRowPlaceholder';
MetaRowPlaceholder.propTypes = {
className: PropTypes.string,