From 73a2ba45d53b04f339d752249644c427a225f1d5 Mon Sep 17 00:00:00 2001 From: RC Date: Tue, 23 Jan 2018 22:03:09 +0530 Subject: [PATCH] fix: Draggable Props should be disabled on card when draggable prop on Board is set to false dragProvided.draggableProps.style was undefined when drag-n-drop was disabled on the card https://github.com/rcdexta/react-trello/issues/60 --- src/components/Card.js | 8 +++++--- stories/BoardStyling.story.js | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/components/Card.js b/src/components/Card.js index f16f445d6..3790b44e3 100644 --- a/src/components/Card.js +++ b/src/components/Card.js @@ -38,12 +38,14 @@ class Card extends Component { }) render() { - const {id, index, cardStyle, editable, customCardLayout, ...otherProps} = this.props + const {id, index, cardStyle, draggable, editable, customCardLayout, ...otherProps} = this.props const style = customCardLayout ? {...cardStyle, padding: 0} : cardStyle + const isDragDisabled = !draggable return ( - + {(dragProvided, dragSnapshot) => { - const dragStyle = this.getItemStyle(dragSnapshot.isDragging, dragProvided.draggableProps.style) + const draggablePropsStyle = dragProvided.draggableProps && dragProvided.draggableProps.style + const dragStyle = this.getItemStyle(dragSnapshot.isDragging, draggablePropsStyle) return (
- + ) )