Skip to content

Commit

Permalink
Remove wrapper around ListEmptyComponent (facebook#24339)
Browse files Browse the repository at this point in the history
Summary:
This pull request fixes facebook#24257.

The wrapper around ListEmptyComponent doesn't allow to use flex on the ListEmptyComponent.
The wrapper was removed in this [commit](facebook@db061ea), and then put back in this [commit](facebook@e94d344) but I think the relevant part was removing the condition on `itemCount !== 0` to apply the inversionStyle on the ScrollView and everything is still working without the wrapper.

[GENERAL] [FIXED] - Remove wrapper around ListEmptyComponent
Pull Request resolved: facebook#24339

Differential Revision: D14822221

Pulled By: cpojer

fbshipit-source-id: 623e1ab3f228e9b75b92cdcd568683232a403c1a
  • Loading branch information
AntoineDoubovetzky authored and zhongwuzw committed Apr 9, 2019
1 parent dea5eae commit 3c8def4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 16 deletions.
24 changes: 13 additions & 11 deletions Libraries/Lists/VirtualizedList.js
Expand Up @@ -873,17 +873,19 @@ class VirtualizedList extends React.PureComponent<Props, State> {
<ListEmptyComponent />
)): any);
cells.push(
<View key="$empty" style={inversionStyle}>
{React.cloneElement(element, {
onLayout: event => {
this._onLayoutEmpty(event);
if (element.props.onLayout) {
element.props.onLayout(event);
}
},
style: element.props.style,
})}
</View>,
React.cloneElement(element, {
key: '$empty',
onLayout: event => {
this._onLayoutEmpty(event);
if (element.props.onLayout) {
element.props.onLayout(event);
}
},
style: StyleSheet.compose(
inversionStyle,
element.props.style,
),
}),
);
}
if (ListFooterComponent) {
Expand Down
Expand Up @@ -668,11 +668,7 @@ exports[`VirtualizedList renders empty list with empty component 1`] = `
>
<header />
</View>
<View
style={null}
>
<empty />
</View>
<empty />
<View
onLayout={[Function]}
>
Expand Down

0 comments on commit 3c8def4

Please sign in to comment.