Skip to content

Commit

Permalink
v1.0.8
Browse files Browse the repository at this point in the history
  • Loading branch information
Davide Curletti committed Apr 27, 2016
1 parent ac086c8 commit 63ee3eb
Show file tree
Hide file tree
Showing 9 changed files with 376 additions and 67 deletions.
25 changes: 25 additions & 0 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,31 @@ http://realscout.github.io/redux-infinite-scroll/
npm install redux-infinite-scroll --save
```

## Importing Via AMD/CommonJS

##### ES6 format
```javascript
import ReduxInfiniteScroll from 'redux-infinite-scroll';
```
##### ES5 format
```javascript
var ReduxInfiniteScroll = require('redux-infinite-scroll');
```

## Importing Via Script Tag
If you decide to use either one of the distribution files found in `/dist`, then you can access the `ReduxInfiniteScroll` via a global variable.

##### ES6 format
```javascript
ReduxInfiniteScroll
```
##### ES5 format
```javascript
ReduxInfiniteScroll.default;
```
The difference is due to the `ReduxInfiniteScroll` being an ES6 module and therefore having a different export syntax than ES5.


## Usage

In order to use it in your React app, simply import it and follow the example below. The component expects to receive
Expand Down
14 changes: 14 additions & 0 deletions dev/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<head>

</head>
<body>
<script src="https://fb.me/react-15.0.1.min.js"></script>
<script src="https://fb.me/react-dom-15.0.1.min.js"></script>

<script src="../dist/redux-infinite-scroll.js"></script>


<script>
debugger
</script>
</body>
314 changes: 292 additions & 22 deletions dist/redux-infinite-scroll.js

Large diffs are not rendered by default.

23 changes: 1 addition & 22 deletions dist/redux-infinite-scroll.min.js

Large diffs are not rendered by default.

20 changes: 11 additions & 9 deletions lib/ReduxInfiniteScroll.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@ var _reactDom = require('react-dom');

var _reactDom2 = _interopRequireDefault(_reactDom);

var _reactImmutableProptypes = require('react-immutable-proptypes');

var _reactImmutableProptypes2 = _interopRequireDefault(_reactImmutableProptypes);

var _DOMPositionUtils = require('./Utilities/DOMPositionUtils');

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
Expand All @@ -28,8 +24,10 @@ function _possibleConstructorReturn(self, call) { if (!self) { throw new Referen

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }

var ReduxInfiniteScroll = function (_Component) {
_inherits(ReduxInfiniteScroll, _Component);
//import ImmutablePropTypes from 'react-immutable-proptypes';

var ReduxInfiniteScroll = function (_React$Component) {
_inherits(ReduxInfiniteScroll, _React$Component);

function ReduxInfiniteScroll(props) {
_classCallCheck(this, ReduxInfiniteScroll);
Expand Down Expand Up @@ -154,7 +152,7 @@ var ReduxInfiniteScroll = function (_Component) {
}]);

return ReduxInfiniteScroll;
}(_react.Component);
}(_react2.default.Component);

exports.default = ReduxInfiniteScroll;

Expand All @@ -168,8 +166,12 @@ ReduxInfiniteScroll.propTypes = {
loader: _react2.default.PropTypes.any,
showLoader: _react2.default.PropTypes.bool,
loadMore: _react2.default.PropTypes.func.isRequired,
items: _react2.default.PropTypes.oneOfType([_reactImmutableProptypes2.default.list, _react2.default.PropTypes.array]),
children: _react2.default.PropTypes.oneOfType([_reactImmutableProptypes2.default.list, _react2.default.PropTypes.array]),
items: _react2.default.PropTypes.oneOfType([
//ImmutablePropTypes.list,
_react2.default.PropTypes.array]),
children: _react2.default.PropTypes.oneOfType([
//ImmutablePropTypes.list,
_react2.default.PropTypes.array]),
holderType: _react2.default.PropTypes.string,
className: _react2.default.PropTypes.oneOfType([_react2.default.PropTypes.string, _react2.default.PropTypes.func])
};
Expand Down
11 changes: 11 additions & 0 deletions min.webpack.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
var webpack = require('webpack');
var _ = require('lodash');
var config = module.exports = require('./production.webpack.js');

config.output = _.merge(config.output, {
filename: 'redux-infinite-scroll.min.js'
});

config.plugins.push(
new webpack.optimize.UglifyJsPlugin({minimize: true})
);
16 changes: 9 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
{
"name": "redux-infinite-scroll",
"version": "1.0.7",
"version": "1.0.8",
"description": "React infinite scroll component designed for a Redux data-flow.",
"main": "lib/ReduxInfiniteScroll.js",
"scripts": {
"test": "npm run transpile && karma start karma.conf.js",
"test-watch": "karma start karma.conf.js --single-run=false",
"transpile": "babel src --out-dir lib",
"build": "webpack --config production.webpack.js"
"build": "webpack --config production.webpack.js",
"build:min": "webpack --config min.webpack.js",
"build:release": "npm run transpile && npm run build && npm run build:min"
},
"repository": {
"type": "git",
Expand Down Expand Up @@ -47,13 +49,13 @@
"webpack": "^1.12.9",
"webpack-dev-middleware": "^1.4.0",
"webpack-dev-server": "^1.10.1",
"webpack-hot-middleware": "^2.6.0"
},
"dependencies": {
"immutable": "^3.7.6",
"lodash": "~3.1.0",
"webpack-hot-middleware": "^2.6.0",
"react": "^0.14.6",
"react-dom": "^0.14.6",
"react-immutable-proptypes": "^1.7.0"
},
"dependencies": {
"immutable": "^3.7.6",
"lodash": "~3.1.0"
}
}
10 changes: 8 additions & 2 deletions production.webpack.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,16 @@ var path = require('path');
var config = module.exports = require('./main.webpack.js');

config.output = _.merge(config.output, {
filename: 'redux-infinite-scroll.min.js'
filename: 'redux-infinite-scroll.js',
libraryTarget: 'umd',
library: 'ReduxInfiniteScroll'
});

config.externals = {
'react': 'React',
'react-dom': 'ReactDOM'
};

config.module.loaders.push(
{
test: /\.jsx?$/,
Expand All @@ -16,6 +23,5 @@ config.module.loaders.push(
);

config.plugins.push(
new webpack.optimize.UglifyJsPlugin({minimize: true}),
new webpack.optimize.OccurenceOrderPlugin()
);
10 changes: 5 additions & 5 deletions src/ReduxInfiniteScroll.jsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import React, { Component } from 'react';
import React from 'react';
import ReactDOM from 'react-dom';

import ImmutablePropTypes from 'react-immutable-proptypes';
//import ImmutablePropTypes from 'react-immutable-proptypes';

import {topPosition} from './Utilities/DOMPositionUtils';

export default class ReduxInfiniteScroll extends Component {
export default class ReduxInfiniteScroll extends React.Component {

constructor(props) {
super(props);
Expand Down Expand Up @@ -123,11 +123,11 @@ ReduxInfiniteScroll.propTypes = {
showLoader: React.PropTypes.bool,
loadMore: React.PropTypes.func.isRequired,
items: React.PropTypes.oneOfType([
ImmutablePropTypes.list,
//ImmutablePropTypes.list,
React.PropTypes.array
]),
children: React.PropTypes.oneOfType([
ImmutablePropTypes.list,
//ImmutablePropTypes.list,
React.PropTypes.array
]),
holderType: React.PropTypes.string,
Expand Down

0 comments on commit 63ee3eb

Please sign in to comment.