Skip to content

Commit

Permalink
Merge pull request #256 from oliviertassinari/axis-scroll
Browse files Browse the repository at this point in the history
Fix native vertical scrolling within slide.
  • Loading branch information
oliviertassinari authored Feb 25, 2017
2 parents e2ec2e7 + 46446ba commit 9ed996a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
11 changes: 9 additions & 2 deletions docs/src/demo/DemoAxis.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,12 @@ const styles = {
slide2: {
backgroundColor: '#B3DC4A',
},
scroll: {
height: 100,
overflow: 'scroll',
},
slide3: {
height: 200,
backgroundColor: '#6AC0FF',
},
};
Expand All @@ -31,8 +36,10 @@ const DemoAxis = () => (
<div style={Object.assign({}, styles.slide, styles.slide2)}>
slide n°2
</div>
<div style={Object.assign({}, styles.slide, styles.slide3)}>
slide n°3
<div style={styles.scroll}>
<div style={Object.assign({}, styles.slide, styles.slide3)}>
slide n°3
</div>
</div>
</SwipeableViews>
);
Expand Down
5 changes: 4 additions & 1 deletion packages/react-swipeable-views/src/SwipeableViews.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,10 @@ export function getDomTreeShapes(element, rootNode) {
style.getPropertyValue('overflow-x') === 'hidden'
) {
domTreeShapes = [];
} else if (element.clientWidth > 0 && element.scrollWidth > element.clientWidth) {
} else if (
(element.clientWidth > 0 && element.scrollWidth > element.clientWidth) ||
(element.clientHeight > 0 && element.scrollHeight > element.clientHeight)
) {
// Ignore the nodes that have no width.
// Keep elements with a scroll
domTreeShapes.push({
Expand Down

0 comments on commit 9ed996a

Please sign in to comment.