Skip to content

Commit

Permalink
fix: add ref support in Container component (#2452)
Browse files Browse the repository at this point in the history
Description:
Add ref support in container component
VAN-1537
  • Loading branch information
ahtesham-quraish authored Jul 18, 2023
1 parent 1747665 commit d55001f
Showing 1 changed file with 13 additions and 14 deletions.
27 changes: 13 additions & 14 deletions src/Container/index.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import React, { forwardRef } from 'react';
import classNames from 'classnames';
import RBContainer from 'react-bootstrap/Container';
import PropTypes from 'prop-types';
Expand All @@ -11,19 +11,18 @@ const SIZE_CLASS_NAMES = {
xl: 'container-mw-xl',
};

function Container({ size, children, ...props }) {
return (
<RBContainer
{...props}
className={classNames(
props.className,
SIZE_CLASS_NAMES[size],
)}
>
{children}
</RBContainer>
);
}
const Container = forwardRef(({ size, children, ...props }, ref) => (
<RBContainer
{...props}
ref={ref}
className={classNames(
props.className,
SIZE_CLASS_NAMES[size],
)}
>
{children}
</RBContainer>
));

Container.propTypes = {
...RBContainer.propTypes,
Expand Down

0 comments on commit d55001f

Please sign in to comment.