react-bidirectional-infinite-scroll
Advanced tools
Comparing version 1.3.0 to 2.0.0-alpha-1
118
package.json
{ | ||
"name": "react-bidirectional-infinite-scroll", | ||
"version": "1.3.0", | ||
"version": "2.0.0-alpha-1", | ||
"description": "Bidirectional infinite scroll written using react", | ||
"main": "dist/index.js", | ||
"main": "lib/index.js", | ||
"files": [ | ||
"es", | ||
"lib" | ||
], | ||
"scripts": { | ||
"build": "npm run lint && npm run test:coverage && npm run clean && babel src -d dist", | ||
"build:storybook": "build-storybook", | ||
"deploy:storybook": "gh-pages -d storybook-static", | ||
"clean": "rimraf dist", | ||
"build": "nwb build-react-component", | ||
"clean": "nwb clean-module && nwb clean-demo", | ||
"lint": "eslint src demo", | ||
"lint:fix": "eslint src demo --fix", | ||
"start": "nwb serve-react-demo", | ||
"test": "nwb test-react", | ||
"test:coverage": "nwb test-react --coverage", | ||
"test:watch": "nwb test-react --server", | ||
"storybook": "start-storybook -p 9001", | ||
"test": "mocha --require jsdom-global/register --require tests/helpers/setup.js tests/specs/*.spec.js", | ||
"test:coverage": "NODE_ENV=test nyc --reporter=html --reporter=text mocha --require jsdom-global/register --require tests/helpers/setup.js tests/specs/*.spec.js", | ||
"test:file": "mocha --require jsdom-global/register --require tests/helpers/setup.js ", | ||
"lint": "eslint src", | ||
"lint:fix": "eslint src --fix", | ||
"report": "nyc report --reporter=text-lcov | coveralls" | ||
"storybook:build": "build-storybook", | ||
"storybook:publish": "gh-pages -d storybook-static" | ||
}, | ||
"nyc": { | ||
"lines": 99, | ||
"check-coverage": true, | ||
"exclude": [ | ||
"tests", | ||
"dist" | ||
], | ||
"sourceMap": false, | ||
"instrument": false | ||
"dependencies": {}, | ||
"peerDependencies": { | ||
"prop-types": "15.x", | ||
"react": "15.x || 16.x", | ||
"react-dom": "15.x || 16.x" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/eberhara/react-bidirectional-infinite-scroll.git" | ||
"devDependencies": { | ||
"@storybook/react": "^3.3.14", | ||
"ajv": "^6.1.1", | ||
"babel-eslint": "^8.2.2", | ||
"babel-preset-airbnb": "^2.4.0", | ||
"babel-preset-env": "^1.6.1", | ||
"babel-preset-es2015": "^6.24.1", | ||
"chai": "^4.1.2", | ||
"enzyme": "^3.3.0", | ||
"enzyme-adapter-react-16": "^1.1.1", | ||
"eslint": "^4.18.1", | ||
"eslint-config-airbnb": "^16.1.0", | ||
"eslint-plugin-import": "^2.9.0", | ||
"eslint-plugin-jsx-a11y": "^6.0.3", | ||
"eslint-plugin-react": "^7.7.0", | ||
"gh-pages": "^1.1.0", | ||
"inferno": "^3.10.1", | ||
"nwb": "0.21.x", | ||
"prop-types": "^15.6.0", | ||
"react": "^16.2.0", | ||
"react-addons-test-utils": "^15.6.2", | ||
"react-dom": "^16.2.0", | ||
"sinon": "^4.4.1" | ||
}, | ||
"keywords": [ | ||
"react", | ||
"component", | ||
"base" | ||
], | ||
"author": "Andre Eberhardt - santos.eberhardt@gmail.com", | ||
@@ -44,38 +59,15 @@ "license": "MIT", | ||
"homepage": "https://github.com/eberhara/react-bidirectional-infinite-scroll", | ||
"devDependencies": { | ||
"@kadira/storybook": "^2.35.3", | ||
"babel-cli": "^6.14.0", | ||
"babel-core": "^6.10.4", | ||
"babel-loader": "^6.2.4", | ||
"babel-plugin-istanbul": "^3.0.0", | ||
"babel-plugin-react-intl": "^2.2.0", | ||
"babel-preset-airbnb": "^2.0.0", | ||
"babel-preset-es2015": "^6.9.0", | ||
"babel-preset-react": "^6.11.1", | ||
"babel-preset-stage-0": "^6.5.0", | ||
"babel-register": "^6.23.0", | ||
"chai": "^3.5.0", | ||
"coveralls": "^2.12.0", | ||
"enzyme": "^2.7.1", | ||
"eslint": "^2.13.1", | ||
"eslint-config-airbnb": "^9.0.1", | ||
"eslint-plugin-import": "^1.16.0", | ||
"eslint-plugin-jsx-a11y": "^1.5.5", | ||
"eslint-plugin-react": "^5.2.2", | ||
"gh-pages": "^0.12.0", | ||
"jsdom": "^9.11.0", | ||
"jsdom-global": "^2.1.1", | ||
"mocha": "^2.5.3", | ||
"nyc": "^7.1.0", | ||
"react": "^15.4.2", | ||
"react-addons-test-utils": "^15.4.2", | ||
"react-dom": "^15.4.2", | ||
"rimraf": "^2.6.0", | ||
"sinon": "^1.17.7", | ||
"webpack-hot-middleware": "^2.17.0" | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/eberhara/react-bidirectional-infinite-scroll.git" | ||
}, | ||
"peerDependencies": { | ||
"react": "^15.4.2", | ||
"react-dom": "^15.4.2" | ||
"keywords": [ | ||
"react", | ||
"react-component", | ||
"infinite-scroll" | ||
], | ||
"engines": { | ||
"node": "^9.2.0", | ||
"npm": "^5.5.1" | ||
} | ||
} |
# react-bidirectional-infinite-scroll | ||
[![build status](https://travis-ci.org/eberhara/react-bidirectional-infinite-scroll.svg?branch=master)](https://travis-ci.org/eberhara/react-bidirectional-infinite-scroll) | ||
[![Coverage Status](https://coveralls.io/repos/github/eberhara/react-bidirectional-infinite-scroll/badge.svg?branch=master)](https://coveralls.io/github/eberhara/react-bidirectional-infinite-scroll?branch=master) | ||
[![NPM version](http://img.shields.io/npm/v/react-bidirectional-infinite-scroll.svg)](https://www.npmjs.org/package/react-bidirectional-infinite-scroll) | ||
[![Travis][build-badge]][build] | ||
[![npm package][npm-badge]][npm] | ||
[![Coveralls][coveralls-badge]][coveralls] | ||
**Bidirectional infinite scroll written using react** | ||
[build-badge]: https://img.shields.io/travis/eberhara/react-bidirectional-infinite-scroll/master.png?style=flat-square | ||
[build]: https://travis-ci.org/eberhara/react-bidirectional-infinite-scroll | ||
[npm-badge]: https://img.shields.io/npm/v/npm-package.png?style=flat-square | ||
[npm]: https://www.npmjs.org/package/npm-package | ||
[coveralls-badge]: https://img.shields.io/coveralls/eberhara/react-bidirectional-infinite-scroll/master.png?style=flat-square | ||
[coveralls]: https://coveralls.io/github/eberhara/react-bidirectional-infinite-scroll | ||
This is a react library that handles infinite scrolling in two directions at the same time: UP/DOWN or LEFT/RIGHT. | ||
@@ -22,4 +31,4 @@ | ||
```javascript | ||
import InfiniteScroll from 'react-bidirectional-infinite-scroll'; | ||
```jsx | ||
import InfiniteScroll from 'react-bidirectional-infinite-scroll' | ||
@@ -29,19 +38,68 @@ ... | ||
render() { | ||
return ( | ||
/// Vertical infinite scroll | ||
<InfiniteScroll onReachBottom={f => f} onReachTop={f => f} > | ||
// ... here goes your infinite list | ||
</InfiniteScroll> | ||
return ( | ||
// Vertical infinite scroll | ||
<InfiniteScroll onReachBottom={f => f} onReachTop={f => f} > | ||
// ... here goes your infinite list | ||
</InfiniteScroll> | ||
/// Horizontal infinite scroll | ||
<InfiniteScroll onReachLeft={f => f} onReachRight={f => f} horizontal> | ||
// ... here goes your infinite list | ||
</InfiniteScroll> | ||
); | ||
// Horizontal infinite scroll | ||
<InfiniteScroll onReachLeft={f => f} onReachRight={f => f} horizontal> | ||
// ... here goes your infinite list | ||
</InfiniteScroll> | ||
) | ||
} | ||
``` | ||
Take a look at [examples folder](./examples) for a complete example. | ||
## More examples | ||
```jsx | ||
import InfiniteScroll from 'react-bidirectional-infinite-scroll' | ||
... | ||
handleHorizontalScroll = (position, previousPosition) => { | ||
const diffScroll = position - previousPosition | ||
const direction = diffScroll > 0 | ||
? 'right' | ||
: 'left' | ||
console.log(`Scroll ${direction} to ${position}`) | ||
} | ||
handleVerticalScroll = (position, previousPosition) => { | ||
const diffScroll = position - previousPosition | ||
const direction = diffScroll > 0 | ||
? 'down' | ||
: 'up' | ||
console.log(`Scroll ${direction} to ${position}`) | ||
} | ||
render() { | ||
return ( | ||
// Vertical scroll verifying scroll direction | ||
<InfiniteScroll onScroll={this.handleVerticalScroll}> | ||
// ... here goes your infinite list | ||
</InfiniteScroll> | ||
// Horizontal scroll verifying scroll direction | ||
<InfiniteScroll onScroll={this.handleHorizontalScroll} horizontal> | ||
// ... here goes your infinite list | ||
</InfiniteScroll> | ||
// Scroll overwriting scroll position (px) | ||
<InfiniteScroll position={100}> | ||
// ... here goes your infinite list | ||
</InfiniteScroll> | ||
) | ||
} | ||
``` | ||
Take a look at [examples folder](./demo/src/examples) for a complete example. | ||
## Contributing | ||
Check [CONTRIBUTING](./CONTRIBUTING.md) for guidance. | ||
## License | ||
@@ -48,0 +106,0 @@ |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
22
126
18354
3
6
299
1
1