Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ Component wraps ScrollView so all ScrollView properties are available.
- **toIndex** - Optional - (Integer) - Don't allow scrolling below this page index.
- **fromIndex** - Optional - (Integer) - Don't allow scrolling above this page index.
- **onPageIndexChange** - Optional - (Function) - Called when page index is changed (user scrolled).
- **forceUpdate** - Optional - (Number) - Forces render be called if it changes.

### Known issues
Currently only iOS is supported. Android support is coming.
Expand Down
11 changes: 9 additions & 2 deletions src/index.ios.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,23 @@ export default class InfiniteScrollView extends Component {
size: {
width: 0,
height: 0,
}
},
forceUpdate: this.props.forceUpdate || 0,
}
}
componentWillReceiveProps(nextProps) {
if (nextProps.forceUpdate != undefined) {
this.setState({forceUpdate: nextProps.forceUpdate});
}
}
shouldComponentUpdate(nextProps, nextState) {
var index = this._index(nextProps);
var range = this._pagesRange(nextState);
var forceUpdate = this.state.forceUpdate;
return (
nextState.size !== this.state.size ||
range.to !== this._renderedRange.to || range.from !== this._renderedRange.from ||
this.state.index !== index
this.state.index !== index || (nextProps.forceUpdate != undefined && forceUpdate != nextProps.forceUpdate)
);
}
componentDidUpdate() {
Expand Down