Skip to content

Commit 96ec1bf

Browse files
author
Jon Deibel
committed
Merged back into master
2 parents 9b77f8b + 0dc2a24 commit 96ec1bf

21 files changed

+35673
-21566
lines changed

.babelrc

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"presets": ["es2015", "react", "stage-2"],
3+
"plugins": [
4+
["transform-object-rest-spread", { "useBuiltIns": true }],
5+
["add-module-exports"]
6+
],
7+
"env": {
8+
"test": {
9+
"plugins": [
10+
"istanbul"
11+
]
12+
}
13+
}
14+
}

.editorconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ indent_size = 4
1212

1313
[**.js]
1414
indent_style = space
15-
indent_size = 4
15+
indent_size = 2

.eslintrc

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"extends": [
3+
"last",
4+
"prettier",
5+
"prettier/react",
6+
"plugin:react/recommended"
7+
],
8+
"plugins": [
9+
"react",
10+
"prettier"
11+
],
12+
"globals": {
13+
"document": true,
14+
"window": true,
15+
"describe": true,
16+
"it": true,
17+
"module": true,
18+
"exports": true,
19+
"require": true
20+
},
21+
"rules": {
22+
"no-unused-vars": [
23+
"off",
24+
{
25+
"vars": "all",
26+
"args": "after-used",
27+
"ignoreRestSiblings": false
28+
}
29+
]
30+
}
31+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
name: Bug report
3+
about: Submit a bug you found using the package
4+
5+
---
6+
7+
**Describe the bug**
8+
A clear and concise description of what the bug is.
9+
10+
**To Reproduce**
11+
Please clone your layout and use of react-infinite-scroller by forking [this Code Sandbox](https://codesandbox.io/s/my6vo3yo78) and linking it here. Doing so will massively expedite getting the bug fixed! 👊
12+
13+
**Expected behavior**
14+
A clear and concise description of what you expected to happen.
15+
16+
**Screenshots**
17+
If applicable, add screenshots to help explain your problem.
18+
19+
**Device (please complete the following information):**
20+
- OS: [e.g. Mac]
21+
- Browser [e.g. chrome, safari]
22+
- Version [e.g. 22]
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
name: Feature request
3+
about: Suggest an idea for this project
4+
5+
---
6+
7+
**Is your feature request related to a problem? Please describe.**
8+
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
9+
10+
**Describe the solution you'd like**
11+
A clear and concise description of what you want to happen.
12+
13+
**Describe alternatives you've considered**
14+
A clear and concise description of any alternative solutions or features you've considered.
15+
16+
**Additional context**
17+
Add any other context or screenshots about the feature request here.

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
node_modules
22
npm-debug.log
33
.DS_Store
4+
.idea
5+
.nyc_output
6+
coverage

.npmignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
src
2+
coverage
3+
test
4+
.nyc_output
5+
docs
6+

.travis.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
language: node_js
2+
node_js:
3+
- "6"
4+
- "7"
5+
script:
6+
- npm run lint
7+
- npm run test
8+
- npm run build
9+
cache:
10+
directories:
11+
- $HOME/.npm

.vscode/settings.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"prettier.eslintIntegration": true,
3+
"editor.formatOnSave": true
4+
}

README.md

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
React Infinite Scroller
22
=======================
33

4+
[![Travis](https://img.shields.io/travis/CassetteRocks/react-infinite-scroller.svg?style=flat-square)](https://travis-ci.org/CassetteRocks/react-infinite-scroller)
45
[![npm](https://img.shields.io/npm/dt/react-infinite-scroller.svg?style=flat-square)](https://www.npmjs.com/package/react-infinite-scroller)
5-
[![React Version](https://img.shields.io/badge/React-%5E0.14.0%20%7C%7C%20%5E15.0.1-blue.svg?style=flat-square)](https://www.npmjs.com/package/react)
6+
[![React Version](https://img.shields.io/badge/React-%5E0.14.9%20%7C%7C%20%5E15.3.0%20%7C%7C%20%5E16.0.0-blue.svg?style=flat-square)](https://www.npmjs.com/package/react)
67
[![npm](https://img.shields.io/npm/v/react-infinite-scroller.svg?style=flat-square)](https://www.npmjs.com/package/react-infinite-scroller)
78
[![npm](https://img.shields.io/npm/l/react-infinite-scroller.svg?style=flat-square)](https://github.com/CassetteRocks/react-infinite-scroller/blob/master/LICENSE)
89

@@ -16,6 +17,9 @@ Infinitely load content using a React Component. This fork maintains a simple, l
1617
```
1718
npm install react-infinite-scroller --save
1819
```
20+
```
21+
yarn add react-infinite-scroller
22+
```
1923

2024
## How to use
2125

@@ -30,7 +34,7 @@ import InfiniteScroll from 'react-infinite-scroller';
3034
pageStart={0}
3135
loadMore={loadFunc}
3236
hasMore={true || false}
33-
loader={<div className="loader">Loading ...</div>}
37+
loader={<div className="loader" key={0}>Loading ...</div>}
3438
>
3539
{items} // <-- This is the content you want to load
3640
</InfiniteScroll>
@@ -44,7 +48,7 @@ import InfiniteScroll from 'react-infinite-scroller';
4448
pageStart={0}
4549
loadMore={loadFunc}
4650
hasMore={true || false}
47-
loader={<div className="loader">Loading ...</div>}
51+
loader={<div className="loader" key={0}>Loading ...</div>}
4852
useWindow={false}
4953
>
5054
{items}
@@ -56,11 +60,12 @@ import InfiniteScroll from 'react-infinite-scroller';
5660

5761
| Name | Type | Default | Description|
5862
|:---- |:---- |:---- |:----|
59-
| `element` | `String` | `'div'` | Name of the element that the component should render as.|
63+
| `element` | `Component` | `'div'` | Name of the element that the component should render as.|
6064
| `hasMore` | `Boolean` | `false` | Whether there are more items to be loaded. Event listeners are removed if `false`.|
6165
| `initialLoad` | `Boolean` | `true` | Whether the component should load the first set of items.|
6266
| `isReverse` | `Boolean` | `false` | Whether new items should be loaded when user scrolls to the top of the scrollable area.|
63-
| `loadMore` | `Function` | | A callback when more items are requested by the user.|
67+
| `loadMore`       | `Function`   |           | A callback when more items are requested by the user. Receives a single parameter specifying the page to load e.g. `function handleLoadMore(page) { /* load more items here */ }` }|
68+
| `loader` | `Component` | | A React component to render while more items are loading. The parent component must have a unique key prop. |
6469
| `pageStart` | `Number` | `0` | The number of the first page to load, With the default of `0`, the first page is `1`.|
6570
| `threshold` | `Number` | `250` | The distance in pixels before the end of the items that will trigger a call to `loadMore`.|
6671
| `useCapture` | `Boolean` | `false` | Proxy to the `useCapture` option of the added event listeners.|

0 commit comments

Comments
 (0)