react-swipeable-views icon indicating copy to clipboard operation
react-swipeable-views copied to clipboard

Custom width example in the Document website is not working

Open anothertempore opened this issue 5 years ago • 9 comments

  • [x] I have searched the issues of this repository and believe that this is not a duplicate.

The Custom Width demo in the document website, its related CodeSandBox link is not working.

document website: https://react-swipeable-views.com/demos/demos/#custom-width CodeSandBox: https://codesandbox.io/s/p7xmzmop3x

image

anothertempore avatar Dec 04 '19 12:12 anothertempore

Hi,

Can you explain what exactly is not working? When I open both links I can swipe without issue. I also do need see any errors in the console about problems.

vanhoutenbos avatar Dec 06 '19 10:12 vanhoutenbos

When I swipe the codesandbox link, the slide is not centered.

image

anothertempore avatar Dec 08 '19 13:12 anothertempore

Ah! I know what you mean now, I believe this is done on purpose so that the viewer knows there are slides to the right/left, but I think you can overwrite this by padding on the left side, I will try and find some time tomorrow to make a demo!

vanhoutenbos avatar Dec 08 '19 17:12 vanhoutenbos

@jeanpoelie Thanks for your quick response :)

The problem is that the code in these two links is same, but the result is not the same. On the website, the slide is centered. on the CodeSandBox, the slide is not centered. I wanna know why this happens.

anothertempore avatar Dec 09 '19 03:12 anothertempore

Ah! I will need to test this and see why this is happening

vanhoutenbos avatar Dec 13 '19 14:12 vanhoutenbos

It seems also to have problems with any library version later than 0.13.3

https://codesandbox.io/s/p7xmzmop3x

image

bunnywrote avatar Jan 31 '20 14:01 bunnywrote

@jeanpoelie this problem still exists, any solution?

vicasas avatar Dec 03 '20 12:12 vicasas

I struggled with this problem for hours now without any solution.

Solved: That was indeed pretty simple, I work on an app with basic CSS already implemented for so long now I completely forgot about box-sizing

Adding this to my style made everything right.

html,
body {
[...]
  box-sizing: border-box;
}

*,
*::before,
*::after {
  box-sizing: inherit;
}

dmgauthier avatar Feb 21 '21 14:02 dmgauthier