Commit Graph

148 Commits

Author SHA1 Message Date
Gabriel Donadel 3ae9328571 Bump @types/react to 19.1 (#52059)
Summary:
While testing I notice that `types/react` was not updated in some peer depencies

## Changelog:

[GENERAL] [CHANGED] - Bump types/react to 19.1

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

Test Plan: CI should be green

Reviewed By: christophpurrer

Differential Revision: D76763084

Pulled By: sbuggay

fbshipit-source-id: c078c03aa57ca04040c64986dd7957da8a6f2c2d
2025-06-16 17:45:11 -07:00
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
Tim Yung 71bf0712e3 RN: Flowify packages/virtualized-lists (#51785)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51785

Adds `flow` to the remaining files that are lacking it in the `packages/virtualized-lists` directory. In one of the Jest tests, there are so many failures that for now, I just added `noflow`.

Changelog:
[Internal]

Reviewed By: SamChou19815

Differential Revision: D75888514

fbshipit-source-id: 29d96292f3d59fd5cf2f5ba09b58fdfb9eabab2e
2025-06-04 12:03:52 -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
Dawid Małecki 44b0f5560b Fix VirtualizeSectionList generic arguments (#51496)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51496

Fixes problem with generics passed to `VirtualizedSectionList` in generated types. The `flow-api-translator` creates a re-declaration for `export default` variables which shadows generics.

Changelog:
[Internal]

Reviewed By: huntie

Differential Revision: D75141051

fbshipit-source-id: 260ef066038320eee3ffa93692f77f1eff5c9205
2025-05-22 03:41: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
Tim Yung ebe2a857f1 RN: Prefer Destructured Import for isValidElement (#51413)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51413

Prefers using this as a destructured import instead of as a member expression of `React`.

Changelog:
[Internal]

Reviewed By: SamChou19815

Differential Revision: D74895841

fbshipit-source-id: c1d3af40134a3721c9a7b676ee1f2c4a18612e4d
2025-05-16 16:33:18 -07:00
Tim Yung ab1ac938c9 RN: Prefer Destructured Import for createElement (#51409)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51409

Prefers using this as a destructured import instead of as a member expression of `React`.

Changelog:
[Internal]

Reviewed By: SamChou19815

Differential Revision: D74895837

fbshipit-source-id: b9d6082e4882d95f0d2aa1eed13b725edeb854cd
2025-05-16 16:33:18 -07:00
Tim Yung d78916d6ca RN: Prefer Destructured Import for cloneElement (#51410)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51410

Prefers using this as a destructured import instead of as a member expression of `React`.

Changelog:
[Internal]

Reviewed By: SamChou19815

Differential Revision: D74895844

fbshipit-source-id: 67f334981a1effce051c89e3d4643232aa22b4e9
2025-05-16 16:33:18 -07:00
Tim Yung 3e70714cff RN: Prefer Destructured Import for useEffect (#51405)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51405

Prefers using this as a destructured import instead of as a member expression of `React`.

Changelog:
[Internal]

Reviewed By: SamChou19815

Differential Revision: D74894042

fbshipit-source-id: 93fbadb32e4a1225836db9d729d7bf502ebddd84
2025-05-16 16:33:18 -07:00
Tim Yung 00108a1ac3 RN: Prefer Destructured Import for useState (#51403)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51403

Prefers using this as a destructured import instead of as a member expression of `React`.

Changelog:
[Internal]

Reviewed By: SamChou19815

Differential Revision: D74891875

fbshipit-source-id: 981e85b5da84950c9e66e8d6b6496019e536711d
2025-05-16 16:33:18 -07:00
Tim Yung d7d10a4f0d RN: Prefer Destructured Import for createContext (#51400)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51400

Prefers using this as a destructured import instead of as a member expression of `React`.

Changelog:
[Internal]

Reviewed By: javache

Differential Revision: D74888314

fbshipit-source-id: 9224c7c371471fe1fc42c8d42d4b37a4edadcacf
2025-05-16 16:33:18 -07:00
Tim Yung 255c197baf RN: Prefer Destructured Import for createRef (#51399)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51399

Prefers using this as a destructured import instead of as a member expression of `React`.

Changelog:
[Internal]

Reviewed By: rubennorte

Differential Revision: D74888097

fbshipit-source-id: a22ca4b791153ff0c2f4ab34ff8e3ce5e9280e0d
2025-05-16 16:33:18 -07:00
Dawid Małecki cfd4932bb0 Fix generated types base on __typetests__ (#51383)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51383

This diff is a set of alignments/improvements in generated TS types. It includes:
- extending `AppStateStatus` with `extension` and `unknown`,
- exporting `AnimatedProps` under `Animated` namespace,
- resolving issue with discriminated unions in `ProgressBarAndroidTypes`,
- fixing `StyleSheet.create` type to accept only specified style properties,
- extending `TextProps` with `AccessibilityProps`,
extending Fn Args generic with `$ReadOnlyArray` in `ErrorUtils`,
- small `__typetests__` adjustments,
- removing type test `styleDimensionValueValidAnimated` as `DimensionValue` no longer accepts `AnimatedNode`,
- removing `styleDimensionValueInvalid` as `DimensionValue` accepts any string now - template literal types in Flow are not supported,
- changing `overlayColor` type to `ColorValue` to align with manual types,
- fixing `AnimatedPropsAllowList` type which wasn't correct in TS because index signature type was different from style type,
- using `DeviceEventEmitter` instead of `DeviceEventEmitterStatic` in type tests which is equivalent in both new and old types - `DeviceEventEmitterStatic` was only a type of `DeviceEventEmitter`,
- removing type test for checking forwarded key type - doesn't work with new types and that shouldn't be supported,
- removing `Animated.legacyRef` type test - not included in new types,
- adding `DOMRect` from "dom" lib to `globals.d.ts` to not include "dom" lib in the tsconfig - tries to compare globals with `lib.dom.d.ts` and produces many errors,
- exporting `SectionListData`,

Changelog:
[Internal]

Reviewed By: huntie

Differential Revision: D74807552

fbshipit-source-id: c5254ea0f701f3602b9d716faeb50ca1ab21b013
2025-05-16 09:50:51 -07:00
Jakub Piasecki c9f2055097 Fix generated types in @react-native/virtualized-lists being used without opt-in (#51246)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51246

Changelog: [General][Fixed] Fix generated types in react-native/virtualized-lists being used without opt-in

D71969602 introduces `exports` field to `package.json` files in `react-native` and `virtualized-lists`. In that diff, the `types` in `virtualized-lists` by default pointed to the new generated types without requiring the opt-in.

This fixes that by requiring the opt-in before using the generated types.

Reviewed By: huntie

Differential Revision: D74573321

fbshipit-source-id: fe05b0204a7200c1c91aac2614aa786bbbced2a5
2025-05-12 04:53:20 -07:00
Alex Hunt 6ea24f7bb9 Define "react-native-strict-api" type exports (#50909)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50909

Enables and maps the `types_generated/` directory for `react-native` and `react-native/virtualized-lists` — exposing the new Strict TypeScript API entry points to React Native.

**New `"exports"` conditions**

- `"react-native-strict-api"` — The Strict TypeScript API opt in, exposing the `index.d.ts` entry point only.
- `"react-native-strict-api-UNSAFE-ALLOW-SUBPATHS"` — Opts into the new from-source generated types, but allows accessing subpaths (unsafe).
    - We intend for this unsafe condition to be an escape hatch for Frameworks only (i.e. Expo).

Note: In the case of `virtualized-lists`, we simply use the `"types"` condition — since this package did not expose any TypeScript API previously.

NOTE: Should we need to roll back JS Stable API phase 1, **this is the single diff to revert**.

Changelog:
[General][Added] - Configure the "react-native-strict-api" opt in for our next-gen TypeScript API

Reviewed By: cipolleschi

Differential Revision: D71969602

fbshipit-source-id: 291182cc826db8b33f21fc79698e6096876d17ef
2025-04-28 10:00:39 -07:00
Riccardo Cipolleschi 0e11e6a28b Sync React 19.1 into React Native OSS (#50865)
Summary:
X-link: https://github.com/facebook/metro/pull/1492

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

This change updates React in React Native OSS from 19 to 19.1
bypass-github-export-checks
## Changelog:
[General][Changed] - Bump React to 19.1

## Internal:
jest_e2e[run_all_tests]

Reviewed By: cortinico

Differential Revision: D73502629

fbshipit-source-id: 362897e8b491d1474f433ee7ad3306baf95d2e6c
2025-04-24 10:15:42 -07:00
Mateo Guzmán 12147e3bee TypeScript: Replace deprecated React.ElementRef usages to React.ComponentRef (#50883)
Summary:
While upgrading a project to React 19, I noticed React.ElementRef is deprecated (see [types/react/index.d.ts#L199](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/react/index.d.ts#L199)). I think we can replace it for the RN types as well.

Not sure if this is considered as a breaking change.

## Changelog:

[GENERAL] [CHANGED] - TypeScript: Replace deprecated React.ElementRef usages to React.ComponentRef

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

Test Plan:
Create a RNTesterPlayground.tsx next to the normal .js just to validate the type checking is not throwing an unexpected error.

<details>
<summary>Code snippet:</summary>

```tsx
import React, { useRef, useEffect } from 'react';
import { FlatList, Text, View } from 'react-native';

type Item = { id: string; title: string };

const data: Item[] = Array.from({ length: 10 }, (_, i) => ({
  id: i.toString(),
  title: `Item ${i + 1}`,
}));

const FlatListScrollRefExample: React.FC = () => {
  const flatListRef = useRef<FlatList<Item>>(null);

  useEffect(() => {
    if (flatListRef.current) {
      const nativeRef = flatListRef.current.getNativeScrollRef();

      console.log('nativeRef', nativeRef?.componentWillUnmount);
    }
  }, []);

  return (
    <FlatList
      ref={flatListRef}
      data={data}
      keyExtractor={(item) => item.id}
      renderItem={({ item }) => (
        <View style={{ padding: 16 }}>
          <Text>{item.title}</Text>
        </View>
      )}
    />
  );
};

export default FlatListScrollRefExample;

```

</details>

Reviewed By: cipolleschi

Differential Revision: D73569274

Pulled By: rshest

fbshipit-source-id: f72477b9b3c0eda1007187c7dac3da0433410e86
2025-04-24 03:02:27 -07:00
Iwo Plaza dc494bb341 Revert [RN][JS Stable API] Limit @react-native/virtualized-lists subpath imports (#50846)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50846

## Motivation
After a more rigorous search through GitHub uses of the restricted APIs, and consultation with framework authors, it became apparent that this restriction should be lifted.

Changelog: [Internal]

Reviewed By: zeyap

Differential Revision: D73267844

fbshipit-source-id: e6c0c146690c07debf74c51f82171a9239be5c15
2025-04-23 10:20:06 -07:00
Mateo Guzmán 2b0189b964 Skip cloning Fragments in ListEmptyComponent to avoid onLayout warning (#50833)
Summary:
Fixes https://github.com/facebook/react-native/issues/50817

Using a fragment is very common when rendering elements. We are cloning and adding `onLayout` always to the ListEmptyComponent element, but this would seem to work only when `View` is used for this as a wrapper in this prop. To prevent this unnecessary warning, I think we can easily check whether it is a fragment or not before cloning and adding the extra props – this adds backwards compatibility for those that don't need to use `onLayout`.

## Changelog:

[GENERAL] [FIXED] - Skip cloning Fragments in ListEmptyComponent to avoid onLayout warning

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

Test Plan: Use the code snippet from the linked issue to verify that the warning is not thrown anymore when using a Fragment.

Reviewed By: javache

Differential Revision: D73421503

Pulled By: rshest

fbshipit-source-id: 0da4a38130601943e4704589ac275eba39767191
2025-04-22 07:06:07 -07:00
Alex Hunt 16a61bf2ba Remove .npmignore files from other packages, add lint check (#50786)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50786

Follows https://github.com/facebook/react-native/pull/50784. Having any `.npmignore` files is a gotcha — remove and replace with `package.json#files`.

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D73193257

fbshipit-source-id: de715d74195e4f53c817c11f244a61c79b8ce5bc
2025-04-17 12:48:28 -07:00
Jakub Piasecki f622923374 Update VirtualizedLists react-native imports (#50551)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50551

Changelog: [Internal]

Reviewed By: huntie

Differential Revision: D72634484

fbshipit-source-id: 128c4eb1b8d7ca2f3821d138afb6750c19bc5f84
2025-04-14 10:32:48 -07:00
Jakub Piasecki b4e64546fd Add a post transform to rename the default export names (#50397)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50397

Changelog: [Internal]

Reviewed By: huntie

Differential Revision: D72170157

fbshipit-source-id: 9067a83c5e941ef8ade7b846799d9a09f7dc4e62
2025-04-02 07:03:15 -07:00
Jakub Piasecki ad5f5a332a Make VirtualizedList use ScrollViewProps directly (#50416)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50416

Changelog: [Internal]

Reviewed By: huntie

Differential Revision: D72223126

fbshipit-source-id: 8598a02c31e16302a3f2ce8678602a33fc090c8a
2025-04-01 03:46:00 -07:00
Iwo Plaza be8393c41b Limit @react-native/virtualized-lists subpath imports (#50392)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50392

## This diff
Defines an exports field for the "react-native/virtualized-lists" package. Limits internal use of subpath
imports to virtualized-lists package, and exports all currently used APIs one the root level.

Changelog:
[General][Breaking] - Subpath imports to the internal react-native/virtualized-lists package are not allowed.

Reviewed By: huntie

Differential Revision: D72162344

fbshipit-source-id: 828dab8e569f019fc48084af475e152b898f5bb5
2025-04-01 03:26:25 -07:00
Andrew Wang 63160341d9 Revert D70615310: Collection of small type updates
Differential Revision:
D70615310

Original commit changeset: 11dc833aeeeb

Original Phabricator Diff: D70615310

fbshipit-source-id: 6508f8e27e1a17f6086fdecb5177472233dc3480
2025-03-31 06:14:37 -07:00
Jakub Piasecki f8a4f80b6e Collection of small type updates (#50312)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50312

Changelog: [Internal]

Reviewed By: huntie

Differential Revision: D70615310

fbshipit-source-id: 11dc833aeeeb67e03808b18b50ff79ae6aa956ec
2025-03-31 04:13:04 -07:00
Alex Hunt 4f709afa6d Add type exports to index.js.flow (#50225)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50225

Updates `index.js.flow` to export (what should be) all public types for `react-native`, closely matching the resolved exported types of `types/index.d.ts` (current manual TS defs).

- Note that this first pass doesn't have to be exhaustive (not yet load bearing) — however, I've done a best-effort scan, which passes our current `__typetests__` fixtures.

**Approach: Explicit type imports in `index.js.flow`**

We have a number of options for how we organise and re-export values and types from the new index file — for now, we're opting for explicitly exporting each symbol here.

- While this clutters the index file somewhat, it also provides a single scannable source of truth — without introducing / altering each contributing module's type exports (we might want to do this eventually, but we're far from having strong organisation denoting the public API boundary). It's self-documenting that the index file contains all root exports by name.
- At the same time, we currently have some exceptions that use `export [type] *` to line up with TypeScript `namespace`s. We aim to review and update these within this release cycle, to enforce the above system.

Changelog: [Internal] - The `react-native` package now exports all public types in Flow (fbsource)

Reviewed By: rubennorte

Differential Revision: D71741575

fbshipit-source-id: 770e2b490e494ee195f4240358fec39f69145a94
2025-03-26 20:46:41 -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
Jakub Piasecki b2d88d33b7 Align SectionList types with OSS (#50074)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50074

Changelog: [Internal]

Reviewed By: huntie

Differential Revision: D71318882

fbshipit-source-id: ac26820bd4a9200c4156b703dce036535f677025
2025-03-25 11:03:54 -07:00
Sam Zhou 4f14499013 Fix issues in react-native ahead of making React.ComponentType an alias of component(...Props) (#50180)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50180

Prepare for the change that makes `React.ComponentType` an alias of `component(...Props)`, which comes with stricter checking and making the props automatically readonly.

Changelog: [Internal]

Reviewed By: gkz

Differential Revision: D71566900

fbshipit-source-id: cefcc10fda9a9777532f25b325412b0d50ebb9b8
2025-03-20 15:05:28 -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
Rubén Norte cd072dca99 Migrate HostInstance to an interface (#49633)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49633

Changelog: [internal]

This replaces the definition of `HostInstance` to use an interface instead of an object, to better represent the underlying type (an instance of `ReactFabricHostComponent`) and simplify the migration to the new DOM API.

Reviewed By: huntie

Differential Revision: D70023947

fbshipit-source-id: bf312abf02fec48b2b5afb41053593ce542f7324
2025-02-26 05:13:08 -08:00
Jakub Piasecki 7b5b7b20de Update VirtualizedSectionList props name (#49592)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49592

Changelog: [Internal]

Reviewed By: huntie

Differential Revision: D69984225

fbshipit-source-id: 753917f31a803c3bc8ea2e4635ec1d58cecb9224
2025-02-23 23:59:51 -08:00
Jakub Piasecki ebbb241bf8 Align layout event names with OSS (#49423)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49423

Changelog: [Internal]

Reviewed By: huntie

Differential Revision: D69655570

fbshipit-source-id: bd9b3dbc70b93c5be49e6a2b1b0487d11bf5b3f1
2025-02-18 07:26:13 -08:00
Jakub Piasecki aedf8c1dba Update virtualized-lists types to align them closer to TS definitions (#49264)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49264

Changelog: [Internal]

Reviewed By: huntie

Differential Revision: D69308531

fbshipit-source-id: 29f1726026aa55e4e17616e7880c7d30eae13b8f
2025-02-11 09:25:22 -08:00
Jakub Piasecki b8e2bcd60d Update types in virtualized-lists so that they produce valid TS output (#49263)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49263

Changelog: [Internal]

Reviewed By: huntie

Differential Revision: D69308533

fbshipit-source-id: 36dd38a5bfce3b19eabcf04ef5f14e006d581bcd
2025-02-11 09:25:22 -08:00
Jakub Piasecki 1cf4c84ba0 Update files in packages/virtualized-lists to use export syntax (#49262)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49262

Changelog: [General][Breaking] Deep imports into `react-native/virtualized-lists` with require syntax may need to be appended with `.default`

Reviewed By: huntie

Differential Revision: D69308532

fbshipit-source-id: 6de15d46e0931616bc9849edbccb7cf745e15dd5
2025-02-11 09:25:22 -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
Tim Yung c8a387c2d1 VirtualizedList: Delete Batchinator (#48515)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48515

Deletes `Batchinator`, inlines the timer, and cleans up the `disableInteractionManagerInBatchinator` feature flag.

Changelog:
[Internal]

Reviewed By: javache, NickGerleman

Differential Revision: D67885194

fbshipit-source-id: 5f3ec71a02cf1f1b382b41a480beed28fc8c5439
2025-01-22 07:14:37 -08:00
Tim Yung 0ead7de5e8 VirtualizedList: More Resilient Unit Tests (#48819)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48819

Currently, `VirtualizedList-test.js` has a subtle dependency on how asynchronous operations are queued. Specifically, it depends on...

- `Batchinator` to use `setTimeout` for...
- `InteractionManager` to use `setImmediate` for...
- `InteractionManager` to resolve a promise via microtask.

As a consequence, any changes to this queueing logic (e.g. eliminating the unnecessary `setImmediate` and microtask) unnecessarily breaks these unit tests.

This changes the Jest unit tests to instead use `jest. advanceTimersToNextTimer(<step>)` instead of `jest.runOnlyPendingTimers()` so that the unit tests are no longer dependent on these specific queueing logic.

Changelog:
[Internal]

Reviewed By: NickGerleman

Differential Revision: D68449850

fbshipit-source-id: 382b1c0a0d8fade873ccf17a9deb3622a83b8163
2025-01-21 16:43:36 -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
Sam Zhou f8119fc52b Pre-suppress errors in xplat ahead of 0.257.0 release
Summary: Changelog: [Internal]

Reviewed By: panagosg7

Differential Revision: D67368232

fbshipit-source-id: 23111f62c5731b5a58e15ac8ef2dcd9ea8006573
2024-12-17 18:28:25 -08:00
Riccardo Cipolleschi 4368368ef5 Fix some peer dependencies on React types (#48292)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48292

These dependencies are making the CI on main to fail.

## Changelog:
[General][Fixed] - Fix peer dependencies on React types

Reviewed By: javache, hoxyq

Differential Revision: D67283609

fbshipit-source-id: b325246f5de654a9ccbf7f96eec24434047a38ee
2024-12-16 14:08:19 -08:00
Riccardo Cipolleschi 5a81ceed2a React Native sync for revisions de68d2f...372ec00 (#48196)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48196

X-link: https://github.com/facebook/metro/pull/1400

- **[372ec00c03](https://github.com/facebook/react/commit/372ec00c03 )**: Update ReactDebugInfo types to declare timing info separately ([#31714](https://github.com/facebook/react/pull/31714)) //<Sebastian Markbåge>//
- **[3d2ab01a55](https://github.com/facebook/react/commit/3d2ab01a55 )**: [Flight] Extract special cases for Server Component return value position ([#31713](https://github.com/facebook/react/pull/31713)) //<Sebastian Markbåge>//
- **[1c9b138714](https://github.com/facebook/react/commit/1c9b138714 )**: Don't serialize chunk ids for Hint and Console rows ([#31671](https://github.com/facebook/react/pull/31671)) //<Sebastian Markbåge>//
- **[de68d2f4a2](https://github.com/facebook/react/commit/de68d2f4a2 )**: Register Suspense retry handlers in commit phase ([#31667](https://github.com/facebook/react/pull/31667)) //<Josh Story>//
- **[16d2bbbd1f](https://github.com/facebook/react/commit/16d2bbbd1f )**: Client render dehydrated Suspense boundaries on document load ([#31620](https://github.com/facebook/react/pull/31620)) //<Josh Story>//
- **[5b0ef217ef](https://github.com/facebook/react/commit/5b0ef217ef )**: s/server action/server function ([#31005](https://github.com/facebook/react/pull/31005)) //<Ricky>//
- **[e3b7ef32be](https://github.com/facebook/react/commit/e3b7ef32be )**: [crud] Only export uRC when flag is enabled ([#31617](https://github.com/facebook/react/pull/31617)) //<lauren>//
- **[aba370f1e4](https://github.com/facebook/react/commit/aba370f1e4 )**: Add moveBefore Experiment ([#31596](https://github.com/facebook/react/pull/31596)) //<Sebastian Markbåge>//
- **[1345c37941](https://github.com/facebook/react/commit/1345c37941 )**: Mark all lanes in order on every new render ([#31615](https://github.com/facebook/react/pull/31615)) //<Sebastian Markbåge>//
- **[91061073d5](https://github.com/facebook/react/commit/91061073d5 )**: Mark ping time as update ([#31611](https://github.com/facebook/react/pull/31611)) //<Sebastian Markbåge>//
- **[a9f14cb44e](https://github.com/facebook/react/commit/a9f14cb44e )**: Fix Logging of Immediately Resolved Promises ([#31610](https://github.com/facebook/react/pull/31610)) //<Sebastian Markbåge>//
- **[c11c9510fa](https://github.com/facebook/react/commit/c11c9510fa )**: [crud] Fix deps comparison bug ([#31599](https://github.com/facebook/react/pull/31599)) //<lauren>//
- **[64f89510af](https://github.com/facebook/react/commit/64f89510af )**: [crud] Enable on RTR FB builds ([#31590](https://github.com/facebook/react/pull/31590)) //<lauren>//
- **[7558ffe84d](https://github.com/facebook/react/commit/7558ffe84d )**: [crud] Fix copy paste typo ([#31588](https://github.com/facebook/react/pull/31588)) //<lauren>//
- **[7c254b6576](https://github.com/facebook/react/commit/7c254b6576 )**: Log yielded time in the Component Track ([#31563](https://github.com/facebook/react/pull/31563)) //<Sebastian Markbåge>//
- **[6177b18c66](https://github.com/facebook/react/commit/6177b18c66 )**: Track suspended time when the render doesn't commit because it suspended ([#31552](https://github.com/facebook/react/pull/31552)) //<Sebastian Markbåge>//
- **[eaf2d5c670](https://github.com/facebook/react/commit/eaf2d5c670 )**: fix[eslint-plugin-react-hooks]: Fix error when callback argument is an identifier with an `as` expression ([#31119](https://github.com/facebook/react/pull/31119)) //<Mark Skelton>//
- **[047d95e85f](https://github.com/facebook/react/commit/047d95e85f )**: [crud] Basic implementation ([#31523](https://github.com/facebook/react/pull/31523)) //<lauren>//
- **[92c0f5f85f](https://github.com/facebook/react/commit/92c0f5f85f )**: Track separate SuspendedOnAction flag by rethrowing a separate SuspenseActionException sentinel ([#31554](https://github.com/facebook/react/pull/31554)) //<Sebastian Markbåge>//
- **[053b3cb050](https://github.com/facebook/react/commit/053b3cb050 )**: [crud] Rename Effect type ([#31557](https://github.com/facebook/react/pull/31557)) //<lauren>//
- **[7dd6b9e68a](https://github.com/facebook/react/commit/7dd6b9e68a )**: [crud] Add enableUseResourceEffectHook flag ([#31556](https://github.com/facebook/react/pull/31556)) //<lauren>//
- **[d8afd1c82e](https://github.com/facebook/react/commit/d8afd1c82e )**: [crud] Scaffold initial types ([#31555](https://github.com/facebook/react/pull/31555)) //<lauren>//
- **[3720870a97](https://github.com/facebook/react/commit/3720870a97 )**: Log Render Phases that Never Committed ([#31548](https://github.com/facebook/react/pull/31548)) //<Sebastian Markbåge>//
- **[8a41d6ceab](https://github.com/facebook/react/commit/8a41d6ceab )**: Unify RootDidNotComplete and RootSuspendedWithDelay exit path  ([#31547](https://github.com/facebook/react/pull/31547)) //<Sebastian Markbåge>//
- **[63cde684f5](https://github.com/facebook/react/commit/63cde684f5 )**: (chore): copy fix in <style> precedence error ([#31524](https://github.com/facebook/react/pull/31524)) //<Zack Tanner>//
- **[b01722d585](https://github.com/facebook/react/commit/b01722d585 )**: Format event with "warning" yellow and prefix with "Event: " ([#31536](https://github.com/facebook/react/pull/31536)) //<Sebastian Markbåge>//
- **[c13986da78](https://github.com/facebook/react/commit/c13986da78 )**: Fix Overlapping "message" Bug in Performance Track ([#31528](https://github.com/facebook/react/pull/31528)) //<Sebastian Markbåge>//
- **[4686872159](https://github.com/facebook/react/commit/4686872159 )**: Log passive commit phase when it wasn't delayed ([#31526](https://github.com/facebook/react/pull/31526)) //<Sebastian Markbåge>//
- **[5d89471ca6](https://github.com/facebook/react/commit/5d89471ca6 )**: Export __COMPILER_RUNTIME in stable ([#31540](https://github.com/facebook/react/pull/31540)) //<lauren>//
- **[3644f0bd21](https://github.com/facebook/react/commit/3644f0bd21 )**: Use completedRenderEndTime as the start of the commit phase if it's an immediate commit ([#31527](https://github.com/facebook/react/pull/31527)) //<Sebastian Markbåge>//
- **[8657869999](https://github.com/facebook/react/commit/8657869999 )**: Separate Tracks for Components and Phases ([#31525](https://github.com/facebook/react/pull/31525)) //<Sebastian Markbåge>//
- **[b15135b9f5](https://github.com/facebook/react/commit/b15135b9f5 )**: [ez] Update useMemoCache return type ([#31539](https://github.com/facebook/react/pull/31539)) //<lauren>//

Changelog:
[General][Changed] - Bump React from 18.3.1 to 19.0.0

bypass-github-export-checks
jest_e2e[run_all_tests]

Reviewed By: cortinico

Differential Revision: D67018480

fbshipit-source-id: 39bca3261ffaa8bb7d74187510724d77cc36b196
2024-12-16 06:58:21 -08:00
Andrei Marchenko df7b6ae092 fix item disappearing with scroll in VirtualizedList (#47965)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47965

Changelog: [General] [Changed] - fix item disappearing with scroll in VirtualizedList

It was caused because the function `computeWindowedRenderLimits` collapsed the current window size to just 1 element. So, users start scroll current window increase from {left:0, right:5 } -> {left:0, right:6 } and after some edge cases the window collapsed to `{left:6, right:6 }` which cause to remove all elements and recreate them later. As a result users have a lot of lags and blank pages.

The diff fixes the collapsing window size to 1 element. Also fix other decreasing `left` position even if windowSize more than current amount of elements.

Reviewed By: NickGerleman

Differential Revision: D66334188

fbshipit-source-id: 2162d00d03d64ab6325c0492d87449051e68a4e9
2024-11-26 10:44:30 -08:00
Andrei Marchenko aafe696453 turn on by default optimization for memoization of virtualized list cells (#47724)
Summary:
Changelog: [General] [Changed] - Fix unnececary rerenders of VirtualizedListCells with strictMode={true}

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

Reviewed By: sammy-SC

Differential Revision: D66123469

fbshipit-source-id: 295e10add51bc1c319b8b8e3a9f4874c5e5a386d
2024-11-20 16:00:03 -08:00
Tim Yung 29a0d7c3b2 RN: Feature Flag to Disable InteractionManager in Batchinator (#47690)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47690

Creates a feature flag to evalute the impact of disabling `InteractionManager` in `Batchinator` and synchronously invoking callbacks after the timeout.

This also deletes the `dispose` arguments in `Batchinator` that were unused.

Changelog:
[Internal]

Reviewed By: bvanderhoof

Differential Revision: D66139643

fbshipit-source-id: d17bab0cd25c0c69779686cb435c063f707255e4
2024-11-18 23:12:15 -08:00
Nicola Corti 7e268c9d52 Revert React 19RC to React 18.3.1 (#47380)
Summary:
While we're waiting for 19 stable, let's bring main back to 18.3.1 ahead of the 0.77 branch cut. We'll land this change just after 19 stable lands.

This is a cherry pick of b93b378fa0 which landed in 0.76 already

bypass-github-export-checks

## Changelog:

[INTERNAL] - Revert React 19RC to React 18.3.1

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

Test Plan: CI

Reviewed By: cipolleschi

Differential Revision: D65430775

Pulled By: cortinico

fbshipit-source-id: f0f211754c8ffe5d037fd299e4de52c29d1d7913
2024-11-08 08:27:37 -08:00
Liron Yahdav 61e660b40e Expose some VirtualizedList functions to allow creating VirtualizedListContextProvider outside of VirtualizedList (#47463)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47463

Note this is just a temporary approach which will be cleaned up later.

Changelog: [Internal]

Reviewed By: yungsters

Differential Revision: D65514902

fbshipit-source-id: f722031c5cd34eb1400b3f732fd94c0b03d5434d
2024-11-06 20:15:08 -08:00