Skip to content

Commit e7e4cdd

Browse files
SamChou19815facebook-github-bot
authored andcommitted
Make use of ref-as-prop support in SectionListModern (#51360)
Summary: Pull Request resolved: #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
1 parent 6e9a816 commit e7e4cdd

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

packages/react-native/Libraries/Lists/SectionListModern.js

+8-2
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,13 @@ export type Props<ItemT, SectionT = DefaultSectionT> = $ReadOnly<{
168168
const SectionList: component(
169169
ref?: React.RefSetter<any>,
170170
...Props<any, DefaultSectionT>
171-
) = forwardRef<Props<any, DefaultSectionT>, any>((props, ref) => {
171+
) = ({
172+
ref,
173+
...props
174+
}: {
175+
ref?: React.RefSetter<any>,
176+
...Props<any, DefaultSectionT>,
177+
}) => {
172178
const propsWithDefaults = {
173179
stickySectionHeadersEnabled: Platform.OS === 'ios',
174180
...props,
@@ -237,6 +243,6 @@ const SectionList: component(
237243
getItem={(items, index) => items[index]}
238244
/>
239245
);
240-
});
246+
};
241247

242248
export default SectionList;

0 commit comments

Comments
 (0)