Skip to content

Commit 32e2307

Browse files
committed
fix: support custom components with drag and drop and reload components
1 parent abe167e commit 32e2307

File tree

5 files changed

+33
-20
lines changed

5 files changed

+33
-20
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,7 @@ node_modules
3434

3535
# Mac OS X
3636
.DS_Store
37+
38+
# Storybook
39+
40+
storybook-static/*

.size-snapshot.json

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,26 +24,26 @@
2424
}
2525
},
2626
"react-big-calendar.js": {
27-
"bundled": 1583435,
28-
"minified": 445376,
29-
"gzipped": 137501
27+
"bundled": 1583146,
28+
"minified": 445045,
29+
"gzipped": 137434
3030
},
3131
"react-big-calendar.min.js": {
32-
"bundled": 283187,
33-
"minified": 281738,
34-
"gzipped": 88836
32+
"bundled": 283219,
33+
"minified": 281770,
34+
"gzipped": 88846
3535
},
3636
"react-big-calendar.esm.js": {
37-
"bundled": 199459,
38-
"minified": 93011,
39-
"gzipped": 24119,
37+
"bundled": 199400,
38+
"minified": 93023,
39+
"gzipped": 24120,
4040
"treeshaked": {
4141
"rollup": {
42-
"code": 66234,
42+
"code": 66246,
4343
"import_statements": 1804
4444
},
4545
"webpack": {
46-
"code": 70014
46+
"code": 70026
4747
}
4848
}
4949
}

package.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
{
2-
"name": "react-big-calendar",
3-
"version": "0.40.0",
2+
"name": "@noloco/react-big-calendar",
3+
"version": "0.40.2",
44
"description": "Calendar! with events",
55
"author": {
6-
"name": "Jason Quense",
7-
"email": "[email protected]"
6+
"name": "Noloco",
7+
"email": "[email protected]"
88
},
99
"repository": {
1010
"type": "git",
11-
"url": "git+https://github.com/jquense/react-big-calendar.git"
11+
"url": "git+https://github.com/noloco-io/react-big-calendar.git"
1212
},
1313
"license": "MIT",
1414
"main": "lib/index.js",
@@ -129,7 +129,7 @@
129129
"uncontrollable": "^7.2.1"
130130
},
131131
"bugs": {
132-
"url": "https://github.com/jquense/react-big-calendar/issues"
132+
"url": "https://github.com/noloco-io/react-big-calendar/issues"
133133
},
134-
"homepage": "https://github.com/jquense/react-big-calendar#readme"
134+
"homepage": "https://github.com/noloco-io/react-big-calendar#readme"
135135
}

src/addons/dragAndDrop/EventContainerWrapper.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import Selection, {
88
} from '../../Selection'
99
import TimeGridEvent from '../../TimeGridEvent'
1010
import { dragAccessors, eventTimes, pointInColumn } from './common'
11-
import NoopWrapper from '../../NoopWrapper'
1211

1312
class EventContainerWrapper extends React.Component {
1413
static propTypes = {
@@ -254,7 +253,7 @@ class EventContainerWrapper extends React.Component {
254253
className="rbc-addons-dnd-drag-preview"
255254
style={{ top, height, width: 100 }}
256255
getters={getters}
257-
components={{ ...components, eventWrapper: NoopWrapper }}
256+
components={components}
258257
accessors={{ ...accessors, ...dragAccessors }}
259258
continuesPrior={startsBeforeDay}
260259
continuesAfter={startsAfterDay}

src/addons/dragAndDrop/withDragAndDrop.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,16 @@ export default function withDragAndDrop(Calendar) {
5050
this.state = { interacting: false }
5151
}
5252

53+
componentDidUpdate(prevProps) {
54+
if (prevProps.components !== this.props.components) {
55+
this.components = mergeComponents(this.props.components, {
56+
eventWrapper: EventWrapper,
57+
eventContainerWrapper: EventContainerWrapper,
58+
weekWrapper: WeekWrapper,
59+
})
60+
}
61+
}
62+
5363
getDnDContextValue() {
5464
return {
5565
draggable: {

0 commit comments

Comments
 (0)