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

Feature request: Externalize ArrowKeyStepper state #687

Closed
mking-clari opened this issue May 28, 2017 · 7 comments
Closed

Feature request: Externalize ArrowKeyStepper state #687

mking-clari opened this issue May 28, 2017 · 7 comments

Comments

@mking-clari
Copy link
Contributor

I would like to manage the scrollToColumn/scrollToRow state in Redux. I see that I can set the ArrowKeyStepper's scrollToColumn/scrollToRow via its props. In addition, I would like an onChange function to capture scrollToColumn/scrollToRow changes.

I think ReactMeasure is a good example of a component that provides both options (function child vs onMeasure).

@bvaughn
Copy link
Owner

bvaughn commented May 28, 2017

ArrowKeyStepper works with a child function, so you already have access to the scrolled-to row and column when they change.

  <ArrowKeyStepper
    columnCount={columnCount}
    rowCount={rowCount}
  >
    {({ onSectionRendered, scrollToColumn, scrollToRow }) => {
      // Do whatever you want with scrollToColumn and scrollToRow here
      return (
        <Grid
          scrollToColumn={scrollToColumn}
          scrollToRow={scrollToRow}
          onSectionRendered={onSectionRendered}
          {...otherGridProps}
        />
      );
    }}
  </ArrowKeyStepper>

@mking-clari
Copy link
Contributor Author

If I call a Redux action there, that causes a setState function to be called within render, which results in a React warning. I'll create an example repo to show it

@mking-clari
Copy link
Contributor Author

Here is the issue (let me know if you know a better way to transfer the child args to Redux).

screen shot 2017-05-28 at 10 07 10 am

Repo: https://github.com/mking-clari/stepper-warning

@bvaughn
Copy link
Owner

bvaughn commented May 28, 2017

If I call a Redux action there, that causes a setState function to be called within render, which results in a React warning. I'll create an example repo to show it

You could dispatch your action on the next tick to avoid this.

@bvaughn
Copy link
Owner

bvaughn commented May 28, 2017

Anyway, I'm pretty swamped at the moment so I haven't been taking on feature requests for this lib. Happy to review a PR if you'd like to submit one though. 😄

@mking-clari
Copy link
Contributor Author

I'll close this for now. If I have time I'll open a PR. Thanks for taking the time to review!

@bvaughn
Copy link
Owner

bvaughn commented May 28, 2017

Sounds reasonable. Thanks for understanding!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants