Added stickyHeaderIndices to ListView

Summary:
Closes #3870

Alternatively I could make this a bool `stickyheader` that just adds `0` to  the `stickyHeaderIndices` passed down to the ScrollView.
Closes https://github.com/facebook/react-native/pull/4213

Reviewed By: svcscm

Differential Revision: D2807414

Pulled By: androidtrunkagent

fb-gh-sync-id: 091b6c6c91cebe175181f57b5c2785395b5db19b
This commit is contained in:
Alex Rothberg 2016-01-06 09:16:40 -08:00 коммит произвёл facebook-github-bot-0
Родитель 435efadbba
Коммит 4bc425c521
1 изменённых файлов: 11 добавлений и 1 удалений

Просмотреть файл

@ -203,6 +203,15 @@ var ListView = React.createClass({
* containers. This is enabled by default.
*/
removeClippedSubviews: React.PropTypes.bool,
/**
* An array of child indices determining which children get docked to the
* top of the screen when scrolling. For example, passing
* `stickyHeaderIndices={[0]}` will cause the first child to be fixed to the
* top of the scroll view. This property is not supported in conjunction
* with `horizontal={true}`.
* @platform ios
*/
stickyHeaderIndices: PropTypes.arrayOf(PropTypes.number),
},
/**
@ -242,6 +251,7 @@ var ListView = React.createClass({
renderScrollComponent: props => <ScrollView {...props} />,
scrollRenderAheadDistance: DEFAULT_SCROLL_RENDER_AHEAD,
onEndReachedThreshold: DEFAULT_END_REACHED_THRESHOLD,
stickyHeaderIndices: [],
};
},
@ -394,7 +404,7 @@ var ListView = React.createClass({
}
Object.assign(props, {
onScroll: this._onScroll,
stickyHeaderIndices: sectionHeaderIndices,
stickyHeaderIndices: this.props.stickyHeaderIndices.concat(sectionHeaderIndices),
// Do not pass these events downstream to ScrollView since they will be
// registered in ListView's own ScrollResponder.Mixin