react-native-infinite-scroll-view
Advanced tools
Comparing version 0.3.3 to 0.3.4
'use strict'; | ||
import React, { | ||
import React from 'react'; | ||
import { | ||
ActivityIndicatorIOS, | ||
@@ -11,3 +12,3 @@ Platform, | ||
class DefaultLoadingIndicator extends React.Component { | ||
export default class DefaultLoadingIndicator extends React.Component { | ||
render() { | ||
@@ -35,3 +36,1 @@ return ( | ||
}); | ||
module.exports = DefaultLoadingIndicator; |
@@ -5,2 +5,4 @@ 'use strict'; | ||
PropTypes, | ||
} from 'react'; | ||
import { | ||
ScrollView, | ||
@@ -15,3 +17,3 @@ View, | ||
class InfiniteScrollView extends React.Component { | ||
export default class InfiniteScrollView extends React.Component { | ||
static propTypes = { | ||
@@ -21,4 +23,4 @@ ...ScrollView.propTypes, | ||
canLoadMore: PropTypes.bool.isRequired, | ||
onLoadMoreAsync: PropTypes.func.isRequired, | ||
onLoadError: PropTypes.func, | ||
onLoadMoreAsync: PropTypes.func.isRequired, | ||
renderLoadingIndicator: PropTypes.func.isRequired, | ||
@@ -44,6 +46,7 @@ renderLoadingErrorIndicator: PropTypes.func.isRequired, | ||
this._handleScroll = this._handleScroll.bind(this); | ||
this._loadMoreAsync = this._loadMoreAsync.bind(this); | ||
} | ||
getScrollResponder(): ReactComponent { | ||
getScrollResponder() { | ||
return this._scrollComponent.getScrollResponder(); | ||
@@ -63,3 +66,3 @@ } | ||
{ onRetryLoadMore: this._loadMoreAsync } | ||
), | ||
), | ||
{ key: 'loading-error-indicator' }, | ||
@@ -79,3 +82,3 @@ ); | ||
Object.assign(props, { | ||
onScroll: this._handleScroll.bind(this), | ||
onScroll: this._handleScroll, | ||
children: [this.props.children, statusIndicator], | ||
@@ -117,3 +120,5 @@ }); | ||
} catch (e) { | ||
this.props.onLoadError && this.props.onLoadError(e); | ||
if (this.props.onLoadError) { | ||
this.props.onLoadError(e); | ||
} | ||
this.setState({isDisplayingError: true}); | ||
@@ -133,7 +138,11 @@ } finally { | ||
let contentLength; | ||
let trailingInset; | ||
let scrollOffset; | ||
let viewportLength; | ||
if (this.props.horizontal) { | ||
var contentLength = contentSize.width; | ||
var trailingInset = contentInset.right; | ||
var scrollOffset = contentOffset.x; | ||
var viewportLength = layoutMeasurement.width; | ||
contentLength = contentSize.width; | ||
trailingInset = contentInset.right; | ||
scrollOffset = contentOffset.x; | ||
viewportLength = layoutMeasurement.width; | ||
} else { | ||
@@ -151,3 +160,1 @@ contentLength = contentSize.height; | ||
Object.assign(InfiniteScrollView.prototype, ScrollableMixin); | ||
module.exports = InfiniteScrollView; |
{ | ||
"name": "react-native-infinite-scroll-view", | ||
"version": "0.3.3", | ||
"version": "0.3.4", | ||
"description": "An infinitely scrolling view that notifies you as the scroll offset approaches the bottom", | ||
"main": "InfiniteScrollView.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
"lint": "eslint .", | ||
"test": "eslint ." | ||
}, | ||
@@ -28,3 +29,9 @@ "repository": { | ||
"react-native-scrollable-mixin": "^1.0.0" | ||
}, | ||
"devDependencies": { | ||
"babel-eslint": "^6.0.4", | ||
"eslint": "^2.9.0", | ||
"eslint-config-exponent": "^1.0.8", | ||
"eslint-plugin-react": "^5.0.1" | ||
} | ||
} |
@@ -15,4 +15,2 @@ # InfiniteScrollView [![Slack](http://slack.exponentjs.com/badge.svg)](http://slack.exponentjs.com) | ||
Configure your .babelrc file to enable class properties. This is enabled by default in React Native 0.16+. | ||
## Usage | ||
@@ -23,8 +21,9 @@ | ||
```js | ||
var React = require('react-native'); | ||
var InfiniteScrollView = require('react-native-infinite-scroll-view'); | ||
var { | ||
import React from 'react'; | ||
import { | ||
ListView, | ||
} = React; | ||
} from 'react-native'; | ||
import InfiniteScrollView from 'react-native-infinite-scroll-view'; | ||
// Inside of a component's render() method: | ||
@@ -38,3 +37,3 @@ render() { | ||
canLoadMore={this.state.canLoadMoreContent} | ||
isLoadingMore={this.state.isLoadingContent} | ||
onLoadMoreAsync={this._loadMoreContentAsync()} | ||
/> | ||
@@ -41,0 +40,0 @@ ); |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No tests
QualityPackage does not have any tests. This is a strong signal of a poorly maintained or low quality package.
Found 1 instance in 1 package
9259
8
162
1
4
49