Skip to content

Instantly share code, notes, and snippets.

@hanford
Created October 18, 2017 18:05
Show Gist options
  • Save hanford/d766d737bc5de617718f527c17804bf1 to your computer and use it in GitHub Desktop.
Save hanford/d766d737bc5de617718f527c17804bf1 to your computer and use it in GitHub Desktop.
// 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