mirror of
https://github.com/zhigang1992/react-native-web.git
synced 2026-03-25 16:54:18 +08:00
[fix] ScrollView dependency on 'style' forwarding for sticky headers
Not every item that may be rendered by a ScrollView will forward 'style', so cloning the item element is not safe. Instead, we can wrap the item in a 'View' and apply the styles for the sticky header to this element. Close #1175
This commit is contained in:
committed by
Nicolas Gallagher
parent
6d92cc5ec3
commit
145f80409d
@@ -168,7 +168,7 @@ const ScrollView = createReactClass({
|
||||
!horizontal && Array.isArray(stickyHeaderIndices)
|
||||
? React.Children.map(this.props.children, (child, i) => {
|
||||
if (child && stickyHeaderIndices.indexOf(i) > -1) {
|
||||
return React.cloneElement(child, { style: [child.props.style, styles.stickyHeader] });
|
||||
return <View style={styles.stickyHeader}>{child}</View>;
|
||||
} else {
|
||||
return child;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user