mirror of
https://github.com/status-im/react-native.git
synced 2025-02-24 23:28:12 +00:00
[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:
parent
c66b1c64b5
commit
bfbc280fb4
@ -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 =
|
||||
|
Loading…
x
Reference in New Issue
Block a user