Loëck Vézien
7 years ago
No known key found for this signature in database
GPG Key ID: CBCDCE384E853AC4
2 changed files with
10 additions and
4 deletions
-
src/components/base/GrowScroll/index.js
-
src/components/base/GrowScroll/stories.js
|
|
@ -34,11 +34,15 @@ class GrowScroll extends PureComponent<Props> { |
|
|
|
const minY = offsetLimit.y.min |
|
|
|
|
|
|
|
if (offset.y > maxY) { |
|
|
|
this.scrollTo(offset.x, maxY) |
|
|
|
this.setPosition(offset.x, maxY, { |
|
|
|
withoutCallbacks: true, |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
if (offset.y < minY) { |
|
|
|
this.scrollTo(offset.x, minY) |
|
|
|
this.setPosition(offset.x, minY, { |
|
|
|
withoutCallbacks: true, |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
|
|
@ -7,7 +7,9 @@ import GrowScroll from 'components/base/GrowScroll' |
|
|
|
const stories = storiesOf('GrowScroll', module) |
|
|
|
|
|
|
|
stories.add('basic', () => ( |
|
|
|
<Box style={{ height: 400, border: '1px solid black' }}> |
|
|
|
<GrowScroll>{[...Array(1000).keys()].map(v => <div key={v}>{v}</div>)}</GrowScroll> |
|
|
|
<Box style={{ border: '1px solid black' }}> |
|
|
|
<GrowScroll maxHeight={400}> |
|
|
|
{[...Array(1000).keys()].map(v => <div key={v}>{v}</div>)} |
|
|
|
</GrowScroll> |
|
|
|
</Box> |
|
|
|
)) |
|
|
|