From 11d9b9cef0bb9c78d57bab48411160a22a7bc9db Mon Sep 17 00:00:00 2001 From: Sam Zhou Date: Thu, 12 Oct 2023 08:43:32 -0700 Subject: [PATCH] Prepare to make `React.Element` fully opaque (#40798) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/40798 Changelog: [Internal] Reviewed By: sullenor Differential Revision: D50194982 fbshipit-source-id: 21d2f86dd787952ceed9a4f862a3fcaa2b063349 --- packages/rn-tester/js/examples/ScrollView/ScrollViewExample.js | 2 ++ packages/virtualized-lists/Lists/VirtualizedList.js | 2 ++ 2 files changed, 4 insertions(+) diff --git a/packages/rn-tester/js/examples/ScrollView/ScrollViewExample.js b/packages/rn-tester/js/examples/ScrollView/ScrollViewExample.js index 8ee9c4cc4956de..402bd784a15a30 100644 --- a/packages/rn-tester/js/examples/ScrollView/ScrollViewExample.js +++ b/packages/rn-tester/js/examples/ScrollView/ScrollViewExample.js @@ -82,6 +82,7 @@ class AppendingList extends React.Component< nestedScrollEnabled style={styles.scrollView}> {this.state.items.map(item => + // $FlowFixMe[prop-missing] React.Element internal inspection React.cloneElement(item, {key: item.props.msg}), )} @@ -94,6 +95,7 @@ class AppendingList extends React.Component< }} style={[styles.scrollView, styles.horizontalScrollView]}> {this.state.items.map(item => + // $FlowFixMe[prop-missing] React.Element internal inspection React.cloneElement(item, {key: item.props.msg, style: null}), )} diff --git a/packages/virtualized-lists/Lists/VirtualizedList.js b/packages/virtualized-lists/Lists/VirtualizedList.js index dcd9cbaaeb103d..ce66e743465f1b 100644 --- a/packages/virtualized-lists/Lists/VirtualizedList.js +++ b/packages/virtualized-lists/Lists/VirtualizedList.js @@ -969,10 +969,12 @@ class VirtualizedList extends StateSafePureComponent { {React.cloneElement(element, { onLayout: (event: LayoutEvent) => { this._onLayoutEmpty(event); + // $FlowFixMe[prop-missing] React.Element internal inspection if (element.props.onLayout) { element.props.onLayout(event); } }, + // $FlowFixMe[prop-missing] React.Element internal inspection style: StyleSheet.compose(inversionStyle, element.props.style), })} ,