Skip to content

Commit

Permalink
Merge pull request #85 from wepiggy-dev/master
Browse files Browse the repository at this point in the history
fix carousel bug
  • Loading branch information
jin10086 authored Nov 5, 2020
2 parents d03de47 + 614244b commit e51e81d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ const customCarouselStyle = {
borderRadius: "6px",
overflow: "hidden",
backgroundColor: "#42475A",
marginBottom: "30px",
},
slider: {
width: "100%",
Expand Down
21 changes: 9 additions & 12 deletions src/components/CustomCarousel/CustomCarousel.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,25 +34,22 @@ function useResize() {
left: 0,
});

React.useEffect(() => {
// console.log('Mount');
return () => {
// console.log('unMount');
const uninstall = reSizer.current.uninstall;
if (uninstall && refDom.current) {
uninstall(refDom.current);
React.useEffect(
() => () => {
if (reSizer.current && reSizer.current.uninstall && refDom.current) {
reSizer.current.uninstall(refDom.current);
}

refDom.current = undefined;
reSizer.current = undefined;
};
}, []);
},
[]
);

const ref = React.useCallback((dom) => {
const listenTo = reSizer.current.listenTo;
if (dom && listenTo) {
if (reSizer.current && reSizer.current.listenTo && !refDom.current && dom) {
refDom.current = dom;
listenTo(refDom.current, (element) =>
reSizer.current.listenTo(refDom.current, (element) =>
setRect(element.getBoundingClientRect())
);
}
Expand Down
2 changes: 1 addition & 1 deletion src/features/liquidity/LiquidityPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export default function LiquidityPage() {
color="success"
/>
<CustomCarousel />
<SectionTitle />
{/* <SectionTitle /> */}
<SectionPools />
</>
);
Expand Down

0 comments on commit e51e81d

Please sign in to comment.