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
This commit is contained in:
Sam Zhou authored and Facebook GitHub Bot committed 2025-05-15 09:17:45 -07:00
1 parent 6e9a816940
commit e7e4cdd12e
1 file changed
+8 -2
+8 -2
View File
@@ -168,7 +168,13 @@ export type Props<ItemT, SectionT = DefaultSectionT> = $ReadOnly<{
const SectionList: component(
ref?: React.RefSetter<any>,
...Props<any, DefaultSectionT>
) = forwardRef<Props<any, DefaultSectionT>, any>((props, ref) => {
) = ({
ref,
...props
}: {
ref?: React.RefSetter<any>,
...Props<any, DefaultSectionT>,
}) => {
const propsWithDefaults = {
stickySectionHeadersEnabled: Platform.OS === 'ios',
...props,
@@ -237,6 +243,6 @@ const SectionList: component(
getItem={(items, index) => items[index]}
/>
);
});
};
export default SectionList;