|
| 1 | +patch-package |
| 2 | +--- a/node_modules/react-dnd-scrollzone/lib/index.js |
| 3 | ++++ b/node_modules/react-dnd-scrollzone/lib/index.js |
| 4 | +@@ -11,7 +11,8 @@ var _createClass = function () { function defineProperties(target, props) { for |
| 5 | + |
| 6 | + exports.createHorizontalStrength = createHorizontalStrength; |
| 7 | + exports.createVerticalStrength = createVerticalStrength; |
| 8 | +-exports.default = createScrollingComponent; |
| 9 | ++exports.createScrollingComponent = createScrollingComponent; |
| 10 | ++exports.default = createScrollingComponentWithConsumer; |
| 11 | + |
| 12 | + var _react = require('react'); |
| 13 | + |
| 14 | +@@ -35,6 +36,8 @@ var _reactDisplayName = require('react-display-name'); |
| 15 | + |
| 16 | + var _reactDisplayName2 = _interopRequireDefault(_reactDisplayName); |
| 17 | + |
| 18 | ++var _DragDropContext = require('react-dnd/lib/DragDropContext'); |
| 19 | ++ |
| 20 | + var _hoistNonReactStatics = require('hoist-non-react-statics'); |
| 21 | + |
| 22 | + var _hoistNonReactStatics2 = _interopRequireDefault(_hoistNonReactStatics); |
| 23 | +@@ -161,7 +164,7 @@ function createScrollingComponent(WrappedComponent) { |
| 24 | + // have to attach the listeners to the body |
| 25 | + window.document.body.addEventListener('touchmove', this.handleEvent); |
| 26 | + |
| 27 | +- this.clearMonitorSubscription = this.context.dragDropManager.getMonitor().subscribeToStateChange(function () { |
| 28 | ++ this.clearMonitorSubscription = this.props.dragDropManager.getMonitor().subscribeToStateChange(function () { |
| 29 | + return _this2.handleMonitorChange(); |
| 30 | + }); |
| 31 | + } |
| 32 | +@@ -176,7 +179,7 @@ function createScrollingComponent(WrappedComponent) { |
| 33 | + }, { |
| 34 | + key: 'handleMonitorChange', |
| 35 | + value: function handleMonitorChange() { |
| 36 | +- var isDragging = this.context.dragDropManager.getMonitor().isDragging(); |
| 37 | ++ var isDragging = this.props.dragDropManager.getMonitor().isDragging(); |
| 38 | + |
| 39 | + if (!this.dragging && isDragging) { |
| 40 | + this.dragging = true; |
| 41 | +@@ -286,6 +289,7 @@ function createScrollingComponent(WrappedComponent) { |
| 42 | + |
| 43 | + ScrollingComponent.displayName = 'Scrolling(' + (0, _reactDisplayName2.default)(WrappedComponent) + ')'; |
| 44 | + ScrollingComponent.propTypes = { |
| 45 | ++ dragDropManager: _propTypes2.default.object.isRequired, |
| 46 | + onScrollChange: _propTypes2.default.func, |
| 47 | + verticalStrength: _propTypes2.default.func, |
| 48 | + horizontalStrength: _propTypes2.default.func, |
| 49 | +@@ -297,10 +301,19 @@ function createScrollingComponent(WrappedComponent) { |
| 50 | + horizontalStrength: defaultHorizontalStrength, |
| 51 | + strengthMultiplier: 30 |
| 52 | + }; |
| 53 | +- ScrollingComponent.contextTypes = { |
| 54 | +- dragDropManager: _propTypes2.default.object |
| 55 | +- }; |
| 56 | + |
| 57 | + |
| 58 | + return (0, _hoistNonReactStatics2.default)(ScrollingComponent, WrappedComponent); |
| 59 | ++}function createScrollingComponentWithConsumer(WrappedComponent) { |
| 60 | ++ var ScrollingComponent = createScrollingComponent(WrappedComponent); |
| 61 | ++ return function (props) { |
| 62 | ++ return _react2.default.createElement( |
| 63 | ++ _DragDropContext.Consumer, |
| 64 | ++ null, |
| 65 | ++ function (_ref4) { |
| 66 | ++ var dragDropManager = _ref4.dragDropManager; |
| 67 | ++ return dragDropManager === undefined ? null : _react2.default.createElement(ScrollingComponent, _extends({}, props, { dragDropManager: dragDropManager })); |
| 68 | ++ } |
| 69 | ++ ); |
| 70 | ++ }; |
| 71 | + } |
0 commit comments