Skip to content

Update return type for getNativeScrollRef methods (#56718)#56718

Open
huntie wants to merge 1 commit intofacebook:mainfrom
huntie:export-D104223704
Open

Update return type for getNativeScrollRef methods (#56718)#56718
huntie wants to merge 1 commit intofacebook:mainfrom
huntie:export-D104223704

Conversation

@huntie
Copy link
Copy Markdown
Member

@huntie huntie commented May 7, 2026

Summary:

Update the return type of getNativeScrollRef on ScrollView, FlatList, SectionList to be PublicScrollViewInstance (previously, a mix of HostInstance and React.ElementRef<> types which did not include the imperative methods of ScrollView).

  • This type extends HostInstance & ScrollViewImperativeMethods, and is what the ScrollView ref chain already returns at runtime.
  • The previous types were either too broad (HostInstance), wrong (union with View), or required $FlowFixMe suppressions.

Also removes ScrollViewNativeComponent from the public API surface, since it is an internal implementation detail not intended for external use (equivalent props are on the pre-existing ScrollViewBaseProps type).

Related to:

Changelog:
[General][Fixed] - Strict TypeScript API: Update getNativeScrollRef return type across ScrollView, FlatList, and SectionList

Differential Revision: D104223704

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label May 7, 2026
@facebook-github-tools facebook-github-tools Bot added p: Facebook Partner: Facebook Partner labels May 7, 2026
@meta-codesync
Copy link
Copy Markdown

meta-codesync Bot commented May 7, 2026

@huntie has exported this pull request. If you are a Meta employee, you can view the originating Diff in D104223704.

huntie added a commit to huntie/react-native that referenced this pull request May 7, 2026
Summary:
Pull Request resolved: facebook#56718

Update the return type of `getNativeScrollRef` on `ScrollView`, `FlatList`, `SectionList` to be `PublicScrollViewInstance` (previously, a mix of `HostInstance` and `React.ElementRef<>` types which did not include the imperative methods of `ScrollView`).

- This type extends `HostInstance & ScrollViewImperativeMethods`, and is what the `ScrollView` ref chain already returns at runtime.
- The previous types were either too broad (`HostInstance`), wrong (union with `View`), or required `$FlowFixMe` suppressions.

Also removes `ScrollViewNativeComponent` from the public API surface, since it is an internal implementation detail not intended for external use (equivalent props are on the pre-existing `ScrollViewBaseProps` type).

Related to:

- facebook#52203
- facebook#54735

Changelog:
[General][Fixed] - **Strict TypeScript API**: Update `getNativeScrollRef` return type across ScrollView, FlatList, and SectionList

Differential Revision: D104223704
@meta-codesync meta-codesync Bot changed the title Update return type for getNativeScrollRef methods Update return type for getNativeScrollRef methods (#56718) May 7, 2026
@huntie huntie force-pushed the export-D104223704 branch 2 times, most recently from 69e0b12 to 9c11da1 Compare May 8, 2026 11:55
huntie added a commit to huntie/react-native that referenced this pull request May 8, 2026
Summary:

Update the return type of `getNativeScrollRef` on `ScrollView`, `FlatList`, `SectionList` to be `PublicScrollViewInstance` (previously, a mix of `HostInstance` and `React.ElementRef<>` types which did not include the imperative methods of `ScrollView`).

- This type extends `HostInstance & ScrollViewImperativeMethods`, and is what the `ScrollView` ref chain already returns at runtime.
- The previous types were either too broad (`HostInstance`), wrong (union with `View`), or required `$FlowFixMe` suppressions.

Also removes `ScrollViewNativeComponent` from the public API surface, since it is an internal implementation detail not intended for external use (equivalent props are on the pre-existing `ScrollViewBaseProps` type).

Related to:

- facebook#52203
- facebook#54735

Changelog:
[General][Fixed] - **Strict TypeScript API**: Update `getNativeScrollRef` return type across ScrollView, FlatList, and SectionList

Differential Revision: D104223704
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 8, 2026

Warning

JavaScript API change detected

This PR commits an update to ReactNativeApi.d.ts, indicating a change to React Native's public JavaScript API.

  • Please include a clear changelog message.
  • This change will be subject to additional review.

This change was flagged as: POTENTIALLY_BREAKING

Summary:
Pull Request resolved: facebook#56718

Update the return type of `getNativeScrollRef` on `ScrollView`, `FlatList`, `SectionList` to be `PublicScrollViewInstance` (previously, a mix of `HostInstance` and `React.ElementRef<>` types which did not include the imperative methods of `ScrollView`).

- This type extends `HostInstance & ScrollViewImperativeMethods`, and is what the `ScrollView` ref chain already returns at runtime.
- The previous types were either too broad (`HostInstance`), wrong (union with `View`), or required `$FlowFixMe` suppressions.

Also removes `ScrollViewNativeComponent` from the public API surface, since it is an internal implementation detail not intended for external use (equivalent props are on the pre-existing `ScrollViewBaseProps` type).

Related to:

- facebook#52203
- facebook#54735

Changelog:
[General][Fixed] - **Strict TypeScript API**: Update `getNativeScrollRef` return type across ScrollView, FlatList, and SectionList

Differential Revision: D104223704
@huntie huntie force-pushed the export-D104223704 branch from 9c11da1 to 46ff74f Compare May 8, 2026 13:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported meta-exported p: Facebook Partner: Facebook Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant