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

Paper doesn't accept a ref for it's div #5532

Closed
simonhildebrandt opened this issue Nov 10, 2016 · 4 comments
Closed

Paper doesn't accept a ref for it's div #5532

simonhildebrandt opened this issue Nov 10, 2016 · 4 comments
Labels
component: Paper This is the name of the generic UI component, not the React module! discussion

Comments

@simonhildebrandt
Copy link

simonhildebrandt commented Nov 10, 2016

I'd like to access the div in the Paper implementation for animation purposes, but currently the ref method returns the Paper object, not the div (as per React's normal behaviour.)

render() {
  <Paper ref={ (ref) => this.ref = ref } onTouchTap={ console.log(this.ref) } />
}

I'm proposing an extra prop (something like 'divRef'?) that can be passed down to be added to the div. Thoughts? I imagine this would be valuable across a large number of components, so I assume people will have an opinion about the neatest way to do it.

@oliviertassinari
Copy link
Member

oliviertassinari commented Nov 10, 2016

@simonhildebrandt Why not using the findDOMNode API for that use case?
However, you raised a good point. As we are using more and more stateless functional component on the next branch. That issue is going to rise.
We expose a rootRef property on the List component for an internal use case.
We could generalize this approach.

@lucasbento lucasbento added component: Paper This is the name of the generic UI component, not the React module! discussion waiting for 👍 Waiting for upvotes labels Nov 10, 2016
@lucasbento
Copy link

Closing this due to inactivity.

@oliviertassinari oliviertassinari removed the waiting for 👍 Waiting for upvotes label Oct 2, 2017
@lexanth
Copy link
Contributor

lexanth commented Jan 26, 2018

@oliviertassinari React developers intend to deprecate the findDOMNode API eventually - jsx-eslint/eslint-plugin-react#678

I'd appreciate a prop to get a ref for the div too.

@oliviertassinari
Copy link
Member

oliviertassinari commented Jan 26, 2018

@AlexAnthony I have been removing some ref properties lately #10025. As we encourage the usage of the findDOMNode API until React find a better one #9768.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: Paper This is the name of the generic UI component, not the React module! discussion
Projects
None yet
Development

No branches or pull requests

4 participants