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

Add support for React refs on Box #52

Open
DannyDelott opened this issue Oct 8, 2019 · 3 comments · May be fixed by #53
Open

Add support for React refs on Box #52

DannyDelott opened this issue Oct 8, 2019 · 3 comments · May be fixed by #53

Comments

@DannyDelott
Copy link

This is a great library, however it is missing a way to attach a ref to Box's underlying DOM node. This is useful for integrations with other third party libraries.

Specifically we want to be able to integrate with react-beautiful-dnd, which requires an exposed ref on the draggable items.

Would you be open to a PR that introduces an elementRef prop to the Box component?

Example usage:

render() {
  return (
    <Box elementRef={...}>
      {this.props.children}
    </Box>
  );
}
@DannyDelott DannyDelott changed the title Add support for React refs on Box. Add support for React refs on Box Oct 8, 2019
@robinweser
Copy link
Owner

Hey! Yeah sure, go for it! I‘d prefer an update to latest React using the forwardRef API though. If you need any help, just ping me!

@DannyDelott DannyDelott linked a pull request Oct 8, 2019 that will close this issue
@DannyDelott
Copy link
Author

DannyDelott commented Nov 6, 2019

The forwardRef API won't work for ScrollView, because it currently exposes instance methods via ref, ie: scrollTo, getScrollPosition, et al. These would become inaccessible with a forwardRef refactor.

Let me know what your thoughts, and if you'd be willing to accept the elementRef as proposed here.

@robinweser
Copy link
Owner

Yeah that makes sense! innerRef oder elementRef are common names I guess. :)

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

Successfully merging a pull request may close this issue.

2 participants