Remove wrapper around ListEmptyComponent (#24339)

Summary:
This pull request fixes #24257.

The wrapper around ListEmptyComponent doesn't allow to use flex on the ListEmptyComponent.
The wrapper was removed in this [commit](db061ea8c7), and then put back in this [commit](e94d3444dc) 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: https://github.com/facebook/react-native/pull/24339

Differential Revision: D14822221

Pulled By: cpojer

fbshipit-source-id: 623e1ab3f228e9b75b92cdcd568683232a403c1a
This commit is contained in:
AntoineDoubovetzky 2019-04-08 12:41:57 -07:00 committed by Mike Grabowski
parent d7bd6cce38
commit 54af5b151e
2 changed files with 14 additions and 16 deletions

View File

@ -885,17 +885,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) {

View File

@ -668,11 +668,7 @@ exports[`VirtualizedList renders empty list with empty component 1`] = `
>
<header />
</View>
<View
style={null}
>
<empty />
</View>
<empty />
<View
onLayout={[Function]}
>