From e7e4cdd12e0e39ea5e038bc22442b9f675481978 Mon Sep 17 00:00:00 2001 From: Sam Zhou Date: Thu, 15 May 2025 09:17:45 -0700 Subject: [PATCH] Make use of ref-as-prop support in SectionListModern (#51360) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/51360 Make use of the React 19 feature so that we can remove the remaining `forwardRef` in react native. Changelog: [Internal] Reviewed By: yungsters Differential Revision: D74812991 fbshipit-source-id: 9df7247bcdaed7a880ed0a75a5dcc33fce6f1d86 --- .../react-native/Libraries/Lists/SectionListModern.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/react-native/Libraries/Lists/SectionListModern.js b/packages/react-native/Libraries/Lists/SectionListModern.js index b34f78b0a90..a86d8b8a511 100644 --- a/packages/react-native/Libraries/Lists/SectionListModern.js +++ b/packages/react-native/Libraries/Lists/SectionListModern.js @@ -168,7 +168,13 @@ export type Props = $ReadOnly<{ const SectionList: component( ref?: React.RefSetter, ...Props -) = forwardRef, any>((props, ref) => { +) = ({ + ref, + ...props +}: { + ref?: React.RefSetter, + ...Props, +}) => { const propsWithDefaults = { stickySectionHeadersEnabled: Platform.OS === 'ios', ...props, @@ -237,6 +243,6 @@ const SectionList: component( getItem={(items, index) => items[index]} /> ); -}); +}; export default SectionList;