Comments (18)
Thanks for reaching out
from react-beautiful-dnd.
Here is our using innerRef
guide
from react-beautiful-dnd.
from react-beautiful-dnd.
Try this:
<MyStyleComponent
- innerRef={provided.innerRef}
+ ref={provided.innerRef}
/>
from react-beautiful-dnd.
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.
Here is the styled components ref
guide
from react-beautiful-dnd.
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.
@alexreardon thank you! Awesome library π I enjoyed watching your egghead.io tutorial
from react-beautiful-dnd.
from react-beautiful-dnd.
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.
Most of our stories use styled-components
https://github.com/atlassian/react-beautiful-dnd/tree/master/stories/src
from react-beautiful-dnd.
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.
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.
@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.
@alexreardon what's the word?
from react-beautiful-dnd.
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.
from react-beautiful-dnd.
Ahhhh, it works!!!!!!!!!!!
Thank you so much & sorry for not seeing it :)
from react-beautiful-dnd.
Related Issues (20)
- react-redux.min.js:1 Uncaught TypeError: Cannot read properties of undefined (reading 'bindActionCreators')
- Excellent effect
- Trouble with Antd Menu HOT 2
- What is the use of mode virtual
- Cards overlapping when I drag react-beautiful-dnd HOT 3
- Change the position of the Session Card that is being dragged to the right of the mouse
- When dragging the item, the element's size and the drop area are not being recognized at their respective sizes. HOT 2
- Cannot scroll to the bottom of the list when working with react-window VariableSizeList
- Connect(Droppable): Support for defaultProps will be removed from memo components in a future major release. Use JavaScript default parameters instead.
- Nested horizontal dropzone doesn't work correctly
- where is the demo code and API? HOT 1
- The ui gets distorted when I drag and drop.
- Want to disable nesting tree for some nodes
- Drag and drop not working new window created through createPortal
- Tasks go on top of column title after dragging
- Setting position issue -- When the page is scroll with position: Sticky, The drag component is not positioning properly.
- Droppable should only accept Draggables of same type ... but it doesn't work HOT 1
- Dragging Item while scrolling is not staying in the position with Tailwind CSS
- Update: 3rd April 2024 β "react-beautiful-dnd: where to from here?" HOT 5
- Unable to work in Next.js 14
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-beautiful-dnd.