Commit Graph

1111 Commits

Author SHA1 Message Date
Alex Hunt df39eadc03 Bump minimum Node.js version to 22.14.0 (#51840)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51840

Bumps the minimum version of Node.js in React Native to the current active LTS release (22.x, upgraded from 18.x which is now out of support).

- CI configurations are reduced from `[22, 20, 18]` to `[24, 22]`.

{F1978909878}

See https://nodejs.org/en/about/previous-releases.

Changelog:
[General][Breaking] - Our new minimum Node version is Node.js 22

Reviewed By: yungsters, cortinico

Differential Revision: D76037015

fbshipit-source-id: b6e4b3ee279a9a93d716a13297420bba73f45250
2025-06-06 05:21:39 -07:00
David Vacca 7f8cf06bf9 Update codegen to use StateData (#51823)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51823

Refactor C++ codegen to use StateData for simple codegenerated components

changelog: [internal] internal

Reviewed By: javache

Differential Revision: D75889787

fbshipit-source-id: 47edf5a2a7b7d0efa1f98d392b8c7457af5747c9
2025-06-05 11:04:13 -07:00
Tim Yung 404f3ebde2 RN: Flowify packages/react-native-codegen (#51781)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51781

Adds `flow` to the remaining files that are lacking it in the `packages/react-native-codegen` directory.

This also adds any necessary type annotations (using comment syntax).

Changelog:
[Internal]

Reviewed By: huntie

Differential Revision: D75884727

fbshipit-source-id: 69e880b2dc63c3d6430f841652506e57436544a8
2025-06-04 12:03:52 -07:00
Tim Yung cc9074884a RN: Add @noflow to Node.js Scripts (#51779)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51779

Adds `noflow` to a bunch of Node.js script files.

In the future, these files could be migrated to use `flow strict-local` or `flow strict` using comment syntax for type annotations. But for now, adding `noflow` makes it explicit that these are known to not be typechecked.

Changelog:
[Internal]

Reviewed By: SamChou19815

Differential Revision: D75883703

fbshipit-source-id: a8fed3aaa9c55ecda919a705940f8b34504cb07c
2025-06-04 12:03:52 -07:00
Pieter De Baets 95ed8a6123 Merge all core codegen into FBReactNativeSpec (#50317)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50317

`rncore`, `FBReactNativeSpec` and `FBReactNativeComponentSpec` contain the same symbols, which leads to conflicts when we try to merge them into a single shared library. Cleanup the duplication and standardize on `FBReactNativeSpec` everywhere. I've left the Android OSS targets names as is, to avoid breaking deps.

This aligns react-native's package.json with the codegen tooling supported across iOS and Android, which is a single target for all all type-derived codegen.

Changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D55037569

fbshipit-source-id: dbf3c0a427c9d0df96e439b04e5b123cd1069c51
2025-06-02 08:47:05 -07:00
David Vacca 3903ce0a48 Update format for codegen prop diffing (#51644)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51644

This diff updates the format for codegen prop diffing in Android

changelog: [internal] internal

Reviewed By: shwanton

Differential Revision: D75476172

fbshipit-source-id: ec1c68ae1eb652fe9986386302969f9258983d39
2025-05-27 17:55:11 -07:00
David Vacca da5d15ba0e Add support to diff ImageSource props (#51643)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51643

Add support to diff ImageSource props

/react-native/ReactCommon/react/renderer/imagemanager/primitives.h

changelog: [internal] internal

Reviewed By: javache

Differential Revision: D69497848

fbshipit-source-id: 56afe1d8601f7f4dc5dab815b6e534d7c63f651b
2025-05-27 17:55:11 -07:00
David Vacca ad0ea17ae9 Add support to diff Point props (#51650)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51650

This diff adds support to diff props with Point type

changelog: [internal] internal

Reviewed By: mlord93

Differential Revision: D75469451

fbshipit-source-id: a6844b691d8e32326d04c2bd51e6509980feb611
2025-05-27 17:55:11 -07:00
David Vacca 508610865b Assert ImageRequest is not used as a prop in codegen (#51642)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51642

This diff asserts that ImageRequest won't be used as prop type

changelog: [internal] internal

Reviewed By: mlord93

Differential Revision: D75469453

fbshipit-source-id: e9e46bc8806e00c104b76825445fe72779106220
2025-05-27 17:55:11 -07:00
David Vacca 20da141f5f Add support for diffing ColorPrimitive props (#51641)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51641

Add support for diffing ColorPrimitive props

changelog: [internal] internal

Reviewed By: rshest

Differential Revision: D69493546

fbshipit-source-id: 7ad6a28bd42014a771c168d8d6a6d2349629f670
2025-05-27 17:55:11 -07:00
David Vacca 26d40e40e1 Add support for diffing primitve type props (#51649)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51649

 Add support for diffing primitve type props

changelog: [internal] internal

Reviewed By: NickGerleman

Differential Revision: D69491368

fbshipit-source-id: 2b882b349e9d1bd3a9012bae3c3e0a06be2fa0e3
2025-05-27 17:55:11 -07:00
David Vacca 2df200db3f Extend getDiffProps method to support no changes of props (#51646)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51646

Extend getDiffProps method to support no changes of props

changelog: [internal] internal

Reviewed By: lenaic

Differential Revision: D69487497

fbshipit-source-id: 2cb91f1cc6cba84100750ce5dda5824824c923fe
2025-05-27 17:55:11 -07:00
David Vacca 3609d070eb Extend getDiffProps method to call HostPlatformViewProps (#51638)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51638

Extend getDiffProps method to call HostPlatformViewProps

changelog: [internal] internal

Reviewed By: lenaic

Differential Revision: D69487495

fbshipit-source-id: 4d2b508f116ec0618b42981c0880361c3d8a871a
2025-05-27 17:55:11 -07:00
David Vacca 1a43fd7927 Prototype to create getDiff method using codegen (#51637)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51637

Start prototype to create getDiff method using js codegen

changelog: [internal] internal

Reviewed By: rshest

Differential Revision: D69487496

fbshipit-source-id: 1547a7302381333bf9b005153b44de5621bc56c4
2025-05-27 17:55:11 -07:00
Nicola Corti c059ae1b77 Correctly propagate RN_SERIALIZABLE_STATE to 3rd party CMake targets (#51619)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51619

RNTester Android is currently instacrashing in OSS due to 3rd-party packages not having the `RN_SERIALIZABLE_STATE` definition.
That's because the `INTERFACE` definition is not properly propagated on the prefab boundaries.

This was happening for `react-native-popup-menu-android` and `react-native-test-library` and will also happen for Codegen libraries.

This fixes it. 3p developers with custom CMake files will also have to use the `target_compile_reactnative_options` functions to make sure the compilation flag are properly populated.

Changelog:
[Android] [Breaking] - Correctly propagate RN_SERIALIZABLE_STATE to 3rd party CMake targets. Users with custom CMake and C++ code should update to use `target_compile_reactnative_options` inside their CMakeLists.txt files. See the 0.81 release notes for more information.

Reviewed By: cipolleschi

Differential Revision: D75441245

fbshipit-source-id: 3855fdf11cbe7f4b01f68e0dde68b63b3240ad35
2025-05-27 05:33:16 -07:00
Tim Yung 1977dd6596 RN: Sort Pragmas in Headers (#51554)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51554

Sorts pragma directives file headers in React Native.

Changelog:
[Internal]

Reviewed By: SamChou19815

Differential Revision: D75264593

fbshipit-source-id: 9e4b253dd0fc94dc2fc469d7114b93a8aae305f4
2025-05-22 21:18:53 -07:00
Panos Vekris 0c70c0166e pre-suppress errors for natural inference rollout in xplat/js (#51524)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51524

Links in error suppressions will point to the announcement post in Flow FYI.

Changelog: [Internal]

drop-conflicts

Reviewed By: marcoww6

Differential Revision: D75188177

fbshipit-source-id: 27ea1fbee848e9371e679cf423e30bc9608edea0
2025-05-22 02:50:47 -07:00
Yannick Loriot 12ced22f70 Improve error messages when enum members are missing (#51502)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51502

While working on a case for Editor on mac, it took me a while to figure out what enum was the root cause:

 {F1978470518}

Adding the blaming enum name in the error message would have made my life much easier.

## Changelog:

[GENERAL][Added] - Improve error messages when enum members are missing

Reviewed By: rshest

Differential Revision: D75141414

fbshipit-source-id: 3625d817b218788891252add225f8fffb99e3145
2025-05-21 14:31:25 -07:00
Tim Yung 84de8a075e RN: Delete @oncall Annotations (#51416)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51416

Deletes `oncall` annotations from the `facebook/react-native` repository.

Changelog:
[Internal]

Reviewed By: javache

Differential Revision: D74902524

fbshipit-source-id: 32a6a5b2ff27281792d572f151e2b094d9a79029
2025-05-17 16:18:05 -07:00
Nick Gerleman 88de631d05 RN_SERIALIZABLE_STATE (#51185)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51185

Was running into issues with split Android ParagraphState, because a lot of code is tied to `#ifdef ANDROID`, which also builds for react-native-cxx.

This does that spliitting, and also introduces `RN_SERIALIZABLE_STATE` to replace previous ANDROID checks related to state serialization, so we can cofine that to just the Android platform. These changes are dependent on each other.

Changelog: [Internal]

Reviewed By: joevilches

Differential Revision: D74374376

fbshipit-source-id: ffb246ea2e16773f85de12209f2d88a95f8bb792
2025-05-14 16:10:08 -07:00
Sam Zhou 88a04c530e Pre-suppress errors related to Object.assign
Summary:
The `Object.assign` support is [inherently unsound](https://github.com/facebook/flow/issues/3392), carries a lot of tech debt, and we want to error on them.

This diff pre-suppresses errors that will be added in the next version of Flow, to make the next release easier.

Changelog: [Internal]

Reviewed By: panagosg7

Differential Revision: D73963639

fbshipit-source-id: ebefc82c123588eb0b72ab48a24e45c42be33267
2025-04-30 19:44:58 -07:00
Jakub Grzywacz 4d7c4bd6e8 Fix ImageSource require (#50963)
Summary:
In react-native-svg, I found that the `Image` component stopped working starting with `react-native@0.79`. After some debugging, I traced the issue to the migration of `Libraries/Image` to the new export syntax (see https://github.com/facebook/react-native/commit/8783196ee540f8f78ce60ad20800338cc7645194). To fix this, I updated the import to match other requires, similar to https://github.com/facebook/react-native/blob/main/packages/react-native-codegen/src/generators/components/GenerateViewConfigJs.js#L84.

## Changelog:

[GENERAL] [FIXED] - Fix codegen ImageSource require

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

Test Plan:
`validAttributes` process should be a function instead of object with a default property.

Before:
<img width="1041" alt="image" src="https://github.com/user-attachments/assets/9fbc9e9f-6c45-4b0b-adb8-2eb911676fe1" />

After:
<img width="1005" alt="image" src="https://github.com/user-attachments/assets/ee594103-90da-4917-8252-72f4ecfc28e1" />

Reviewed By: Abbondanzo

Differential Revision: D73778127

Pulled By: huntie

fbshipit-source-id: ae80c770e8e578794ae1356751f170ff955e1f5a
2025-04-28 10:30:21 -07:00
George Zahariev 6ad41f9a3f Update hermes-parser and related packages in xplat to 0.28.1 (#50803)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50803

Bump hermes-parser and related packages to [0.28.1](https://github.com/facebook/hermes/blob/main/tools/hermes-parser/js/CHANGELOG.md).

Changelog: [internal]

Reviewed By: panagosg7

Differential Revision: D73242526

fbshipit-source-id: fbe0a233b4ae1315eb0e060c6338eb7156a5c6ea
2025-04-21 07:50:22 -07:00
Jakub Piasecki 86bede9c60 Update hermes-parser and related packages in fbsource to 0.28.0 (#50695)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50695

Bump hermes-parser and related packages to 0.28.0.

Changelog: [Internal]

Reviewed By: robhogan

Differential Revision: D72693713

fbshipit-source-id: f529b78a933ae7a6497f67f1f616c1acb95995c3
2025-04-15 03:56:39 -07:00
Tim Yung 68cad5d2d3 RN: Configure Hermes Parser for React 19 (#50377)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50377

Configures the Hermes Parser to target React 19, which changes components written with Component Syntax to stop generating `forwardRef` calls (because `ref` is now a prop).

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

Reviewed By: javache, SamChou19815

Differential Revision: D72070021

fbshipit-source-id: b891789d4ff1cbcb8eebea3525361ab14e628b51
2025-04-14 08:36:24 -07:00
Pieter De Baets 6e701ce080 Fix crash on arm32 when configuring eventEmitterCallback (#50592)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50592

For unclear reasons this is crashing on some devices when dereferencing the module ref. Instead we can just access the existing global_ref to the module instance and avoid any deallocation timing issues.

Also added some additional safeguards and validation against incorrect JNI invocations.

Changelog: [Android][Fixed] Fix crash when TurboModule event emitters are used on arm32

Reviewed By: cortinico

Differential Revision: D72716972

fbshipit-source-id: 3803329048d8388b3d30c9cb55a857e399569eea
2025-04-09 11:10:31 -07:00
Evghenii Nicolaev d3daabfe2b Revert D71805075: Update hermes-parser and related packages in fbsource to 0.27.0
Differential Revision:
D71805075

Original commit changeset: 685194c12ac0

Original Phabricator Diff: D71805075

fbshipit-source-id: b28f0f83ad8b4f4f6b5e62fdc9ff323af79c1d43
2025-04-01 03:45:23 -07:00
Alex Hunt f13c8a7417 Update hermes-parser and related packages in fbsource to 0.27.0 (#50241)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50241

Bump hermes-parser and related packages to [0.27.0](https://github.com/facebook/hermes/blob/main/tools/hermes-parser/js/CHANGELOG.md).

Changelog: [Internal]

Reviewed By: robhogan

Differential Revision: D71805075

fbshipit-source-id: 685194c12ac037f74cc4fd54eb0d777a74507727
2025-04-01 01:01:05 -07:00
Tim Yung e704f8ac2f RN/Metro: Set reactRuntimeTarget on Hermes Parser (#50339)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50339

Explicitly sets the default `reactRuntimeTarget` when invoking `require('hermes-parser').parse` so that it'll be easier to find these configurations when upgrading to `'19'`.

Changelog:
[Internal]

Reviewed By: javache

Differential Revision: D72006705

fbshipit-source-id: 4994917152a2a4a767b871d4a36092c0c5391324
2025-03-28 08:02:09 -07:00
Sam Zhou cbd2ee55ef Eliminate $PropertyType and $ElementType in react-native (#50262)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50262

Prepare for their removal in Flow

Changelog: [Internal]

Reviewed By: gkz

Differential Revision: D71823860

fbshipit-source-id: e1e18424ae731cd323999316a7f3a5d42f4b5b91
2025-03-25 14:00:17 -07:00
Tim Yung 0448cf2567 RN: Support .fb Suffix in Native Codegen (#50140)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50140

Extends `react-native-codegen` to support the `.fb` filename suffix used to gate source code that is only relevant for Meta internal use cases.

Changelog:
[Internal]

Reviewed By: cipolleschi

Differential Revision: D70808462

fbshipit-source-id: a6772d6504f76724b8474df6799bc69a76a2f81b
2025-03-19 20:21:02 -07:00
Jakub Piasecki 5349b7c7b5 Update codegen to support namespaced types (#49950)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49950

Changelog: [GENERAL][CHANGED] - Changed `react-native-codegen` to support types under `CodegenTypes` namespace

## Summary

Currently, codegen relies on deep importing types under `react-native/Libraries/Types/CodegenTypes` to be properly type-checked. Updating codegen to support types under a single namespace will enable us to provide a single import from the package with access to all relevant types.

Reviewed By: huntie

Differential Revision: D70967809

fbshipit-source-id: 41241dcc51965f4243acd34e8b63475cb56ca67a
2025-03-17 07:26:17 -07:00
Arushi Kesarwani d8b0e050c4 Making RN Codegen generate ComponentDescriptors.cpp (#49939)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49939

Making RNCodegen.js generate the ComponentDesciptors.cpp and https://github.com/facebook/react-native/pull/42962 adds all entries, just missed this one.

Changelog:
[Android] [Fixed] - Fix RNCodegen.js for generating ComponentDescriptors.cpp

Reviewed By: shwanton

Differential Revision: D70925850

fbshipit-source-id: 2e2eae64f5371b0bc5a452d4bd0c9269e9253bb1
2025-03-12 15:44:46 -07:00
Alex Hunt e70961e05c Bump packages for next release (#49972)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49972

Follows the recent `0.79-stable` branch cut.

Changelog: [Internal] - Bump all packages to `0.80.0-main`

Reviewed By: cortinico

Differential Revision: D70976555

fbshipit-source-id: e81e4c45c6a510e114d02853c5bb90a715b7df8b
2025-03-12 05:11:16 -07:00
Phil Pluckthun b52f0d8391 chore(react-native-codegen): Remove fixtures and outdated transforms from build output (#49916)
Summary:
- Update ignore micromatch pattern to filter out `__test_fixtures__` from build output
- Remove `babel/plugin-transform-object-rest-spread`
- Remove `babel/plugin-transform-async-to-generator`
- Remove `babel/plugin-transform-destructuring`

The `package.json:engines:node` field is already set to `>=18` which makes the three Babel transforms that were removed redundant.

## Changelog:

[INTERNAL] [CHANGED] - Remove fixtures files and outdated Babel transforms from `react-native/codegen` build output

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

Test Plan: - Ran against Node 18

Reviewed By: robhogan

Differential Revision: D70885090

Pulled By: cortinico

fbshipit-source-id: 328b75a6031a7ca6a9b3ed170061ffb0a47d6d93
2025-03-10 05:44:32 -07:00
Phil Pluckthun 8f19201c5e refactor(react-native-codegen): Replace jscodeshift with @babel/core (#49641)
Summary:
`jscodeshift` is only used in one module (`src/generators/components/GenerateViewConfigJs.js`, but depends on a rather complex dependency chain and has a rather large maintenance burden relative to what it's used for and the value it adds in the codebase.

Since the `GenerateViewConfigJs` module creates simple templates, using `babel/core` (and implicitly `babel/template` and `babel/types`) is a lot simpler and changes little code. The only change this introduces to the output are formatting changes (`singleQuote` and `trailingCommas` options are discarded). The code is otherwise functionally identical.

## Changelog:

[INTERNAL] [CHANGED] - Drop jscodeshift dependency from react-native/codegen

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

Test Plan:
This was tested against a React Native build with the `react-native/babel-plugin-codegen` plugina active and using the snapshots in the repo itself. While the snapshots have changed in formatting, none of the outputs change the code's AST.

<details>
<summary>
Example output from <code>react-native/babel-plugin-codegen</code> to supplement the snapshot tests
</summary>

This is the example bundling output of `AndroidSwipeRefreshLayout`. This demonstrates that both the view config output and the `Commands` export continue to be generated correctly.

```js
var _interopRequireDefault = require(_dependencyMap[0]);
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = exports.__INTERNAL_VIEW_CONFIG = exports.Commands = undefined;
var _codegenNativeCommands = _interopRequireDefault(require(_dependencyMap[1]));
var _codegenNativeComponent = _interopRequireDefault(require(_dependencyMap[2]));
var React = _interopRequireWildcard(require(_dependencyMap[3]));
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
var NativeComponentRegistry = require(_dependencyMap[4]);
var _require = require(_dependencyMap[5]),
  ConditionallyIgnoredEventHandlers = _require.ConditionallyIgnoredEventHandlers;
var _require2 = require(_dependencyMap[6]),
  dispatchCommand = _require2.dispatchCommand;
var nativeComponentName = 'AndroidSwipeRefreshLayout';
var __INTERNAL_VIEW_CONFIG = exports.__INTERNAL_VIEW_CONFIG = {
  uiViewClassName: "AndroidSwipeRefreshLayout",
  directEventTypes: {
    topRefresh: {
      registrationName: "onRefresh"
    }
  },
  validAttributes: {
    enabled: true,
    colors: {
      process: (req => 'default' in req ? req.default : req)(require(_dependencyMap[7]))
    },
    progressBackgroundColor: {
      process: require(_dependencyMap[8]).default
    },
    size: true,
    progressViewOffset: true,
    refreshing: true,
    ...ConditionallyIgnoredEventHandlers({
      onRefresh: true
    })
  }
};
var _default = exports.default = NativeComponentRegistry.get(nativeComponentName, () => __INTERNAL_VIEW_CONFIG);
var Commands = exports.Commands = {
  setNativeRefreshing(ref, value) {
    dispatchCommand(ref, "setNativeRefreshing", [value]);
  }
};
```

</details>

Reviewed By: yungsters

Differential Revision: D70580474

Pulled By: elicwhite

fbshipit-source-id: 85bc6578b685f19a1565ded8d7e56dc2a1ff1999
2025-03-05 14:06:46 -08:00
Nicola Corti c4c3d3bfbe Do not use $ in identifiers for event emitters. (#49792)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49792

This removes the `$` from the `event` and `payload` identifier inside codegen.
This is causing the `-Wdollar-in-identifier-extension` warning to fire.

As I'm looking into enabling `-Wall -Werror` for React Common, this should be addressed as well.

Changelog:
[Internal] [Changed] -

Reviewed By: cipolleschi

Differential Revision: D70500543

fbshipit-source-id: c593680961b1b98561c3985f92ade5d6ba448ac9
2025-03-03 16:47:46 -08:00
Rubén Norte e630b2ca18 Create specific module in RN to define the types for host instances and host components that ReactNativeTypes defines (#49601)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49601

Changelog: [internal]

This creates a new module in React Native to define some of the types related to `HostInstance` that are currently defined in `ReactNativeTypes` (synced from the React repo).

We want to remove the types from `ReactNativeTypes` so this is a necessary initial step.

Reviewed By: huntie

Differential Revision: D69996010

fbshipit-source-id: 21cfed4c222e22332936e56aca895fe578809792
2025-02-24 05:32:43 -08:00
Iwo Plaza 2b30aa5cc8 Migrate Libraries/Utilities/differ/*.js to export syntax (#49332)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49332

## Motivation
Modernising the RN codebase to allow for modern Flow tooling to process it.

## This diff
- Migrates `Libraries/Utilities/differ/*.js` to use the export syntax.
- Updates deep-imports of these files to use `.default`
- Updates codegen with a compat layer
- Updates the current iteration of API snapshots (intended).

Changelog:
[General][Breaking] - Deep imports to `Libraries/Utilities/differ/...` with `require` syntax need to be appended with '.default'.

Reviewed By: yungsters

Differential Revision: D69467423

fbshipit-source-id: 2e58a0b9711e9bdf5ca907a5b2252584f6fec9bc
2025-02-12 05:30:20 -08:00
Pieter De Baets 9073817925 Add more test coverage for $ReadOnlyArray<UnsafeMixed> in component codegen (#49349)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49349

Follow-up on D69454101 to add more test coverage for `$ReadOnlyArray<UnsafeMixed>` as a component prop. The new type was missing from the CodegenSchema, which revealed some gaps in tests.

Changelog: [Internal]

Reviewed By: fabriziocucci

Differential Revision: D69488035

fbshipit-source-id: 19895e55e5ec4d89a790f1c388de9eea025a316c
2025-02-12 04:20:08 -08:00
Pieter De Baets abd7259de4 Allow UnsafeMixed as Array value in codegen (#49324)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49324

Provide Android component codegen a bit more flexibility by allowing `$ReadOnlyArray<UnsafeMixed>` and avoid casting in the view manager.

Changelog: [General][Added]

Reviewed By: fabriziocucci

Differential Revision: D69454101

fbshipit-source-id: c210647deffeb01b7db8aa07266e58c42acf14ba
2025-02-11 07:11:18 -08:00
Nick Gerleman 75edf3af50 CMake "react_render_" to "react_renderer_" (#49284)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49284

All of the CMake library names in the "renderer" directory use "render" for the name, missing the last two letters of the directory name.

eye_twitch

I don't think fixing that should be breaking, since 3p libraries need to rely on the merged library anyway, so let's fix that and find/replace all these.

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D69338892

fbshipit-source-id: d3b306ad0ea191728dfbacf9e2aaa12b00caa619
2025-02-10 14:32:26 -08:00
Iwo Plaza 4101a2f0b6 Add compat layer for react-native-codegen and processColorArray (#49063)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49063

## Motivation
Modernising the RN codebase to allow for modern Flow tooling to process it.

## This diff
- Updates react-native-codegen to generate ViewConfigs that are compatible with react-native both before and after the export syntax migration.

Changelog: [Internal]

Reviewed By: huntie

Differential Revision: D68894819

fbshipit-source-id: fca46c1b91c15e22f1e1128ce8621c05341e2fe6
2025-01-30 07:16:54 -08:00
Iwo Plaza 156ee5bee7 Migrate StyleSheet/processColorArray.js to use export syntax (#48905)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48905

## Motivation
Modernising the react-native codebase to allow for ingestion by modern Flow tooling.

## This diff
- Updates `Libraries/StyleSheet/processColorArray.js` to use `export` syntax.
- Appends `.default` to requires of the changed files.
- Updates test files.
- Updated View Config codegen (requires an MSDK bump).
- Updates the public API snapshot *(intented breaking change)*

Changelog:
[General][Breaking] - Files inside `Libraries/Text`, `Libraries/Share` and `Libraries/Settings` use `export` syntax, which requires the addition of `.default` when imported with the CJS `require` syntax.

Reviewed By: robhogan

Differential Revision: D68564304

fbshipit-source-id: 2fbd058be1a715cccfce4f2a68146118d8ac66ad
2025-01-28 09:46:50 -08:00
Riccardo Cipolleschi e77fe5c471 Bump React Native monorepo packages (#48975)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48975

After cutting 0.78-stable, we need to bump the monorepo packages to `0.79.0-main`

## Changelog:
[Internal] - Bump monorepo packages to `0.79.0-main`

Reviewed By: cortinico, huntie

Differential Revision: D68715005

fbshipit-source-id: cb5abbf05e8638683687be8d61d66b3037111572
2025-01-27 11:01:34 -08:00
Dawid Małecki f36bfe5dfa Remove redundant {||} syntax (#48686)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48686

Changelog:
[Internal] - Removed redundant `{||}` syntax

Reviewed By: javache

Differential Revision: D68205038

fbshipit-source-id: f7d3271142b6443a5859c3b668b7aebd3ce3ef3f
2025-01-15 07:07:01 -08:00
Rayner Kristanto 0f1d4704df Revert D68017325: Migrate StyleSheet/*.js to use export statements
Differential Revision:
D68017325

Original commit changeset: 3c5b94742f10

Original Phabricator Diff: D68017325

fbshipit-source-id: d7ea1edfe9cca151560e9c0e5554a07153cdb8da
2025-01-14 15:22:26 -08:00
Iwo Plaza e4d969a4ab Migrate StyleSheet/*.js to use export statements (#48609)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48609

# Motivation
This is an attempt at modernizing the export syntax in some of the files in `Libraries/StyleSheet/`. It will allow these files to get properly ingested by modern Flow tooling.

# This diff
- Migrates the use of `module.exports` into `export default` for files located in `Libraries/StyleSheet/*.js`. Some files were omitted due to ballooning complexity, but will be addressed in other Diffs.
- Updating internal *require*s to use ".default", no product code seems to be affected.
- Migrating `require`s into `import`s where applicable, taking into account the performance implications (context: https://fb.workplace.com/groups/react.technologies.discussions/permalink/3638114866420225/)
- Updates the current iteration of API snapshots (intended).
- Updates `react-native-codegen`'s require of processColorArray, analogous to D42346452.

Changelog:
[General][Breaking] - Deep imports from some files in `StyleSheet/` can break when using the `require()` syntax, but can be easily fixed by appending `.default`

Reviewed By: javache

Differential Revision: D68017325

fbshipit-source-id: 3c5b94742f101db0b2914c91efab6003dba2b61a
2025-01-14 05:34:18 -08:00
Eli White cf5ab03d43 Include cxx modules in codegen schema (#48581)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48581

Previously the CXX only modules were not being inclued in the schema for these apps, and therefore weren't being caught by the compat check.

Reviewed By: cipolleschi

Differential Revision: D68000360

fbshipit-source-id: 5d56bc840bd220f3b8b814e5d90eb49d9a2beb0b
2025-01-10 14:38:57 -08:00
David Vacca db57080e08 Refactor ViewManager codegen to use new ViewManagerInterface (#48549)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48549

Refactor ViewManager codegen to use new ViewManagerInterface

changelog: [internal] internal

Reviewed By: javache

Differential Revision: D67957884

fbshipit-source-id: 7abcd453580ab2219770fd1aff780ba2977dfc8a
2025-01-10 13:58:28 -08:00