Guest User

SO 46314632

a guest
Sep 24th, 2017
1,490
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 3.88 KB | None | 0 0
  1. diff --git a/MyWindowScroller.js b/MyWindowScroller.js
  2. index a4dbefa..1138fdf 100644
  3. --- a/MyWindowScroller.js
  4. +++ b/MyWindowScroller.js
  5. @@ -15,45 +15,35 @@ class MyWindowScroller extends React.Component {
  6.    render() {
  7.      return (
  8.        <div className="WindowScrollerWrapper">
  9. -        <WindowScroller className='WindowScroller'>
  10. -          {({ height, isScrolling, onChildScroll, scrollTop }) => {
  11. -            return (
  12. -              <AutoSizer disableHeight className='AutoSizer'>
  13. -                {
  14. -                  ({ width }) => {
  15. -                    //console.log(width, height);
  16. -                    if (this.mostRecentWidth && this.mostRecentWidth !== width) {
  17. -                      console.log(this.mostRecentWidth, 'clearing cache');
  18. -                      this.cache.clearAll();
  19. -                      // proxyConsole.js:56 Warning: forceUpdate(...): Cannot update during an existing
  20. -                      // state transition (such as within `render` or another component's constructor).
  21. -                      // Render methods should be a pure function of props and state; constructor side-effects
  22. -                      // are an anti-pattern, but can be moved to `componentWillMount`.
  23. -                      // this.listRef.recomputeRowHeights();
  24. -                    }
  25. -                    this.mostRecentWidth = width;
  26. -                    return (
  27. -                      <List
  28. -                        autoHeight
  29. -                        ref={el => { this.listRef = el; }}
  30. -                        isScrolling={isScrolling}
  31. -                        onScroll={onChildScroll}
  32. -                        scrollTop={scrollTop}
  33. -                        width={width}
  34. -                        height={height}
  35. -                        rowCount={this.props.data.length}
  36. -                        rowHeight={this.cache.rowHeight}
  37. -                        deferredMeasurementCache={this.cache}
  38. -                        rowRenderer={this.renderRow}
  39. -                        overscanRowCount={0}
  40. -                      />
  41. -                    );
  42. -                  }
  43. -                }
  44. -              </AutoSizer>
  45. -            );
  46. -          }}
  47. -        </WindowScroller>
  48. +        <AutoSizer className='AutoSizer'>
  49. +          {
  50. +            ({ height, width }) => {
  51. +              //console.log(width, height);
  52. +              if (this.mostRecentWidth && this.mostRecentWidth !== width) {
  53. +                console.log(this.mostRecentWidth, 'clearing cache');
  54. +                this.cache.clearAll();
  55. +                // proxyConsole.js:56 Warning: forceUpdate(...): Cannot update during an existing
  56. +                // state transition (such as within `render` or another component's constructor).
  57. +                // Render methods should be a pure function of props and state; constructor side-effects
  58. +                // are an anti-pattern, but can be moved to `componentWillMount`.
  59. +                // this.listRef.recomputeRowHeights();
  60. +              }
  61. +              this.mostRecentWidth = width;
  62. +              return (
  63. +                <List
  64. +                  ref={el => { this.listRef = el; }}
  65. +                  width={width}
  66. +                  height={height}
  67. +                  rowCount={this.props.data.length}
  68. +                  rowHeight={this.cache.rowHeight}
  69. +                  deferredMeasurementCache={this.cache}
  70. +                  rowRenderer={this.renderRow}
  71. +                  overscanRowCount={0}
  72. +                />
  73. +              );
  74. +            }
  75. +          }
  76. +        </AutoSizer>
  77.        </div>
  78.      );
  79.    }
  80. diff --git a/flex.css b/flex.css
  81. index 42d4aee..6c99b4d 100644
  82. --- a/flex.css
  83. +++ b/flex.css
  84. @@ -15,6 +15,10 @@ html, body, #root {
  85.      flex-shrink: 0;
  86.  }
  87.  .App-intro {
  88. +    display: flex;
  89. +    flex-grow: 1;
  90. +}
  91. +.WindowScrollerWrapper {
  92. +    display: flex;
  93.      flex-grow: 1;
  94. -    overflow-y: auto;
  95.  }
  96. \ No newline at end of file
Advertisement
Add Comment
Please, Sign In to add comment