-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make scroll offset uncontrollable in favor of ref methods #1461
Conversation
* Make scroll offset uncontrollable in favor of ref methods * Grid component - Make Grid uncontrollable, rename scrollTop/scrollLeft props to defaultScrollTop/defaultScrollLeft (only to be used on mount) - Limit scrollTop and scrollLeft to maximum possible values before state update in scrollToPosition method(prevents rendering issues when calling scrollToPosition multiple times with values larger than max) - Update tests and docs * MultiGrid component - Remove scrollLeft and scrollTop from state - Remove getDerivedStateFromProps and state handling code from componentDidMount - Update all _onScroll methods to use scrollToPosition for syncing - Add scrollToPosition method (pass-thru that calls scrollToPosition of the main scrolling grid which is _bottomRightGrid) - Update tests and docs * List component - Make List uncontrollable, rename scrollTop to defaultScrollTop (only to be used on mount) - Update tests and docs * Table component - Make Table uncontrollable, rename scrollTop to defaultScrollTop (only to be used on mount) - Update tests and docs * ScrollSync component - Add flow types - Add registerChild to children render function parameters - Implement _registerChild to store refs on scrollable children - Call scrollToPosition on children refs in _onScroll handler to sync them - Update tests, docs and example * WindowScroller component - Update flow types - Rename existing registerChild method to registerChildContainer - Add registerChild to children render function parameters - Implement _registerChild to store ref on scrollable child - Call scrollToPosition on child ref in _handleWindowScrollEvent handler - Update tests, docs and example * Update MultiGrid.js * Update ScrollSync.js * Update ScrollSync.js
Codecov Report
@@ Coverage Diff @@
## master #1461 +/- ##
==========================================
- Coverage 94.7% 94.44% -0.27%
==========================================
Files 47 47
Lines 1795 1800 +5
==========================================
Hits 1700 1700
- Misses 95 100 +5
Continue to review full report at Codecov.
|
@wuweiweiwu Glad to see progress on this! Let me know if I can help. |
@somi92 this is thanks to all your work!! |
Codecov ReportAttention: Patch coverage is
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## master #1461 +/- ##
==========================================
- Coverage 94.70% 94.44% -0.27%
==========================================
Files 47 47
Lines 1795 1800 +5
==========================================
Hits 1700 1700
- Misses 95 100 +5 ☔ View full report in Codecov by Sentry. |
Changes based on discussion from #999.
Follow up of #1320
scrollToCell
Grid
prop mirroringgDSFP
implementationsSummary of changes:
Grid component
MultiGrid component
List component
Table component
ScrollSync component
WindowScroller component
handler
Thanks for contributing to react-virtualized!
Before submitting a pull request, please complete the following checklist:
npm test
) all passnpm run prettier
).npm run typecheck
).Here is a short checklist of additional things to keep in mind before submitting: