Skip to content

fix: fix JSX and useScrollToTop types for React 19 compatibility - #12501

Merged
satya164 merged 2 commits into
react-navigation:mainfrom
teaualune:fix/react-19-ts-errors
Mar 22, 2025
Merged

satya164 merged 2 commits into
react-navigation:mainfrom
teaualune:fix/react-19-ts-errors

Conversation

@teaualune

Copy link
Copy Markdown
Contributor

Motivation

This PR addresses some TypeScript errors under React Native 0.78.x, namely React 19. They are also discussed in #12468 .

Specifically, 2 parts are modified in this PR:

  1. Rewrite JSX into React.JSX: since React 19 JSX global namespace is removed (ref). We need to use React.JSX instead.
  2. Add null type into ScrollableWrapper type definition: React 19 removes MutableRefObject and makes all refs mutable (ref). That makes the ref argument of useScrollToTop become RefObject<ScrollView | null> (using ScrollView as an example here) under React 19. In order to take this change into account, we can add null type into ScrollableWrapper def directly to solve this issue.

Test plan

Run yarn typecheck and ensure modified codes pass the test. Since those modifications are compatible with older React versions as well, we don't need to update react dependencies to 19.

@github-actions

Copy link
Copy Markdown

Hey @teaualune! Thanks for opening your first pull request in this repo. If you haven't already, make sure to read our contribution guidelines.

@netlify

netlify Bot commented Mar 20, 2025

Copy link
Copy Markdown

✅ Deploy Preview for react-navigation-example ready!

Name Link
🔨 Latest commit 77f92d0
🔍 Latest deploy log https://app.netlify.com/sites/react-navigation-example/deploys/67dc19938a669a000869a3c3
😎 Deploy Preview https://deploy-preview-12501--react-navigation-example.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 site configuration.

@Pnlvfx

Pnlvfx commented Mar 20, 2025

Copy link
Copy Markdown

you lose your time

@satya164 satya164 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for the PR

@satya164
satya164 merged commit 4a7dfe1 into react-navigation:main Mar 22, 2025
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.

3 participants