diff --git a/Libraries/Lists/VirtualizedList.js b/Libraries/Lists/VirtualizedList.js
index 75ad8f0ca46b19..9d1d336eccc762 100644
--- a/Libraries/Lists/VirtualizedList.js
+++ b/Libraries/Lists/VirtualizedList.js
@@ -871,16 +871,19 @@ export default class VirtualizedList extends StateSafePureComponent<
)): any);
cells.push(
- React.cloneElement(element, {
- key: '$empty',
- onLayout: (event: LayoutEvent) => {
- this._onLayoutEmpty(event);
- if (element.props.onLayout) {
- element.props.onLayout(event);
- }
- },
- style: StyleSheet.compose(inversionStyle, element.props.style),
- }),
+
+ {React.cloneElement(element, {
+ onLayout: (event: LayoutEvent) => {
+ this._onLayoutEmpty(event);
+ if (element.props.onLayout) {
+ element.props.onLayout(event);
+ }
+ },
+ style: StyleSheet.compose(inversionStyle, element.props.style),
+ })}
+ ,
);
}
diff --git a/Libraries/Lists/__tests__/VirtualizedList-test.js b/Libraries/Lists/__tests__/VirtualizedList-test.js
index fa0c40b3b5d636..e05f68ee8708aa 100644
--- a/Libraries/Lists/__tests__/VirtualizedList-test.js
+++ b/Libraries/Lists/__tests__/VirtualizedList-test.js
@@ -245,6 +245,32 @@ describe('VirtualizedList', () => {
expect(component).toMatchSnapshot();
});
+ it('handles nested list in ListEmptyComponent', () => {
+ const ListEmptyComponent = (
+
+ );
+
+ let component;
+
+ ReactTestRenderer.act(() => {
+ component = ReactTestRenderer.create(
+ ,
+ );
+ });
+
+ ReactTestRenderer.act(() => {
+ component.update(
+ ,
+ );
+ });
+ });
+
it('returns the viewableItems correctly in the onViewableItemsChanged callback after changing the data', () => {
const ITEM_HEIGHT = 800;
let data = [{key: 'i1'}, {key: 'i2'}, {key: 'i3'}];