- remove
<Swipeable>component, see below for examples on how to make your own - event data update correctly calculate
deltaXanddeltaY- from
initial - currenttocurrent - initial
- from
- drop direct support for ie11 can be fixed with a polyfill
addEventListeneroptions need to be polyfilled for ie11, browser support
- requires react >= 16.8.3, additionally supports new react v17
- changed
EventData->SwipeEventData- The event data provided for all swipe event callbacks - removed
SwipeableOptions- useSwipeablePropsnow - removed all types associated with
<Swipeable>component
With the release of v6 react-swipeable only supports browsers that support options object for addEventListener, Browser compatibility. Which mainly means react-swipeable does not support ie11 by default, you need to polyfill options. For example using event-listener-with-options.
You should be able to recreate all ≤Swipeable> use cases with the useSwipeable hook. If you find you're unable please reach out via an issue and we'll explore other possibilities.
Notes:
nodeNamecan be handled by directly changing your customSwipeable's returned elementclassNameandstyleprops can be handled directly
import { useSwipeable } from 'react-swipeable';
export const Swipeable = ({children, ...props}) => {
const handlers = useSwipeable(props);
return (<div { ...handlers }>{children}</div>);
}import { useSwipeable } from 'react-swipeable';
export const Swipeable = ({children, innerRef, ...props}) => {
const handlers = useSwipeable(props);
const refCallback = (ref) => {
handlers.ref(ref);
innerRef(ref);
}
return (<div { ...handlers } ref={refCallback} >{children}</div>);
}