Skip to content

[docs] Update Strict TypeScript API guide#5111

Open
huntie wants to merge 1 commit into
react:mainfrom
huntie:strict-api-087-updates
Open

[docs] Update Strict TypeScript API guide#5111
huntie wants to merge 1 commit into
react:mainfrom
huntie:strict-api-087-updates

Conversation

@huntie

@huntie huntie commented Jun 3, 2026

Copy link
Copy Markdown
Member
  • Simplification pass.
  • Add/consolidate ref type guidance.

See react-native-community/discussions-and-proposals#1003. Replaces #5067.

- Simplification pass.
- Add/consolidate ref type guidance.
@huntie huntie requested review from Simek, cipolleschi and cortinico June 3, 2026 15:53
@vercel

vercel Bot commented Jun 3, 2026

Copy link
Copy Markdown

@huntie is attempting to deploy a commit to the React Foundation Team on Vercel.

A member of the Team first needs to authorize it.

@netlify

netlify Bot commented Jun 3, 2026

Copy link
Copy Markdown

Deploy Preview for react-native ready!

Name Link
🔨 Latest commit 9bb4c34
🔍 Latest deploy log https://app.netlify.com/projects/react-native/deploys/6a204dfa633cfa0009147624
😎 Deploy Preview https://deploy-preview-5111--react-native.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@cipolleschi cipolleschi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks good. Left a couple of comments and one code example needs to be fixed.

When the community is ready, the Strict TypeScript API will become our default API in future — synchronized with deep imports removal.
The Strict API is currently in preview as we iterate towards a stable JavaScript API for React Native.

## Opting in

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if opt-in is automatic, shouldn't we explain how to opt-out instead, and remove this section?

@huntie huntie Jul 13, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yeah — wanted to land this first (base docs update with the definitely-landing changes in 0.87) and then update the opt-out → opt-in change (and blog post) given the rollout looks good across our RC releases.

## Migration guide

### Codegen types should now be imported from the `react-native` package
### Codegen types → `CodegenTypes` namespace

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
### Codegen types → `CodegenTypes` namespace
### `CodegenTypes` namespace


**After**
</TabItem>
<TabItem value="after" label="After">

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: my personal preference is to see both before and after at the same time. Switching between the two might make easier to miss some details.

</TabItem>
</Tabs>

### Refs now use `*Instance` types

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this will need to be explained also in the Blogpost.


```tsx title=""
import {useRef} from 'react';
import type {ViewInstance, TextInputInstance} from 'react-native';

@cipolleschi cipolleschi Jul 13, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
import type {ViewInstance, TextInputInstance} from 'react-native';
import type {View, TextInput, ViewInstance, TextInputInstance} from 'react-native';

You are still using View and TextInput in the JSX.

This also replaces the removed `Animated.LegacyRef` type. Code using `ref={ref as React.Ref<Animated.LegacyRef<View>>}` can be simplified to `ref={ref}` with a `ViewInstance`-typed ref.

<details>
<summary>**🗒️ Available instance types**</summary>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<summary>**🗒️ Available instance types**</summary>
<summary>**Available instance types**</summary>

| `VirtualizedList` | `VirtualizedListInstance` |
| `VirtualizedSectionList` | `VirtualizedSectionListInstance` |

Components without ref support (`InputAccessoryView`, `TouchableWithoutFeedback`, `experimental_LayoutConformance`) do not have instance types.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will they throw an error?


**Affected APIs**
<details>
<summary>**🗒️ Affected APIs**</summary>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<summary>**🗒️ Affected APIs**</summary>
<summary>**Affected APIs**</summary>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants