Repository navigation
fix: fix JSX and useScrollToTop types for React 19 compatibility - #12501
Merged
satya164 merged 2 commits intoMar 22, 2025
Merged
Conversation
|
Hey @teaualune! Thanks for opening your first pull request in this repo. If you haven't already, make sure to read our contribution guidelines. |
✅ Deploy Preview for react-navigation-example ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
|
you lose your time |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
JSXintoReact.JSX: since React 19JSXglobal namespace is removed (ref). We need to useReact.JSXinstead.nulltype intoScrollableWrappertype definition: React 19 removesMutableRefObjectand makes all refs mutable (ref). That makes therefargument ofuseScrollToTopbecomeRefObject<ScrollView | null>(usingScrollViewas an example here) under React 19. In order to take this change into account, we can addnulltype intoScrollableWrapperdef directly to solve this issue.Test plan
Run
yarn typecheckand ensure modified codes pass the test. Since those modifications are compatible with older React versions as well, we don't need to updatereactdependencies to 19.