Skip to content

Commit

Permalink
Extend FlatList, close #54
Browse files Browse the repository at this point in the history
  • Loading branch information
Jacse committed Jul 26, 2018
1 parent 05ec6cc commit 4aeca4a
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
22 changes: 19 additions & 3 deletions AppIntroSlider.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ export default class AppIntroSlider extends React.Component {
doneLabel: 'Done',
nextLabel: 'Next',
prevLabel: 'Back',
buttonStyle: {},
buttonTextStyle: {},
buttonStyle: null,
buttonTextStyle: null,
}
state = {
width,
Expand Down Expand Up @@ -157,7 +157,22 @@ export default class AppIntroSlider extends React.Component {
}

render() {
const {hidePagination} = this.props
// Separate props used by the component to props passed to FlatList
const {
hidePagination,
activeDotStyle,
dotStyle,
skipLabel,
doneLabel,
nextLabel,
prevLabel,
buttonStyle,
buttonTextStyle,
renderItem,
data,
...otherProps,
} = this.props;

return (
<View style={styles.flexOne}>
<FlatList
Expand All @@ -172,6 +187,7 @@ export default class AppIntroSlider extends React.Component {
onMomentumScrollEnd={this._onMomentumScrollEnd}
extraData={this.state.width}
onLayout={this._onLayout}
{...otherProps}
/>
{!hidePagination && this._renderPagination()}
</View>
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,8 @@ Here a custom `renderItem` is supplied and the `bottomButton`-props has been set

<h2 align="center">Props and options</h2>

The component extends `FlatList` so all FlatList-props are valid.

### Configure looks

Name | Type | Default | Description
Expand Down

0 comments on commit 4aeca4a

Please sign in to comment.