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

Allow to pass a ref for the underlying div #80

Closed
veej opened this issue Feb 4, 2020 · 2 comments · Fixed by #82
Closed

Allow to pass a ref for the underlying div #80

veej opened this issue Feb 4, 2020 · 2 comments · Fixed by #82

Comments

@veej
Copy link
Member

veej commented Feb 4, 2020

Description

At the moment it's impossible to pass a ref to the underlying div element.
We should add an innerRef prop to FlexView and forward it as ref for the root div.

@giogonzo
Copy link
Member

giogonzo commented Feb 4, 2020

slightly different proposal: use forwardRef and update the ref typings as appropriate to refer to the underlying <div />. Rationale: no need to have a reference to the View element itself (no API exposed as instance methods), while you often need a ref to the underlying div to do dirty DOM stuff

@giogonzo
Copy link
Member

giogonzo commented Apr 6, 2020

Even better: since FlexView has no "public API" on the class/component instance, no need to expose the ref to FlexView at all. Exposing the one to the underlying div is more than enough, as in:

type FlexViewProps = {
  // ... more props
  ref: React.Ref<HTMLDivElement>
}

@giogonzo giogonzo added the WIP label Apr 19, 2020
giogonzo added a commit that referenced this issue Apr 20, 2020
#80: Allow to pass a ref for the underlying div
@kanbanbot kanbanbot removed the WIP label Apr 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants