mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Summary: - Convert View implementation to React 19: - Remove legacy `forwardRef` in favor of built-in `ref` prop. - Use `use` API instead of `useContext`. - Drop the extraneous `.Provider` for `TextAncestor` context. - Remove `displayName` in favor of component name. I'm not 100% sure this is a full fallback but it is valid according to `react/display-name` eslint rule—https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/display-name.md - Based on discussion with Nicola Carti and Riccardo Cipolleschi. - I tried using flow `component` keyword but it's not enabled in this project. Given the `react-native` package is shipped untranspiled, it's probably safer to avoid newer flow types. - Overall matched the component style of LogBox. - It's unclear the exact right way to type a ref since it should be optional for external users of the component but required inside the component. Erring on the side of caution and using optional types so users don't get type errors when `ref` isn't defined. ## Changelog: [GENERAL] [BREAKING] Upgrade `View` component to React 19. <!-- Help reviewers and the release process by writing your own changelog entry. Pick one each for the category and type tags: [ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message For more details, see: https://reactnative.dev/contributing/changelogs-in-pull-requests Pull Request resolved: https://github.com/facebook/react-native/pull/51023 Test Plan: - Type checks should pass. Reviewed By: rshest Differential Revision: D74546184 Pulled By: yungsters fbshipit-source-id: b8257e3a75477c1117b19cd3f8e0843947b092ca