Add support for React refs on `Box`
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>
);
}
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!
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.
Yeah that makes sense! innerRef oder elementRef are common names I guess. :)