RN/Metro: Configure Transformer for React 19 (#50809)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50809

Configures `react-native/metro-babel-transformer` (used by `react-native/babel-preset`) to parse source using `hermes-parser` to target React 19. This changes components written with Component Syntax to stop generating `forwardRef` calls (because `ref` is now a prop).

Most of this was already accomplished in https://github.com/facebook/react-native/pull/50377 ({D72070021}), but this call site was missed.

Changelog:
[General][Changed] - Configured Hermes Parser to target React 19, resulting in Component Syntax no longer producing `forwardRef` calls.

Reviewed By: elicwhite

Differential Revision: D73279825

fbshipit-source-id: c0d64cb8c0adb22b78c5fbed1b2c386c8b3f3ede
This commit is contained in:
Tim Yung
2025-04-18 17:14:47 -07:00
committed by Facebook GitHub Bot
parent db6e000023
commit f2518d4374
+1
View File
@@ -210,6 +210,7 @@ const transform /*: BabelTransformer['transform'] */ = ({
: // $FlowFixMe[incompatible-exact]
require('hermes-parser').parse(src, {
babel: true,
reactRuntimeTarget: '19',
sourceType: babelConfig.sourceType,
});