Skip to content

Using patch #426

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

Merged
merged 1 commit into from
Dec 3, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 11 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "2.3.0",
"description": "Drag-and-drop sortable component for nested data and hierarchies",
"scripts": {
"postinstall": "cd node_modules/react-dnd-scrollzone && npm i --ignore-scripts && npm run build",
"postinstall": "patch-package",
"prebuild": "npm run lint",
"build": "npm run clean && NODE_ENV=rollup rollup -c",
"build:storybook": "npm run clean:storybook && build-storybook -o build",
Expand Down Expand Up @@ -60,15 +60,16 @@
"dependencies": {
"lodash.isequal": "^4.5.0",
"prop-types": "^15.6.1",
"react-dnd": "^6.0.0",
"react-dnd-html5-backend": "^6.0.0",
"react-dnd-scrollzone": "github:dolezel/react-dnd-scrollzone.git#41203ef00c991f744aa87e897d7d518d32f6a994",
"react-dnd": "^7.0.1",
"react-dnd-html5-backend": "^7.0.1",
"react-dnd-scrollzone": "4.0.0",
"react-lifecycles-compat": "^3.0.4",
"react-virtualized": "^9.19.1"
},
"peerDependencies": {
"react": "^15.3.0 || ^16.0.0",
"react-dom": "^15.3.0 || ^16.0.0"
"react": "^16.3.0",
"react-dnd": "^6.0.0 || ^7.0.0",
"react-dom": "^16.3.0"
},
"devDependencies": {
"@babel/cli": "^7.1.5",
Expand Down Expand Up @@ -103,12 +104,14 @@
"jest": "^23.1.0",
"jest-enzyme": "^7.0.1",
"json-loader": "^0.5.7",
"patch-package": "^5.1.1",
"postcss-loader": "^3.0.0",
"postinstall-postinstall": "^2.0.0",
"prettier": "^1.13.3",
"react": "^16.4.0",
"react-addons-shallow-compare": "^15.6.2",
"react-dnd-test-backend": "6.0.0",
"react-dnd-touch-backend": "0.6.0",
"react-dnd-test-backend": "^7.0.1",
"react-dnd-touch-backend": "^0.6.0",
"react-dom": "^16.4.0",
"react-hot-loader": "^4.3.0",
"react-sortable-tree-theme-file-explorer": "^1.1.2",
Expand Down
71 changes: 71 additions & 0 deletions patches/react-dnd-scrollzone+4.0.0.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
patch-package
--- a/node_modules/react-dnd-scrollzone/lib/index.js
+++ b/node_modules/react-dnd-scrollzone/lib/index.js
@@ -11,7 +11,8 @@ var _createClass = function () { function defineProperties(target, props) { for

exports.createHorizontalStrength = createHorizontalStrength;
exports.createVerticalStrength = createVerticalStrength;
-exports.default = createScrollingComponent;
+exports.createScrollingComponent = createScrollingComponent;
+exports.default = createScrollingComponentWithConsumer;

var _react = require('react');

@@ -35,6 +36,8 @@ var _reactDisplayName = require('react-display-name');

var _reactDisplayName2 = _interopRequireDefault(_reactDisplayName);

+var _DragDropContext = require('react-dnd/lib/DragDropContext');
+
var _hoistNonReactStatics = require('hoist-non-react-statics');

var _hoistNonReactStatics2 = _interopRequireDefault(_hoistNonReactStatics);
@@ -161,7 +164,7 @@ function createScrollingComponent(WrappedComponent) {
// have to attach the listeners to the body
window.document.body.addEventListener('touchmove', this.handleEvent);

- this.clearMonitorSubscription = this.context.dragDropManager.getMonitor().subscribeToStateChange(function () {
+ this.clearMonitorSubscription = this.props.dragDropManager.getMonitor().subscribeToStateChange(function () {
return _this2.handleMonitorChange();
});
}
@@ -176,7 +179,7 @@ function createScrollingComponent(WrappedComponent) {
}, {
key: 'handleMonitorChange',
value: function handleMonitorChange() {
- var isDragging = this.context.dragDropManager.getMonitor().isDragging();
+ var isDragging = this.props.dragDropManager.getMonitor().isDragging();

if (!this.dragging && isDragging) {
this.dragging = true;
@@ -286,6 +289,7 @@ function createScrollingComponent(WrappedComponent) {

ScrollingComponent.displayName = 'Scrolling(' + (0, _reactDisplayName2.default)(WrappedComponent) + ')';
ScrollingComponent.propTypes = {
+ dragDropManager: _propTypes2.default.object.isRequired,
onScrollChange: _propTypes2.default.func,
verticalStrength: _propTypes2.default.func,
horizontalStrength: _propTypes2.default.func,
@@ -297,10 +301,19 @@ function createScrollingComponent(WrappedComponent) {
horizontalStrength: defaultHorizontalStrength,
strengthMultiplier: 30
};
- ScrollingComponent.contextTypes = {
- dragDropManager: _propTypes2.default.object
- };


return (0, _hoistNonReactStatics2.default)(ScrollingComponent, WrappedComponent);
+}function createScrollingComponentWithConsumer(WrappedComponent) {
+ var ScrollingComponent = createScrollingComponent(WrappedComponent);
+ return function (props) {
+ return _react2.default.createElement(
+ _DragDropContext.Consumer,
+ null,
+ function (_ref4) {
+ var dragDropManager = _ref4.dragDropManager;
+ return dragDropManager === undefined ? null : _react2.default.createElement(ScrollingComponent, _extends({}, props, { dragDropManager: dragDropManager }));
+ }
+ );
+ };
}
Loading