Skip to content

Commit

Permalink
Allow custom WindowScroller child with childRef in children function (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
TrySound authored Jan 4, 2018
1 parent bb05a52 commit 6aacced
Show file tree
Hide file tree
Showing 3 changed files with 164 additions and 115 deletions.
53 changes: 28 additions & 25 deletions source/WindowScroller/WindowScroller.example.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,35 +82,38 @@ export default class WindowScrollerExample extends PureComponent<{}, State> {
value={scrollToIndex || ''}
/>
</InputRow>
<div className={styles.WindowScrollerWrapper}>
<WindowScroller
ref={this._setRef}
scrollElement={isScrollingCustomElement ? customElement : window}>
{({height, isScrolling, onChildScroll, scrollTop}) => (

<WindowScroller
ref={this._setRef}
scrollElement={isScrollingCustomElement ? customElement : window}>
{({height, isScrolling, childRef, onChildScroll, scrollTop}) => (
<div className={styles.WindowScrollerWrapper}>
<AutoSizer disableHeight>
{({width}) => (
<List
ref={el => {
window.listEl = el;
}}
autoHeight
className={styles.List}
height={height}
isScrolling={isScrolling}
onScroll={onChildScroll}
overscanRowCount={2}
rowCount={list.size}
rowHeight={30}
rowRenderer={this._rowRenderer}
scrollToIndex={scrollToIndex}
scrollTop={scrollTop}
width={width}
/>
<div ref={childRef}>
<List
ref={el => {
window.listEl = el;
}}
autoHeight
className={styles.List}
height={height}
isScrolling={isScrolling}
onScroll={onChildScroll}
overscanRowCount={2}
rowCount={list.size}
rowHeight={30}
rowRenderer={this._rowRenderer}
scrollToIndex={scrollToIndex}
scrollTop={scrollTop}
width={width}
/>
</div>
)}
</AutoSizer>
)}
</WindowScroller>
</div>
</div>
)}
</WindowScroller>
</ContentBox>
);
}
Expand Down
Loading

0 comments on commit 6aacced

Please sign in to comment.