[React Native] Fix scroll view sticky headers

Summary:
The `ScrollView` component tells the native side the subview indices of the views to make sticky. The problem is that, once layout-only views are collapsed, the indices are no longer reflective of the original views to make stick to the top.
This commit is contained in:
Alex Akers 2015-07-08 09:28:28 -07:00
parent c66b1c64b5
commit bfbc280fb4
1 changed files with 13 additions and 1 deletions

View File

@ -17,6 +17,7 @@ var PointPropType = require('PointPropType');
var RCTScrollView = require('NativeModules').UIManager.RCTScrollView;
var RCTScrollViewConsts = RCTScrollView.Constants;
var React = require('React');
var ReactChildren = require('ReactChildren');
var ReactNativeViewAttributes = require('ReactNativeViewAttributes');
var RCTUIManager = require('NativeModules').UIManager;
var ScrollResponder = require('ScrollResponder');
@ -277,13 +278,24 @@ var ScrollView = React.createClass({
}
}
var children = this.props.children;
if (this.props.stickyHeaderIndices) {
children = ReactChildren.map(children, (child) => {
if (child) {
return <View collapsible={false}>{child}</View>;
} else {
return child;
}
});
}
var contentContainer =
<View
collapsible={false}
ref={INNERVIEW}
style={contentContainerStyle}
removeClippedSubviews={this.props.removeClippedSubviews}>
{this.props.children}
{children}
</View>;
var alwaysBounceHorizontal =