Git Product home page Git Product logo

Comments (18)

alexreardon avatar alexreardon commented on May 6, 2024 5

Thanks for reaching out

from react-beautiful-dnd.

alexreardon avatar alexreardon commented on May 6, 2024 3

Here is our using innerRef guide

from react-beautiful-dnd.

alexreardon avatar alexreardon commented on May 6, 2024 3

from react-beautiful-dnd.

alexreardon avatar alexreardon commented on May 6, 2024 2

Try this:

<MyStyleComponent 
- innerRef={provided.innerRef} 
+ ref={provided.innerRef}
/>

from react-beautiful-dnd.

alexreardon avatar alexreardon commented on May 6, 2024 1

I am a big fan of styled components and you will find that the examples all use styled components.

For styled-components, the ref prop returns the instance of the class whereas innerRef returns the underlying DOM node. So for your example to work simply change ref to innerRef πŸ‘Œ

Here is your example with the change made: https://www.webpackbin.com/bins/-Krh0yshtMKBmuOGhJn8

from react-beautiful-dnd.

alexreardon avatar alexreardon commented on May 6, 2024 1

Here is the styled components ref guide

from react-beautiful-dnd.

harrysolovay avatar harrysolovay commented on May 6, 2024 1

The updated styled-components API (v4) allows for usage of ref (no more innerRef). I tried to apply the provided innerRefs from the dnd contexts to the styled-components... it did not work. Is this something that you're digging into? Let me know if you need more details and an example (thought I'd save myself the time incase you're already working on a compatibility fix).

from react-beautiful-dnd.

harrysolovay avatar harrysolovay commented on May 6, 2024 1

@alexreardon thank you! Awesome library πŸ‘ I enjoyed watching your egghead.io tutorial

from react-beautiful-dnd.

alexreardon avatar alexreardon commented on May 6, 2024 1

from react-beautiful-dnd.

MokumJ avatar MokumJ commented on May 6, 2024

I am facing some difficulties aswell implementing your great library with styled components.
Changing ref to innerRef still makes the Draggable component crash.

The exapmle on webpackbin is down. Anyway to get him back up?
My issieu is very similar to the issieur.

from react-beautiful-dnd.

alexreardon avatar alexreardon commented on May 6, 2024

Most of our stories use styled-components
https://github.com/atlassian/react-beautiful-dnd/tree/master/stories/src

from react-beautiful-dnd.

haywirez avatar haywirez commented on May 6, 2024

Would also welcome a better explanation of refs - in my case, it either crashes (draggableRef.hasAttribute is not a function) or doesn't see the ref. Things get more complicated with another wrapper layer that comes from the posed animation library.

from react-beautiful-dnd.

alexreardon avatar alexreardon commented on May 6, 2024

I have not looked into this. My initial take is that you should just be able to use the ref prop on a styled-component

I could try to take a look later

from react-beautiful-dnd.

harrysolovay avatar harrysolovay commented on May 6, 2024

@alexreardon here's what I'm currently working with: the repo

I'd really appreciate if you––when you have a moment––would take a glance & let me know if anything strikes you as blatantly incorrect.

Thank you!

from react-beautiful-dnd.

harrysolovay avatar harrysolovay commented on May 6, 2024

@alexreardon what's the word?

from react-beautiful-dnd.

harrysolovay avatar harrysolovay commented on May 6, 2024

Didn't work. I've tried with both innerRef & ref –– if you want to take a look at what I'm working with, it's here.

from react-beautiful-dnd.

alexreardon avatar alexreardon commented on May 6, 2024

from react-beautiful-dnd.

harrysolovay avatar harrysolovay commented on May 6, 2024

Ahhhh, it works!!!!!!!!!!!

Thank you so much & sorry for not seeing it :)

from react-beautiful-dnd.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.