mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
2b0189b964
Summary: Fixes https://github.com/facebook/react-native/issues/50817 Using a fragment is very common when rendering elements. We are cloning and adding `onLayout` always to the ListEmptyComponent element, but this would seem to work only when `View` is used for this as a wrapper in this prop. To prevent this unnecessary warning, I think we can easily check whether it is a fragment or not before cloning and adding the extra props – this adds backwards compatibility for those that don't need to use `onLayout`. ## Changelog: [GENERAL] [FIXED] - Skip cloning Fragments in ListEmptyComponent to avoid onLayout warning Pull Request resolved: https://github.com/facebook/react-native/pull/50833 Test Plan: Use the code snippet from the linked issue to verify that the warning is not thrown anymore when using a Fragment. Reviewed By: javache Differential Revision: D73421503 Pulled By: rshest fbshipit-source-id: 0da4a38130601943e4704589ac275eba39767191
@react-native/virtualized-lists
Installation
yarn add @react-native/virtualized-lists
Note: We're using yarn to install deps. Feel free to change commands to use npm 3+ and npx if you like
Testing
To run the tests in this package, run the following commands from the React Native root folder:
yarnto install the dependencies. You just need to run this onceyarn jest packages/virtualized-lists.