Skip to content

Commit

Permalink
Merge pull request #32 from andy-hook/master
Browse files Browse the repository at this point in the history
Fix: Incorrect margin application
  • Loading branch information
theKashey authored Jun 6, 2022
2 parents 2eae724 + c42b51f commit 5f2c981
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions src/component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,8 @@ const getStyles = (
* Removes page scrollbar and blocks page scroll when mounted
*/
export const RemoveScrollBar: React.FC<BodyScroll> = (props) => {
const [gap, setGap] = React.useState(getGapWidth(props.gapMode));

React.useEffect(() => {
setGap(getGapWidth(props.gapMode));
}, [props.gapMode]);

const { noRelative, noImportant, gapMode = 'margin' } = props;
const gap = React.useMemo(() => getGapWidth(gapMode), [gapMode]);

return <Style styles={getStyles(gap, !noRelative, gapMode, !noImportant ? '!important' : '')} />;
};

0 comments on commit 5f2c981

Please sign in to comment.