Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-easy-swipe

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-easy-swipe - npm Package Compare versions

Comparing version 0.0.4 to 0.0.5

39

lib/demo.js

@@ -1,5 +0,1 @@

'use strict';
function _typeof(obj) { return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj; }
(function (global, factory) {

@@ -18,2 +14,4 @@ if (typeof define === "function" && define.amd) {

})(this, function (_react, _reactDom, _reactSwipe) {
'use strict';
var _react2 = _interopRequireDefault(_react);

@@ -37,3 +35,3 @@

var _createClass = (function () {
var _createClass = function () {
function defineProperties(target, props) {

@@ -54,3 +52,3 @@ for (var i = 0; i < props.length; i++) {

};
})();
}();

@@ -62,3 +60,3 @@ function _possibleConstructorReturn(self, call) {

return call && ((typeof call === 'undefined' ? 'undefined' : _typeof(call)) === "object" || typeof call === "function") ? call : self;
return call && (typeof call === "object" || typeof call === "function") ? call : self;
}

@@ -82,3 +80,3 @@

var MyComponent = (function (_Component) {
var MyComponent = function (_Component) {
_inherits(MyComponent, _Component);

@@ -89,3 +87,3 @@

return _possibleConstructorReturn(this, Object.getPrototypeOf(MyComponent).apply(this, arguments));
return _possibleConstructorReturn(this, (MyComponent.__proto__ || Object.getPrototypeOf(MyComponent)).apply(this, arguments));
}

@@ -121,9 +119,16 @@

};
return _react2.default.createElement(_reactSwipe2.default, {
onSwipeStart: this.onSwipeStart,
onSwipeMove: this.onSwipeMove,
onSwipeEnd: this.onSwipeEnd
}, _react2.default.createElement('div', {
style: boxStyle
}, 'Open the console and swipe me'));
return _react2.default.createElement(
_reactSwipe2.default,
{
onSwipeStart: this.onSwipeStart,
onSwipeMove: this.onSwipeMove,
onSwipeEnd: this.onSwipeEnd
},
_react2.default.createElement(
'div',
{ style: boxStyle },
'Open the console and swipe me'
)
);
}

@@ -133,5 +138,5 @@ }]);

return MyComponent;
})(_react.Component);
}(_react.Component);
_reactDom2.default.render(_react2.default.createElement(MyComponent, null), document.getElementById('root'));
});

@@ -1,3 +0,1 @@

'use strict';
(function (global, factory) {

@@ -16,2 +14,4 @@ if (typeof define === "function" && define.amd) {

})(this, function (exports, _reactSwipe) {
'use strict';
Object.defineProperty(exports, "__esModule", {

@@ -18,0 +18,0 @@ value: true

@@ -1,5 +0,1 @@

'use strict';
function _typeof(obj) { return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj; }
(function (global, factory) {

@@ -18,2 +14,4 @@ if (typeof define === "function" && define.amd) {

})(this, function (exports, _react) {
'use strict';
Object.defineProperty(exports, "__esModule", {

@@ -37,3 +35,3 @@ value: true

var _createClass = (function () {
var _createClass = function () {
function defineProperties(target, props) {

@@ -54,3 +52,3 @@ for (var i = 0; i < props.length; i++) {

};
})();
}();

@@ -62,3 +60,3 @@ function _possibleConstructorReturn(self, call) {

return call && ((typeof call === 'undefined' ? 'undefined' : _typeof(call)) === "object" || typeof call === "function") ? call : self;
return call && (typeof call === "object" || typeof call === "function") ? call : self;
}

@@ -82,3 +80,3 @@

var ReactSwipe = (function (_Component) {
var ReactSwipe = function (_Component) {
_inherits(ReactSwipe, _Component);

@@ -89,3 +87,3 @@

var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(ReactSwipe).call(this));
var _this = _possibleConstructorReturn(this, (ReactSwipe.__proto__ || Object.getPrototypeOf(ReactSwipe)).call(this));

@@ -104,6 +102,4 @@ _this._handleSwipeStart = _this._handleSwipeStart.bind(_this);

var pageY = _e$touches$.pageY;
this.touchStart = {
pageX: pageX,
pageY: pageY
};
this.touchStart = { pageX: pageX, pageY: pageY };
this.props.onSwipeStart();

@@ -114,14 +110,18 @@ }

value: function _handleSwipeMove(e) {
e.preventDefault();
var deltaX = e.touches[0].pageX - this.touchStart.pageX;
var deltaY = e.touches[0].pageY - this.touchStart.pageY;
this.swiping = true;
this.props.onSwipeMove({
// handling the responsability of cancelling the scroll to
// the component handling the event
var shouldPreventDefault = this.props.onSwipeMove({
x: deltaX,
y: deltaY
});
this.touchPosition = {
deltaX: deltaX,
deltaY: deltaY
};
if (shouldPreventDefault) {
e.preventDefault();
}
this.touchPosition = { deltaX: deltaX, deltaY: deltaY };
}

@@ -137,3 +137,2 @@ }, {

}
if (this.touchPosition.deltaY < 0) {

@@ -145,3 +144,2 @@ this.props.onSwipeUp(1);

}
this.props.onSwipeEnd();

@@ -155,9 +153,13 @@ this.touchStart = null;

value: function render() {
return _react2.default.createElement(this.props.tagName, {
onTouchMove: this._handleSwipeMove,
onTouchStart: this._handleSwipeStart,
onTouchEnd: this._handleSwipeEnd,
className: this.props.className,
style: this.props.style
}, this.props.children);
return _react2.default.createElement(
this.props.tagName,
{
onTouchMove: this._handleSwipeMove,
onTouchStart: this._handleSwipeStart,
onTouchEnd: this._handleSwipeEnd,
className: this.props.className,
style: this.props.style
},
this.props.children
);
}

@@ -167,3 +169,3 @@ }]);

return ReactSwipe;
})(_react.Component);
}(_react.Component);

@@ -193,4 +195,7 @@ ReactSwipe.propTypes = {

};
ReactSwipe.displayName = 'ReactSwipe';
exports.default = ReactSwipe;
});
{
"name": "react-easy-swipe",
"version": "0.0.4",
"version": "0.0.5",
"description": "React easy swipe - Easy handler for common touch operations",

@@ -26,4 +26,4 @@ "main": "./lib/index.js",

"coveralls": "cat coverage/lcov.info | coveralls",
"prerelease": "npm test && npm run lint && npm run build",
"release": "(git pull origin master && npm version patch && git push origin master && git checkout release && git merge master && git push origin release && git checkout master && npm publish)"
"prepublish-to-npm": "git pull && npm run build && git add . && git commit -m 'Prepare for publishing'",
"publish-to-npm": "(git pull origin master && npm version patch && git push origin master && npm publish && git push --tags)"
},

@@ -59,5 +59,6 @@ "author": {

"mocha": "^2.3.4",
"react": "^0.14.3",
"react-addons-test-utils": "^0.14.3",
"react": "^0.14.3",
"react-dom": "^0.14.3",
"watch": "^0.19.2",
"webpack": "^1.12.10"

@@ -64,0 +65,0 @@ },

@@ -12,2 +12,3 @@ # REACT EASY SWIPE

Tip: To prevent scroll during swipe, return true from the handler passed to onSwipeMove

@@ -14,0 +15,0 @@ ## Instalation

Sorry, the diff of this file is not supported yet

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