Skip to content

Commit

Permalink
feat: add ref support in container
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 committed Jul 18, 2023
1 parent 1747665 commit 461cc18
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 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,10 +11,11 @@ const SIZE_CLASS_NAMES = {
xl: 'container-mw-xl',
};

function Container({ size, children, ...props }) {
const Container = forwardRef(({ size, children, ...props }, ref) => {
return (
<RBContainer
{...props}
ref={ref}
className={classNames(
props.className,
SIZE_CLASS_NAMES[size],
Expand All @@ -23,7 +24,7 @@ function Container({ size, children, ...props }) {
{children}
</RBContainer>
);
}
})

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

0 comments on commit 461cc18

Please sign in to comment.