Skip to content
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

Issue #589: add public setter on ArrowKeyStepper to override scroll indexes #592

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions docs/ArrowKeyStepper.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ The appearance of this wrapper element can be customized using the `className` p
| scrollToColumn | Number | | Optional default/initial `scrollToColumn` value |
| scrollToRow | Number | | Optional default/initial `scrollToRow` value |

### Public Methods

##### setScrollIndexes
Override the local state of the component with new values for `scrollToRow` and `scrollToColumn`.

### Children function

The child function is passed the following named parameters:
Expand Down
7 changes: 7 additions & 0 deletions source/ArrowKeyStepper/ArrowKeyStepper.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,13 @@ export default class ArrowKeyStepper extends PureComponent {
}
}

setScrollIndexes (scrollToRow, scrollToColumn) {
this.setState({
scrollToRow,
scrollToColumn
})
}

render () {
const { className, children } = this.props
const { scrollToColumn, scrollToRow } = this.state
Expand Down