Commit Graph

38536 Commits

Author SHA1 Message Date
David Vacca 2e8720af44 Implement prop diffing for transform props in <View> (#48832)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48832

This diff implements the diffing for transform props of <View>

changelog: [internal] internal

Reviewed By: javache

Differential Revision: D59972039

fbshipit-source-id: e4c3beff4c6411595ab83ff62b54b948f9337851
2025-01-22 12:07:06 -08:00
David Vacca 9a5e365865 Implement prop diffing for border props in <View> (#48831)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48831

This diff implements the diffing for border props of <View>

changelog: [internal] internal

Reviewed By: sammy-SC

Differential Revision: D59972037

fbshipit-source-id: b93a0962616222686a4340cd1e7f2943bd3bc140
2025-01-22 12:07:06 -08:00
David Vacca 4396487742 Implement prop diffing for event props in <View> (#48830)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48830

This diff implements the diffing for event props of <View>

changelog: [internal] internal

Reviewed By: javache

Differential Revision: D59972038

fbshipit-source-id: ddd42068a74862f44ecf374e12d80aaaf493e04f
2025-01-22 12:07:06 -08:00
David Vacca 92d79461e9 Implement prop diffing for basic props in <View> (#48829)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48829

This diff implements the diffing for basic props of <View>

changelog: [internal] internal

Reviewed By: NickGerleman

Differential Revision: D59972040

fbshipit-source-id: 148b5fc9b73887c153535648182386d75bf9381b
2025-01-22 12:07:06 -08:00
David Vacca 5ee2289298 Introduce getDiffProps for <View> (#45552)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45552

In this diff I'm overriding the getDiffProps for  ViewProps.
The goal is to verify what's the impact of calculating diffs of props in Android, starting with ViewProps.
Once we verify what are the implication we will automatic implement this diffing.

The full implementation of this method will be implemented in the following diffs

changelog: [internal] internal

Reviewed By: NickGerleman

Differential Revision: D59969328

fbshipit-source-id: ce141528581e46e9ced4175dca040ddf8bed5ddb
2025-01-22 12:07:06 -08:00
David Vacca 33e0bab567 Mark MemoryPressureRouter as nullsafe (#48740)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48740

Mark MemoryPressureRouter as nullsafe

changelog: [internal] internal

Reviewed By: tdn120

Differential Revision: D68275418

fbshipit-source-id: 8437f017f020e4e9f66916df2661850702b77486
2025-01-22 11:55:11 -08:00
Jin Lee 9b06d0d8a9 Back out "Disable weak event emitter in AttributedString for Apple Silicon Mac running iOS build app" (#48868)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48868

Original commit changeset: ac48be3305eb

Original Phabricator Diff: D68093083

Changelog: [iOS][Removed] - Removed workaround for a iOS build app running on Apple Silicon Mac(in Xcode Destination: "Mac(Designed for iPad)") TextInput crash due to serialization attempt of WeakEventEmitter

Reviewed By: javache

Differential Revision: D68452788

fbshipit-source-id: 9d3466950c43a10f36ca594997ae5a586d1a2a00
2025-01-22 11:52:34 -08:00
Rubén Norte 04f9451dab Modify public API script to make it opt-in in src/private, instead of opt-out (#48866)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48866

Changelog: [internal]

The current test to create a snapshot of the public API was recently modified to include `src/private` but excluding certain directories from it.

This replaces the opt-out with an opt-in mechanism, where we only use it where necessary (new DOM APIs, etc.).

Reviewed By: huntie

Differential Revision: D68496269

fbshipit-source-id: 6ae056008a6189b493cb27811d21a8619e79009d
2025-01-22 11:24:25 -08:00
Rubén Norte e2c433b657 Move some internal modules to internals directories (#48859)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48859

Changelog: [internal]

Just to make it easier to distinguish between public and private APIs, until we have proper support to extract that automatically.

Reviewed By: huntie

Differential Revision: D68496270

fbshipit-source-id: 83cdf95f7f33eab8835b0913cc468ccaf5e47730
2025-01-22 11:24:25 -08:00
Dawid Małecki 8befab1760 Replace $FlowFixMe in ScrollViewNativeComponentType (#48858)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48858

Changelog:
[General][Changed] - Replaced $FlowFixMe with PressEvent in ScrollViewNativeComponentType

Reviewed By: fabriziocucci

Differential Revision: D68496466

fbshipit-source-id: 19c5738a906908336ef93e339092e6cb6fa2d860
2025-01-22 11:23:21 -08:00
Christoph Purrer d154cd5ba1 Fix data race in TraceSection.h (#48774)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48774

[Changelog] [Internal] - Fix data race in TraceSection.h

## Issue
The `instrumentsLogHandle` variable is a static variable that is initialized lazily when the `getOrCreateInstrumentsLogHandle()` function is called. However, this initialization is not thread-safe. Multiple threads may call this function simultaneously, leading to a data race on the `instrumentsLogHandle` variable.

Reviewed By: lyahdav, javache

Differential Revision: D68366837

fbshipit-source-id: d61b85a0299a8d42b9fbcfdbecae78eb410d748f
2025-01-22 10:41:42 -08:00
Dawid Małecki e31ff4212b Added type for _captureRef in SectionList (#48863)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48863

Changelog:
[General][Changed] - Added explicit type for argument in _captureRef in SectionList

Reviewed By: huntie

Differential Revision: D68493326

fbshipit-source-id: 906a13b13e9fc7ee2c61a8d5c7caa72c0656440f
2025-01-22 10:34:21 -08:00
Dawid Małecki 1be2ba4597 Replace $FlowFixMe in ScrollView (#48857)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48857

Changelog:
[General][Changed] - Improved types in ScrollView

Reviewed By: huntie

Differential Revision: D68496037

fbshipit-source-id: b044e884fb78bb92c0da5acd7570a87ff328a479
2025-01-22 10:00:50 -08:00
Edmond Chui 0e5adb9128 Fix app lagging while attempting a connection to Metro (#48642)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48642

Changelog:
[General][Breaking][Fixed] - removed a long-running loop causing the app to lag while attempting a connection to Metro

D65952134 fixed the auto-reconnection between Metro and the device.

There's an existing "constructed = connected" contract as [discussed](https://www.internalfb.com/diff/D65952134?dst_version_fbid=3741052436109227&transaction_fbid=581445277659906):

https://www.internalfb.com/code/fbsource/[1592525fbcbb]/xplat/js/react-native-github/packages/react-native/ReactCommon/jsinspector-modern/WebSocketInterfaces.h?lines=16-20

In compliance, busy-waiting was [introduced](https://www.internalfb.com/diff/D65952134?dst_version_fbid=896147259315683&transaction_fbid=427393513742494) in V4 to wait for the connection result in the constructor.

xArthasx [discovered](https://www.internalfb.com/diff/D65952134?dst_version_fbid=896147259315683&transaction_fbid=1406890420289706) a performance issue from this impl via a profiling result.

In favour of async connection results, we're going back to V3 design with the imperative `isConnected()` check to the interface. xArthasx has confirmed this fixes the perf issue.

While I haven't found a compelling reason against removing this contract from the initial design in D52134592, please let me know if I've missed one.

This also means there was a scenario where messages were sent before the websocket is open. Those were dropped silently previously (before the busy-waiting while loop was introduced):

https://www.internalfb.com/code/fbsource/[f7113e167ee1]/fbobjc/VendorLib/SocketRocket/src/SocketRocket/SRWebSocket.m?lines=630-637

This means message senders must now consider the connection state, e.g. by maintaining a pre-connection message queue, if they need to guarantee the messages to be sent.

Reviewed By: christophpurrer

Differential Revision: D68023397

fbshipit-source-id: dd80acf75790e77454798c96f06bb0a4ee6afe61
2025-01-22 09:49:01 -08:00
Marc Rousavy f830f2c667 feat: Add getConcretePropsShared() (#48710)
Summary:
Adds `getConcretePropsShared()` to `ConcreteShadowNode.h`.

I need this in Nitro Views to update state in-place without throwing away the old state object and creating a new one each time.

From reading the code it seems like you use this pattern a lot tho where you create new State objects each time - so let me know if my thing is a bad idea..

## Changelog:

- [INTERNAL] [ADDED] Add `getConcretePropsShared()` to `ConcreteShadowNode.h`

<!-- 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/48710

Test Plan: Use in Nitro

Reviewed By: sammy-SC

Differential Revision: D68495697

Pulled By: javache

fbshipit-source-id: e2caa34befcaef2191ec161442c40596cc7de132
2025-01-22 09:17:31 -08:00
Tim Yung ab77bdf471 Animated: Feature Flags Cleanup (#48509)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48509

Cleans up the following feature flags from `Animated`:

- `enableAnimatedAllowlist`
- `enableAnimatedPropsMemo`
- `useInsertionEffectsForAnimations`

This will significantly simplify some future planned work here (e.g. T209740497).

Changelog:
[Internal]

Reviewed By: javache

Differential Revision: D67867115

fbshipit-source-id: adf35c70d95f42c240342fda3b4f2e9b4bdfe30a
2025-01-22 08:54:58 -08:00
Rubén Norte 0883207e44 Clean up feature flag to disable event loop on bridgeless (#48851)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48851

Changelog: [internal]

Remove the feature flag to disable the event loop on bridgeless, as we no longer have a use case for it. From now on, we can be 100% certain that Bridgeless == Event Loop!

Reviewed By: sammy-SC

Differential Revision: D68270102

fbshipit-source-id: c661bf11f51d4044f9f485b971c43f03197e2983
2025-01-22 08:24:29 -08:00
Iwo Plaza bdb5804f32 Migrated Core/ReactNativeVersion to use export syntax. (#48853)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48853

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

## This diff
- Updates the `ReactNativeVersion` template to use `export` syntax.
- Regenerates the `ReactNativeVersion.js` file with the new template.
- Updates jest mock.
- Updates the public API snapshot *(intented breaking change)*

Changelog: [Internal]

Reviewed By: robhogan

Differential Revision: D68492723

fbshipit-source-id: daa55d3d553aca562cf2e091cd24546681a8db2f
2025-01-22 07:41:04 -08:00
Arushi Kesarwani 44da5d2ee0 Make setLayoutAnimationEnabledExperimental a no-op in Bridgeless (#48856)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48856

Refactor setLayoutAnimationEnabledExperimental in BridgelessUIManager.js to be a no-op in the new architecture

Changelog:
[Android][Fixed] - Make `setLayoutAnimationEnabledExperimental` a no-op in Bridgeless

Reviewed By: javache

Differential Revision: D68313694

fbshipit-source-id: 7a79fad72b1eeda5af3ff629a609d53e4f08f26d
2025-01-22 07:16:44 -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
Samuel Susla ff0bcb2427 introduce Fantom.dispatchNativeEvent (#48793)
Summary:
changelog: [internal]

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

Adds new method `dispatchNativeEvent` to Fantom give option to dispatch fake native events.

The API is expanded in subsequent diffs. The version introduced in this diff supports only dispatching event without payload and without any options.

Reviewed By: rubennorte

Differential Revision: D68331986

fbshipit-source-id: 075360e1d6874794ba6df966087fbe6a0a820cbc
2025-01-22 06:55:18 -08:00
Dawid Małecki a24f9ef825 Add type for _lastNativeRefreshing and change React import in RefreshControl (#48809)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48809

Changelog:
[General][Changed] - Added explicit type for _lastNativeRefreshing and changed React import syntax in RefreshControl

Reviewed By: cortinico

Differential Revision: D68437259

fbshipit-source-id: e3e842870c485b235e41e1a634b55f2f12b63115
2025-01-22 06:04:25 -08:00
Iwo Plaza ce412746b1 Migrated components to export syntax (part 2) (#48767)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48767

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

## This diff
- Updates a handful of components in `Libraries/Components` to use `export` syntax
  - `export default` for qualified objects, many `export` statements for collections (determined by how it's imported)
- Appends `.default` to requires of the changed files.
- Updates test files.
- Updates the public API snapshot (intented breaking change)

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

Reviewed By: yungsters

Differential Revision: D68335872

fbshipit-source-id: eb0c67039edfe92e9e133726f6b01900dd2c2322
2025-01-22 03:43:59 -08:00
Dawid Małecki b200c7cb2f Replace $FlowFixMeProps in UnimplementedView (#48810)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48810

Changelog:
[General][Changed] - Improved Props type in UnimplementedView

Reviewed By: cortinico

Differential Revision: D68437542

fbshipit-source-id: 134b834d77f65a94a6488c21298d79b060ea8109
2025-01-22 03:28:28 -08:00
Dawid Małecki cd7a30ce48 Replace $FlowFixMe in InteractionManager (#48797)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48797

Changelog:
[General][Changed] - Replaced $FlowFixMe in InteractionManager to Function type

Reviewed By: cortinico

Differential Revision: D68416677

fbshipit-source-id: 4b2adf299021c9008c73e2374092a7ad52da2245
2025-01-22 03:27:05 -08:00
Jakub Piasecki f1a33c5982 Add generated types to the gitignore (#48848)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48848

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D68489815

fbshipit-source-id: ddb6e19e1ef060f537bfeacf6d8a916e08cff75b
2025-01-22 03:07:08 -08:00
Mateo Guzmán 480ee4b935 Migrate com.facebook.react.modules.network interfaces to Kotlin (#48679)
Summary:
Migrate com.facebook.react.modules.network interfaces to Kotlin: `ProgressListener`, `CustomClientBuilder` and `NetworkInterceptorCreator`.

## Changelog:

[INTERNAL] - Migrate com.facebook.react.modules.network interfaces to Kotlin

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

Test Plan:
```bash
yarn test-android
yarn android
```

Reviewed By: javache

Differential Revision: D68186452

Pulled By: mdvacca

fbshipit-source-id: 814bf4c525ba1da49e26046345c71abf2c1e39ce
2025-01-21 21:24:46 -08:00
David Vacca c871c4c93b Delete ViewHierarchyUtil (#48837)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48837

ViewHierarchyUtil is a class with package visibility and it is not used, let's delete it

changelog: [internal] internal

Reviewed By: shwanton

Differential Revision: D68467507

fbshipit-source-id: d1bd5b279a26fcecb4fed590ad2de75937b54aa6
2025-01-21 20:30:29 -08:00
Nick Gerleman 8803dca0bb Support parsing rgb() and rgba() functions into CSSColor (#48827)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48827

This teaches the CSSColor parser how to handle these functions.

There are a surprising amount of edge cases here, including many syntactic options added by the CSS Color Module 4 spec, and some technically invalid examples supported by normalize-color, sometimes working in Chrome.

I used the combination of the spec, and existing functionality and tests for `normalize-color`, with the end result supporting a superset of the functionality of both, while being a bit more permissive than either.

I still need to add support for the other color functions, and will probably want to share code here, but for now, just implemented everything for the rgb values as a start.

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D68362477

fbshipit-source-id: 62973ba2f8361b6a43c7cf9a96029147f84582d2
2025-01-21 20:20:04 -08:00
Nick Gerleman fe3e3a54a3 Simplify consuming solidus separated component values (#48826)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48826

This ends up being a not uncommon pattern, so lets make it a bit easier.

Changelog: [Internal]

Reviewed By: lenaic

Differential Revision: D68359563

fbshipit-source-id: 94283c8815cf9dd2f6c0d52762d21232383fb311
2025-01-21 20:20:04 -08:00
Nick Gerleman e73d4ff015 Simplify "rollback" on optional or invalid syntax (#48825)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48825

Right now we preserve the state of the CSSSyntaxParser across multiple data type parse attempts, so long that a data type parser consumes an additional component value. This requires data type parsers to be careful to not consume additional forward tokens if it may lead to parse error. We can make this model a lot simpler by instead resetting the parser to original state on data type parse error.

We also introduce `peekComponentValue`, and visitor-less `consumeComponentValue` as a convenience, to allow data type parsers to view future component values without advancing, even if the data type parser does return a value, without needing to manually clone the parser.

Changelog: [Internal]

Reviewed By: lenaic

Differential Revision: D68357624

fbshipit-source-id: 6ff77bab8ac9eabd5dccea52daa85bbd32b5f2b6
2025-01-21 20:20:04 -08:00
David Vacca 4ed2b35bf6 Fix execution of early InteropEvents (#48823)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48823

This diff is fixing the execution of Events that are sent early in the rendering of surfaces.

This diff fixes a bug in the queueing of events that are built with not surfaceId (-1), the fixes is to call getSurfaceManagerForView() to retrieve the proper surfaceId (as we do in the execution of events)

calling getSurfaceManagerForView() has a perf hit, we believe this won't be a problem because this method will only be called in edge cases (no surfaceId and early execution of events)

changelog: [Android][Fixed] Fix execution of early InteropEvents

Reviewed By: shwanton, lenaic

Differential Revision: D68454811

fbshipit-source-id: a79be0b392004e645c48d1683bba774b6b597ca0
2025-01-21 19:03:24 -08:00
David Vacca 2a9a13d567 Reduce visibility of methods in FabricUIManager (#48824)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48824

Reduce visibility of methods in FabricUIManager and fix lint warnings

changelog: [Android][Breaking] Reduce visibility of  FabricUIManager.setBinding() method, unused outside of react native

Reviewed By: philIip

Differential Revision: D68459708

fbshipit-source-id: 59081b9a87607b1d35c3fc88bb16e5980cfbd721
2025-01-21 18:58:15 -08:00
David Vacca 10f4772551 Migrate SelectionWatcher to Kotlin (#48747)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48747

Migrate SelectionWatcher to Kotlin

changelog: [internal] internal

Reviewed By: tdn120, cortinico

Differential Revision: D68284145

fbshipit-source-id: 40b7d00fe0be75c5387a169038b1c58a048ac88a
2025-01-21 18:58:13 -08:00
Liron Yahdav 6cbdc94456 Add feature flag to enable running JS GC on memory pressure with Bridgeless (#48771)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48771

Pre Bridgeless RN iOS apps relied on [RCTCxxBridge](https://www.internalfb.com/code/fbsource/[44b3ff81a2875d66675774f2c71643622ea03c36]/xplat/js/react-native-github/packages/react-native/React/CxxBridge/RCTCxxBridge.mm?lines=376) to tell Hermes to GC when the OS detects memory pressure. With bridgeless we don't use RCTCxxBridge so we don't get that behavior anymore. This adds a feature flag to experiment with getting the same behavior with Bridgeless.

Changelog: [iOS] [Added] - Add feature flag to enable running JS GC on iOS memory pressure with Bridgeless

Reviewed By: yungsters

Differential Revision: D68290689

fbshipit-source-id: d4df16f44e56ad22c2d3d4073b8a870bd7ade645
2025-01-21 17:41:42 -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
Nicola Corti 9afad527b8 Convert HeadlessJsTaskService to Kotlin (#48800)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48800

This just converts yet another class from Java to Kotlin

Changelog:
[Internal] [Changed] -

Reviewed By: javache

Differential Revision: D68417564

fbshipit-source-id: 167a27f7f80125cc81a4a0ad57952f1149ef4d7d
2025-01-21 11:02:17 -08:00
Nicola Corti acaf31d175 Collapse the 0.77 changelog (#48811)
Summary:
This collapses all the 0.77 changelog from the various RCs into a single entry.

## Changelog:

[Internal] [Changed] -

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

Test Plan: N/A

Reviewed By: robhogan

Differential Revision: D68438948

Pulled By: cortinico

fbshipit-source-id: 0ef57432901198602863e9769cd2662a0f4e30f6
2025-01-21 10:06:22 -08:00
Oskar Kwaśniewski 0141a44026 fix(ios): add missing nonnull annotations (#48817)
Summary:
This PR adds missing nonnull annotations to make working with Swift better 👍🏻

## Changelog:

[IOS] [ADDED] - Missing nonnull annotations for RCTArchConfiguratorProtocol, RCTUIConfiguratorProtocol.h

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

Test Plan: CI Green

Reviewed By: cortinico, dmytrorykun

Differential Revision: D68443519

Pulled By: cipolleschi

fbshipit-source-id: 53bf128c65421789034f45f637a08ed996684c6f
2025-01-21 09:48:40 -08:00
Marc Rousavy f2553d39da feat: Add REACT_NATIVE_VERSION_* definitions to ReactNativeVersion.h (#48813)
Summary:
The `ReactNativeVersion.h` file currently contains a `struct` that holds the React Native version (e.g. `1000.0.0`, as individual ints).

For some libraries, we need to conditionally compile out code when using an older React Native version, and that's where library authors usually set compiler flags that hold the react native version - those are usually resolved using a `node require.resolve` script in the Podspec or build.gradle, adding unnecessary complexity.

With this PR this becomes obsolete as we now create a `#define` that holds the React Native version directly - so e.g.

```cpp
#define REACT_NATIVE_VERSION_MAJOR 0
#define REACT_NATIVE_VERSION_MINOR 67
#define REACT_NATIVE_VERSION_PATCH 1
```

..which we can then use to conditionally compile some code in our libraries:

```cpp
#include <React/ReactNativeVersion.h>
#if REACT_NATIVE_VERSION_MINOR >= 76
  // new stuff
#else
  // fallback
#endif
```

## Changelog:

[INTERNAL] [ADDED] - Added `REACT_NATIVE_VERSION_*` C++ defines to `ReactNativeVersion.h`

<!-- 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/48813

Test Plan: Just import the header in a library and check if the defines exist!

Reviewed By: cortinico

Differential Revision: D68441049

Pulled By: javache

fbshipit-source-id: 55ac8875e1a3f8ad8b9d12795fed4204e9c5bb77
2025-01-21 09:00:20 -08:00
Fabrizio Cucci 00c6b21ecb Build codegen CLI when running yarn test-e2e-local (#48816)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48816

Given the recent changes, the error mentioned in [this](https://fb.workplace.com/groups/1374515773430764/permalink/1406615956887412)  post can show up also when testing iOS.

So here we are building the codegen when running `yarn test-e2e-local` regardless by the platform.

Changelog: [Internal]

Reviewed By: cipolleschi

Differential Revision: D68441078

fbshipit-source-id: 9067545b61be59ec595142c2e4ba888e20d9a13a
2025-01-21 07:58:52 -08:00
Fabrizio Cucci 037687df53 Update changelog for 0.78.0-rc.1 (#48806)
Summary:
Changelog for 0.78.0-rc.1

## Changelog:
[Internal] Changelog

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

Test Plan: N/A

Reviewed By: cipolleschi

Differential Revision: D68436101

Pulled By: fabriziocucci

fbshipit-source-id: f7f519a43a045a41ed45eb5b590b8130d97f3592
2025-01-21 07:07:29 -08:00
Dawid Małecki b634fa1edb Add explicit type for _memoizedRenderer and change React and View import in FlatList (#48798)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48798

Changelog:
[General][Changed] - Added explicit type for _memoizedRenderer and changed React and View import in FlatList

Reviewed By: cortinico

Differential Revision: D68417026

fbshipit-source-id: 0af75381f6f8c33be10add940f0791b059de3473
2025-01-21 07:06:39 -08:00
Mateo Guzmán 4f99f0bb1a Convert com.facebook.react.modules.network.ResponseUtil to Kotlin (#48781)
Summary:
As in the title, follow up from https://github.com/facebook/react-native/issues/48075 which added unit tests for this class.

## Changelog:

[INTERNAL] - Convert com.facebook.react.modules.network.ResponseUtil to Kotlin

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

Test Plan:
```bash
./gradlew :packages:react-native:ReactAndroid:test -Dtest.single=com.facebook.react.modules.network
```

Reviewed By: javache

Differential Revision: D68393938

Pulled By: Abbondanzo

fbshipit-source-id: ed214b29ad9248c2da2e2653e75447b0a7e05a26
2025-01-21 07:06:19 -08:00
Mateo Guzmán 299a7a959d Improve ToastAndroid jsdocs (#48779)
Summary:
Was looking into improving some of the type definitions for the `ToastAndroid` component and found out also that some of the options don't work anymore from API 30 – I revamped a bit these definitions to reflect that as I saw questions about it online. These updates could also be added to the website later.

## Changelog:

[GENERAL][CHANGED] - Improve ToastAndroid jsdocs

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

Test Plan: Check the jsdocs look good when using the `ToastAndroid` component in the code.

Reviewed By: cortinico

Differential Revision: D68393949

Pulled By: Abbondanzo

fbshipit-source-id: 4be318062483db5be3825b7b21f540030f6c5b10
2025-01-21 07:03:39 -08:00
Dawid Małecki 44d84f2af6 Add type for export object in AssetRegistry (#48734)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48734

Changelog:
[General][Changed] - Added type for exported object in AssetRegistry

Reviewed By: cortinico

Differential Revision: D68272679

fbshipit-source-id: 1202009f886b2d35528009a3ac58aab24af9ef82
2025-01-21 07:02:21 -08:00
Iwo Plaza 9eeef22a67 Migrated components to export syntax (part 1) (#48765)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48765

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

## This diff
- Updates a handful of components in `Libraries/Components` to use `export` syntax
  - `export default` for qualified objects, many `export` statements for collections (determined by how it's imported)
- Appends `.default` to requires of the changed files.
- Updates test files.
- Updates the public API snapshot (intented breaking change)

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

Reviewed By: cortinico

Differential Revision: D68330077

fbshipit-source-id: 6bf00c82f72dbcaaa26470d7ea0917639fc3de4a
2025-01-21 07:00:35 -08:00
Dawid Małecki 379242eb83 Change ScrollView and React imports in NetworkOverlay (#48796)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48796

Changelog:
[Internal] - Changed ScrollView and React imports in NetworkOverlay

Reviewed By: cortinico

Differential Revision: D68416261

fbshipit-source-id: 3159e14747fe43f25b479f7ef31bdb7daf0a1eb9
2025-01-21 06:59:52 -08:00
Iwo Plaza 09700327f7 Migrated BugReporting, ErrorUtils, Vibration & YellowBox to use export syntax. (#48763)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48763

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

## This diff
- Updates files in `Libraries/BugReporting`, `Libraries/vendor`, `Libraries/Vibration` and `Libraries/YellowBox` to use `export` syntax
  - `export default` for qualified objects, many `export` statements for collections (determined by how it's imported)
- Appends `.default` to requires of the changed files.
- Updates Jest mocks.
- Updates the public API snapshot (intented breaking change)

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

Reviewed By: cortinico

Differential Revision: D68329075

fbshipit-source-id: 7079a54ce3631171f8d7559bc33cab014df1d16d
2025-01-21 01:49:27 -08:00
Iwo Plaza 9a70bc0418 Migrated files in Libraries/Blob to use export syntax. (#48761)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48761

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

## This diff
- Updates files in Libraries/Blob to use `export` syntax
  - `export default` for qualified objects, many `export` statements for collections (determined by how it's imported)
- Appends `.default` to requires of the changed files.
- Updates the public API snapshot (intented breaking change)

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

Reviewed By: cortinico

Differential Revision: D68326103

fbshipit-source-id: ff0b5e0125987ed44b34c35f39af1eefa9799d8f
2025-01-21 01:41:44 -08:00