Created
October 18, 2017 18:05
-
-
Save hanford/d766d737bc5de617718f527c17804bf1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// before | |
<div | |
className={style.dragScroll} | |
style={{transform: `translateX(-${position}px)`}} | |
ref={c => this.setRef(c)} | |
> | |
{ref && <Kinetic allowScroll={direction !== 'y'} max={ref.offsetWidth - 200} direction='x' element={ref} broadcast={this.setPosition} />} | |
{children} | |
</div> | |
// after | |
<FlickList | |
allowScroll={direction !== 'y'} | |
direction='x' | |
getRef={this.getRef} | |
max={ref && ref.offsetWidth - 200} | |
> | |
{scroll => ( | |
<div className={style.dragScroll} style={{transform: `translateX(-${scroll}px)`}}> | |
{children} | |
</div> | |
)} | |
</FlickList> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment