New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

react-carousel

Package Overview
Dependencies
Maintainers
1
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-carousel - npm Package Compare versions

Comparing version 1.0.2 to 1.1.0

example/306x306.png

61

Carousel.js

@@ -6,5 +6,2 @@ var React = require('react/addons')

var MIN_MOVEMENT = 100
var MAX_TRANSITION_TIME = 350
var Carousel = React.createClass({

@@ -47,3 +44,3 @@ getInitialState: function () {

doMoveImage: function (x) {
doMoveImage: function (_, x) {
var index = this.state.currentIndex

@@ -70,16 +67,2 @@ var imageMoveIndex = this.state.currentIndex

moveImage: function (e, x) {
this.doMoveImage(x)
},
maybeMoveImage: function (e, x) {
if (Math.abs(x) < MIN_MOVEMENT) {
this.setState({
delta: 0
})
return
}
this.doMoveImage(x)
},
prevImageScroll: function (e, delta) {

@@ -106,25 +89,23 @@ this.setState({

var transitionTime = Math.min(
this.state.itemWidths[this.state.prevIndex] / 2,
MAX_TRANSITION_TIME
)
var transition = 'all ' + transitionTime + 'ms ease-out'
var transition = 'all 250ms ease-out'
return React.DOM.div(
{ className: 'carousel' },
Swipeable({
onFlick: this.moveImage,
onSwipingRight: this.prevImageScroll,
onSwipingLeft: this.nextImageScroll,
onSwiped: this.maybeMoveImage,
className: 'carousel-container',
ref: 'carouselContainer',
style: {
'-webkit-transform': 'translateX(' + delta + 'px)',
transition: this.state.delta === 0 ? transition : 'none',
width: this.state.containerWidth + 'px'
}
}, this.props.children.map(function (item, i) {
return React.DOM.div({ key: i, className: 'carousel-item' }, item)
}))
return this.transferPropsTo(
React.DOM.div(
{ className: 'carousel' },
Swipeable({
onFlick: this.doMoveImage,
onSwipingRight: this.prevImageScroll,
onSwipingLeft: this.nextImageScroll,
onSwiped: this.doMoveImage,
className: 'carousel-container',
ref: 'carouselContainer',
style: {
'-webkit-transform': 'translateX(' + delta + 'px)',
transition: this.state.delta === 0 ? transition : 'none',
width: this.state.containerWidth + 'px'
}
}, this.props.children.map(function (item, i) {
return React.DOM.div({ key: i, className: 'carousel-item' }, item)
}))
)
)

@@ -131,0 +112,0 @@ }

{
"name": "react-carousel",
"version": "1.0.2",
"version": "1.1.0",
"description": "A carousel written in react",

@@ -5,0 +5,0 @@ "main": "Carousel.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc