From eedd60b9e6b595801d05c2fa223124fb8a895c3c Mon Sep 17 00:00:00 2001 From: Evan Bacon Date: Mon, 12 May 2025 07:14:22 -0700 Subject: [PATCH] chore: convert View to React 19 (#51023) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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.