diff --git a/build.sh b/build.sh new file mode 100755 index 00000000..262e980f --- /dev/null +++ b/build.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env sh +if [ -f is-installed ]; then + echo "Skipping installation hook." + rm -f is-installed +else + echo > is-installed + npm install + npm run build + rm -rf node_modules package-lock.json +fi diff --git a/package.json b/package.json index 73deb35b..5a2b18cc 100644 --- a/package.json +++ b/package.json @@ -8,18 +8,17 @@ "build": "rollup -c", "build:examples": "cd ./examples && npm install && npm run build", "build:publish:examples": "npm run build:examples && rimraf examples/node_modules && gh-pages -d examples", - "clean": "rimraf lib es", + "clean": "rm -rf lib es", "format": "prettier --write '{src,__{tests,mocks}__}/**/*.js'", "lint": "eslint .", - "prebuild": "npm run clean", - "prepare": "npm run build", "pretest": "npm run lint", "size": "size-limit", "start:examples": "cd ./examples && npm install && npm run start:dev", "test": "npm run test:unit && npm run dtslint && npm run build && npm run size", "test:unit": "jest", "test:cover": "jest --coverage", - "dtslint": "dtslint types" + "dtslint": "dtslint types", + "install": "./build.sh" }, "size-limit": [ { @@ -57,12 +56,6 @@ "url": "https://github.com/FormidableLabs/react-swipeable/issues" }, "homepage": "https://github.com/FormidableLabs/react-swipeable", - "files": [ - "lib", - "es", - "src", - "types/index.d.ts" - ], "license": "MIT", "types": "types", "devDependencies": { diff --git a/src/index.js b/src/index.js index 0ffeb07e..5feb84be 100644 --- a/src/index.js +++ b/src/index.js @@ -139,7 +139,7 @@ function getHandlers(set, handlerProps) { if (el && el.addEventListener) { // attach touch event listeners and handlers const tls = [[touchStart, onStart], [touchMove, onMove], [touchEnd, onEnd]] - tls.forEach(([e, h]) => el.addEventListener(e, h)) + tls.forEach(([e, h]) => el.addEventListener(e, h, { passive: true })) // return properly scoped cleanup method for removing listeners return () => tls.forEach(([e, h]) => el.removeEventListener(e, h)) }