Skip to content

Commit

Permalink
Merge pull request #334 from AlexMeah/patch-1
Browse files Browse the repository at this point in the history
Add support for a custom className
  • Loading branch information
ameerthehacker authored Feb 11, 2021
2 parents d0205d4 + 084923d commit ab61b94
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -333,12 +333,13 @@ class LazyLoad extends Component {
height,
children,
placeholder,
className,
classNamePrefix,
style
} = this.props;

return (
<div className={`${classNamePrefix}-wrapper`} ref={this.setRef} style={style}>
<div className={`${classNamePrefix}-wrapper ${className}`} ref={this.setRef} style={style}>
{this.visible ? (
children
) : placeholder ? (
Expand All @@ -355,6 +356,7 @@ class LazyLoad extends Component {
}

LazyLoad.propTypes = {
className: PropTypes.string,
classNamePrefix: PropTypes.string,
once: PropTypes.bool,
height: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
Expand All @@ -375,6 +377,7 @@ LazyLoad.propTypes = {
};

LazyLoad.defaultProps = {
className: '',
classNamePrefix: 'lazyload',
once: false,
offset: 0,
Expand Down

0 comments on commit ab61b94

Please sign in to comment.