react-swipeable
Advanced tools
Comparing version 6.2.0 to 6.2.1
@@ -0,1 +1,7 @@ | ||
# v6.2.1 | ||
* Fix issue with some config properties being set to `undefined` breaking swipeable | ||
* [PR #296](https://github.com/formidablelabs/react-swipeable/pull/296) | ||
* explicitly set `undefined` config props to config defaults | ||
* Thank you [@simonflk](https://github.com/simonflk) | ||
# v6.2.0 | ||
@@ -2,0 +8,0 @@ * `delta` prop can now be an `object` specifying different values for each direction |
@@ -231,3 +231,3 @@ var React = require('react'); | ||
state.cleanUpTouch(); | ||
addState.cleanUpTouch = undefined; | ||
addState.cleanUpTouch = void 0; | ||
} | ||
@@ -261,3 +261,3 @@ | ||
state.cleanUpTouch(); | ||
addState.cleanUpTouch = undefined; | ||
addState.cleanUpTouch = void 0; | ||
} else if (props.trackTouch && !state.cleanUpTouch) { | ||
@@ -276,3 +276,7 @@ if (state.el) { | ||
var transientProps = React__namespace.useRef(_extends({}, defaultProps)); | ||
transientProps.current = _extends({}, defaultProps, options); | ||
transientProps.current = _extends({}, defaultProps, options, { | ||
delta: options.delta === void 0 ? defaultProps.delta : options.delta, | ||
rotationAngle: options.rotationAngle === void 0 ? defaultProps.rotationAngle : options.rotationAngle, | ||
trackTouch: options.trackTouch === void 0 ? defaultProps.trackTouch : options.trackTouch | ||
}); | ||
@@ -279,0 +283,0 @@ var _React$useMemo = React__namespace.useMemo(function () { |
@@ -196,3 +196,3 @@ import * as React from 'react'; | ||
state.cleanUpTouch(); | ||
addState.cleanUpTouch = undefined; | ||
addState.cleanUpTouch = void 0; | ||
} | ||
@@ -226,3 +226,3 @@ | ||
state.cleanUpTouch(); | ||
addState.cleanUpTouch = undefined; | ||
addState.cleanUpTouch = void 0; | ||
} else if (props.trackTouch && !state.cleanUpTouch) { | ||
@@ -243,3 +243,7 @@ if (state.el) { | ||
const transientProps = React.useRef(_extends({}, defaultProps)); | ||
transientProps.current = _extends({}, defaultProps, options); | ||
transientProps.current = _extends({}, defaultProps, options, { | ||
delta: options.delta === void 0 ? defaultProps.delta : options.delta, | ||
rotationAngle: options.rotationAngle === void 0 ? defaultProps.rotationAngle : options.rotationAngle, | ||
trackTouch: options.trackTouch === void 0 ? defaultProps.trackTouch : options.trackTouch | ||
}); | ||
const [handlers, attachTouch] = React.useMemo(() => getHandlers(stateSetter => transientState.current = stateSetter(transientState.current, transientProps.current), { | ||
@@ -246,0 +250,0 @@ trackMouse |
@@ -209,3 +209,3 @@ import * as React from 'react'; | ||
state.cleanUpTouch(); | ||
addState.cleanUpTouch = undefined; | ||
addState.cleanUpTouch = void 0; | ||
} | ||
@@ -239,3 +239,3 @@ | ||
state.cleanUpTouch(); | ||
addState.cleanUpTouch = undefined; | ||
addState.cleanUpTouch = void 0; | ||
} else if (props.trackTouch && !state.cleanUpTouch) { | ||
@@ -254,3 +254,7 @@ if (state.el) { | ||
var transientProps = React.useRef(_extends({}, defaultProps)); | ||
transientProps.current = _extends({}, defaultProps, options); | ||
transientProps.current = _extends({}, defaultProps, options, { | ||
delta: options.delta === void 0 ? defaultProps.delta : options.delta, | ||
rotationAngle: options.rotationAngle === void 0 ? defaultProps.rotationAngle : options.rotationAngle, | ||
trackTouch: options.trackTouch === void 0 ? defaultProps.trackTouch : options.trackTouch | ||
}); | ||
@@ -257,0 +261,0 @@ var _React$useMemo = React.useMemo(function () { |
@@ -234,3 +234,3 @@ (function (global, factory) { | ||
state.cleanUpTouch(); | ||
addState.cleanUpTouch = undefined; | ||
addState.cleanUpTouch = void 0; | ||
} | ||
@@ -264,3 +264,3 @@ | ||
state.cleanUpTouch(); | ||
addState.cleanUpTouch = undefined; | ||
addState.cleanUpTouch = void 0; | ||
} else if (props.trackTouch && !state.cleanUpTouch) { | ||
@@ -279,3 +279,7 @@ if (state.el) { | ||
var transientProps = React__namespace.useRef(_extends({}, defaultProps)); | ||
transientProps.current = _extends({}, defaultProps, options); | ||
transientProps.current = _extends({}, defaultProps, options, { | ||
delta: options.delta === void 0 ? defaultProps.delta : options.delta, | ||
rotationAngle: options.rotationAngle === void 0 ? defaultProps.rotationAngle : options.rotationAngle, | ||
trackTouch: options.trackTouch === void 0 ? defaultProps.trackTouch : options.trackTouch | ||
}); | ||
@@ -282,0 +286,0 @@ var _React$useMemo = React__namespace.useMemo(function () { |
{ | ||
"name": "react-swipeable", | ||
"version": "6.2.0", | ||
"version": "6.2.1", | ||
"description": "React Swipe event handler hook", | ||
@@ -5,0 +5,0 @@ "main": "./dist/react-swipeable.js", |
@@ -139,2 +139,6 @@ # React Swipeable | ||
Example by [@merrywhether #180](https://github.com/FormidableLabs/react-swipeable/issues/180#issuecomment-649677983) | ||
##### Example codesandbox with swipeable on document and nested swipe | ||
https://codesandbox.io/s/react-swipeable-document-swipe-example-1yvr2v | ||
```js | ||
@@ -141,0 +145,0 @@ const { ref } = useSwipeable({ |
@@ -12,2 +12,3 @@ /* global document */ | ||
Setter, | ||
ConfigurationOptions, | ||
SwipeableCallbacks, | ||
@@ -38,3 +39,3 @@ SwipeableHandlers, | ||
const defaultProps = { | ||
const defaultProps: ConfigurationOptions = { | ||
delta: 10, | ||
@@ -258,3 +259,3 @@ preventDefaultTouchmoveEvent: false, | ||
state.cleanUpTouch(); | ||
addState.cleanUpTouch = undefined; | ||
addState.cleanUpTouch = void 0; | ||
} | ||
@@ -296,3 +297,3 @@ // only attach if we want to track touch | ||
state.cleanUpTouch(); | ||
addState.cleanUpTouch = undefined; | ||
addState.cleanUpTouch = void 0; | ||
} else if (props.trackTouch && !state.cleanUpTouch) { | ||
@@ -316,3 +317,16 @@ // attach/re-attach touch handlers | ||
}); | ||
transientProps.current = { ...defaultProps, ...options }; | ||
transientProps.current = { | ||
...defaultProps, | ||
...options, | ||
// Force defaults for config properties | ||
delta: options.delta === void 0 ? defaultProps.delta : options.delta, | ||
rotationAngle: | ||
options.rotationAngle === void 0 | ||
? defaultProps.rotationAngle | ||
: options.rotationAngle, | ||
trackTouch: | ||
options.trackTouch === void 0 | ||
? defaultProps.trackTouch | ||
: options.trackTouch, | ||
}; | ||
@@ -319,0 +333,0 @@ const [handlers, attachTouch] = React.useMemo( |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
157512
1417
206