react-multi-carousel
Advanced tools
Comparing version 1.0.26 to 1.0.27
@@ -15,4 +15,4 @@ "use strict"; | ||
const utils_1 = require("./utils"); | ||
const defaultTransitionDuration = 500; | ||
const defaultTransition = "transform 500ms ease-in-out"; | ||
const defaultTransitionDuration = 300; | ||
const defaultTransition = "transform 300ms ease-in-out"; | ||
class Container extends React.Component { | ||
@@ -39,2 +39,3 @@ constructor(props) { | ||
this.handleTouchEnd = this.handleTouchEnd.bind(this); | ||
this.onKeyUp = this.onKeyUp.bind(this); | ||
this.onMove = false; | ||
@@ -51,2 +52,5 @@ this.initialPosition = 0; | ||
this.onResize(); | ||
if (this.props.keyBoardControl) { | ||
window.addEventListener("keyup", this.onKeyUp); | ||
} | ||
} | ||
@@ -139,2 +143,5 @@ setItemsToShow(shouldCorrectItemPosition) { | ||
window.removeEventListener("resize", this.onResize); | ||
if (this.props.keyBoardControl) { | ||
window.removeEventListener("keyup", this.onKeyUp); | ||
} | ||
} | ||
@@ -252,2 +259,10 @@ resetMoveStatus() { | ||
} | ||
onKeyUp(e) { | ||
switch (e.keyCode) { | ||
case 37: | ||
return this.previous(); | ||
case 39: | ||
return this.next(); | ||
} | ||
} | ||
renderLeftArrow() { | ||
@@ -316,3 +331,4 @@ const { customLeftArrow } = this.props; | ||
contentClassName: "", | ||
itemClassName: "" | ||
itemClassName: "", | ||
keyBoardControl: true | ||
}; | ||
@@ -319,0 +335,0 @@ const Carousel = (_a) => { |
@@ -27,2 +27,3 @@ /// <reference types="react" /> | ||
containerClassName?: string; | ||
keyBoardControl?: boolean; | ||
customTransition?: string; | ||
@@ -29,0 +30,0 @@ transitionDuration?: number; |
{ | ||
"name": "react-multi-carousel", | ||
"version": "1.0.26", | ||
"version": "1.0.27", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
Sorry, the diff of this file is not supported yet
38657
494