Commit Graph

12270 Commits

Author SHA1 Message Date
David Vacca d40f90b5e7 Migrate PackagerStatusCheck to Kotlin (#48838)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48838

Migrate PackagerStatusCheck to Kotlin

changelog: [internal] internal

Reviewed By: tdn120, cortinico

Differential Revision: D68467780

fbshipit-source-id: ace98692ebcf96bf0ca36640183c432121d95519
2025-01-23 14:57:33 -08:00
Chi Tsai d9d824055e Add createFromUtf16 JSI method (#48211)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48211

Adding the default implementation for `createFromUtf16` method for JSI
String and PropNameId.

Changelog: [Internal]

Reviewed By: tmikov

Differential Revision: D67070206

fbshipit-source-id: 47297e6ae3028ee0e101628aab5bc076fcbbdebc
2025-01-23 14:54:17 -08:00
Jorge Cabiedes Acosta f89f191c26 Go back to object approach instead of manual drawable layer handling for CompositeBackgroundDrawable (#48835)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48835

D65907786 ended up regressing a bit of the performance gains from new Background and Border Drawables. changing back to the previous approach.

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D68354292

fbshipit-source-id: f2db6d7ad5c1590d5d4d8261d76281f3592f488a
2025-01-23 12:39:25 -08:00
Samuel Susla 0353648f46 add tests for ScrollView.onScroll (#48891)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48891

changelog: [internal]

add two tests covering onScroll: one for the case where onScroll is triggered multiple times during one UI tick and one where it is triggered once per UI tick.

Reviewed By: rubennorte

Differential Revision: D68499566

fbshipit-source-id: ee25227b620569e3a43038575f04b0a325e5e38b
2025-01-23 11:47:31 -08:00
Samuel Susla f695411bf3 add isUnique option to Fantom.dispatchNativeEvent (#48801)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48801

changelog: [internal]

Adds isUnique option to Fantom.dispatchNativeEvent.

isUnique controls whether only the last event of the same type and target is dispatched to JavaScript or all events are queued and dispatched.

Reviewed By: rubennorte

Differential Revision: D68416157

fbshipit-source-id: 415e7db7d258d60a6bc510d929091153bfdccb3f
2025-01-23 11:47:31 -08:00
Riccardo Cipolleschi b9f418e9bc Fix images not displayed when extension is implicit (#48888)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48888

We have a report from OSS where Images are not displayed properly in case they are saved on disk with no extension.

We previously had a fix attempt iwith [this pr](https://github.com/facebook/react-native/pull/46971), but this was breaking some internal apps.

This second attempt should work for both cases.

## Changelog:
[iOS][Fixed] - Load images even when the extension is implicit

Reviewed By: cortinico

Differential Revision: D68555813

fbshipit-source-id: bc25970aafe3e6e5284163b663d36e00b3df3d82
2025-01-23 11:37:16 -08:00
Nicola Corti 3702c986ed RNGP - Update comment on INCLUDE_JITPACK_REPOSITORY_DEFAULT (#48896)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48896

This comment is not exact and should be updated.

Changelog:
[Internal] [Changed] -

Reviewed By: yungsters

Differential Revision: D68556425

fbshipit-source-id: 67427ff325809907fdeba1c6a90b84b97713bf5e
2025-01-23 10:52:34 -08:00
Edmond Chui 9b977def6c Fix app lagging while attempting a connection to Metro (#48895)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48895

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

Round 2: Sorry I broke VR/Java apps in D68023397. Helpful teammates have reverted and Jedi landed it via D68522537.

This diff adds the missing method call that caused the crash:

```
makeNativeMethod(
  "didOpen",
  JCxxInspectorPackagerConnectionWebSocketDelegate::didOpen
)
```

Test plan has been updated to include testing VR Store.

This error wasn't caught by existing automated tests, because it only impacts development builds while using Metro. vzaidman is leading the effort to bring Jest E2E tests on React Native DevTools, which could catch crashes like this.

Original summary in D68023397:

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: robhogan

Differential Revision: D68559198

fbshipit-source-id: afb3d8bfbf949c3324cbf126e9f3e3fc25e50541
2025-01-23 10:43:59 -08:00
Iwo Plaza ecae8a2908 Remove seemingly unused AnimatedWeb file. (#48894)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48894

## Motivation
In our efforts to migrate the RN codebase to modern Flow (to enable ingestion by modern Flow tooling) I stumbled upon the `AnimatedWeb.js` file, which does not seems to be imported anywhere throughout the monorepo.

Searching on GitHub for imports to this file in OSS projects returned no results.

In case this file has actual uses outside of Meta (e.g. in OSS), I'll abandon the diff 🙌

## This diff
- Removes `Libraries/Animated/AnimatedWeb.js` file

Changelog:
[General][Breaking] Removed `Libraries/Animated/AnimatedWeb.js` file.

Reviewed By: cortinico

Differential Revision: D68558237

fbshipit-source-id: 319b5e59eb83e518cd123b9f74642e90f0003a4a
2025-01-23 10:32:59 -08:00
Ruslan Lesiutin a995ecc9c6 Encapsulate Trace Event format (#48648)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48648

# Changelog: [Internal]

This is the pre-requisite before adding a formatter for conversion from Hermes format-agnostic API for JavaScript samples to Trace Events.

This struct will probably be used a lot around this module and big enough for a separate header.

Reviewed By: huntie

Differential Revision: D68104202

fbshipit-source-id: 93f2816de5a87471c5f7761468ccc52a34a895d6
2025-01-23 10:29:48 -08:00
Rubén Norte 0736234e90 Use test name as a hint for benchmarks (#48882)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48882

Changelog: [internal]

The current hint for benchmarks is that the test body contains `unstable_benchmark` calls, but some benchmarks that need to use feature flags define their test bodies in a separate file, so the file containing the call to `unstable_benchmark` isn't the `-itest.js` one.

This adds a new hint to opt into optimized builds that uses the name of the test instead of its contents. If it contains `-benchmark` then we consider it a benchmark and do the opt in.

Reviewed By: andrewdacenko

Differential Revision: D68102300

fbshipit-source-id: 4c0909969f76b8a7d563959cccf686aefaef700d
2025-01-23 10:26:47 -08:00
Rubén Norte 8702ed5f37 Improve format of benchmark results (#48881)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48881

Changelog: [internal]

Small improvement in the printed benchmark results.

Reviewed By: andrewdacenko

Differential Revision: D68552379

fbshipit-source-id: 39312a757a9de57e462c17a9f1455dfe8cab53f1
2025-01-23 10:26:47 -08:00
Andrew Datsenko c5bab82a60 migrate console-itest to beforeEach/afterEach (#48821)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48821

Changelog: [Internal]
Add setup and teardown to console-itest

Reviewed By: rubennorte

Differential Revision: D68454178

fbshipit-source-id: 277e1125248b860a6fe085a5e47dddf4c5cd12da
2025-01-23 09:45:21 -08:00
Andrew Datsenko cf6b807745 Add support for (before|after)(Each|All) methods (#48820)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48820

Changelog: [Internal]
Add capability to setup / teardown tests

Reviewed By: rubennorte

Differential Revision: D68454176

fbshipit-source-id: 93c19c91dfe2b8b98385547da24955fd31adbf0b
2025-01-23 09:45:21 -08:00
Iwo Plaza da695f3a20 Migrated components to export syntax (part 4) (#48808)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48808

## 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)*
- Synchronizes `GoodwillVideoEditorCandidateImage.js` with www, as it was using `require`s that would result in invalid code after this Diff's changes. Added `ReactNativeImage` shim.

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: D68436611

fbshipit-source-id: 14f33e375e60429ea2340fb49ddf9dc6eb79594f
2025-01-23 09:03:46 -08:00
Samuel Susla 56a60601da add tests for TextInput.onChange and TextInput.onChangeText (#48899)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48899

changelog: [internal]

Add tests for `TextInput.onChange` and `TextInput.onChangeText`.

Reviewed By: rubennorte

Differential Revision: D68498998

fbshipit-source-id: 212bc251700b343f7290fb7e2a5f2ddfdb68dfd1
2025-01-23 08:59:13 -08:00
Iwo Plaza 7df73eebdc Migrated Libraries/WebSocket/* to export syntax. (#48884)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48884

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

## This diff
- Updates files in `Libraries/WebSocket` to use `export` syntax
- Appends `.default` to requires of the changed files.
- Updates mocks.
- Updates the public API snapshot (intented breaking change)

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

Reviewed By: cortinico

Differential Revision: D68554260

fbshipit-source-id: 90a660fe9e76b255171189101819253521354fda
2025-01-23 08:55:25 -08:00
Rubén Norte 8a2b44568d Partially restore feature flag to disable event loop on bridgeless (#48892)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48892

Changelog: [internal]

Reviewed By: javache, Abbondanzo

Differential Revision: D68557746

fbshipit-source-id: d94877d03dc6ea2bf6bca45da77a0a769fa0efeb
2025-01-23 08:12:35 -08:00
Ritesh Kumar Shukla 317f130267 Update info.ts (#48876)
Summary:
Found this while I was trying to make my own react native info for CI. For android Podfile.lock is being read instead of gradle.properties

## Changelog:

<!-- Help reviewers and the release process by writing your own changelog entry.

Pick one each for the category and type tags:
[INTERNAL][FIXED] - Fixed React native info where Podfile.lock was being read for android

For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests

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

Reviewed By: blakef

Differential Revision: D68553964

Pulled By: cortinico

fbshipit-source-id: 7d6391195dab0c2230fe86fb465de6d3f94ccbef
2025-01-23 07:19:55 -08:00
Riccardo Cipolleschi dab9b3b440 Stop generating the ReactCodegen.podspec in Cocoapods (#48815)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48815

In an effort to reduce the responsibility of Cocoapods in React Native, we are moving the generation of the Reactcodegen podspec from Cocoapods itself to the codegen infrastructure.

This reduce the responsibility of Cocoapods and allow us to migrate away from it with more ease.

## Changelog:
[iOS][Changed] - Generate the ReactCodegen.podspec as part of codegen instead of as part of pod install.

Reviewed By: cortinico

Differential Revision: D68418268

fbshipit-source-id: 004ac5b6b3563bf96cc38942f2b48b6f269541c3
2025-01-23 05:38:20 -08:00
Samuel Susla 3e29cbe1d0 add test for TextInput blut and focus (#48862)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48862

changelog: [internal]

Add simple tests that use new `Fantom.dispatchNativeEvent` and `Fantom.runOnUIThread`.

Reviewed By: rubennorte

Differential Revision: D68492472

fbshipit-source-id: 33537ed7a728c2cc01abdcc5aa178b3afa3779fa
2025-01-23 05:30:24 -08:00
Samuel Susla 864c34e9f6 add event category to Fantom.dispatchNativeEvent (#48855)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48855

changelog: [internal]

add event category argument to Fantom.dispatchNativeEvent.

This gives tests option to control whether an event is continuous, discrete etc.

Reviewed By: rubennorte

Differential Revision: D68413879

fbshipit-source-id: f0c365df505a325440693ca7c3408dd612614946
2025-01-23 04:02:06 -08:00
Ruslan Lesiutin 8a586f2fa1 Move setUpReactDevTools to InitializeCore (#48871)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48871

# Changelog: [Internal]

Forward-fixing D68380665.

Requirements:
- `setUpReactDevTools` should be called before `setUpErrorHandling` to avoid React DevTools mutating `console.error` call arguments.
- `setUpReactDevTools` should be called after `setUpTimers`, because it is using `queueMicrotask`, see https://fb.workplace.com/groups/rn.panelapps/permalink/1120810879540337/.
- `setUpTimers` should be called after `polyfillPromise`, because it uses on `global.Promise`.

I went over bundles, which are not using `InitializeCore` and using either `setUpErrorHandling` or `setUpDeveloperTools` and updated their order of initialization accordingly.

Reviewed By: javache

Differential Revision: D68510100

fbshipit-source-id: 4331dcc7a7cb1dc438ca2ed5ccae49e736c41b2a
2025-01-22 22:06:43 -08:00
David Vacca c5af75294a Migrate SurfaceHandlerBinding to kotlin (#48870)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48870

Migrate SurfaceHandlerBinding to kotlin

changelog: [internal] internal

Reviewed By: cortinico

Differential Revision: D68480893

fbshipit-source-id: a326d2646212598ded962d25cb8d1caf7a2ed6aa
2025-01-22 22:06:37 -08:00
Tim Yung d1028885ee Back out "Fix app lagging while attempting a connection to Metro"
Summary: Reverts {D68023397}

Reviewed By: Abbondanzo

Differential Revision: D68522537

fbshipit-source-id: 1c331969fea898fdee06dd988f86c5e1f034684f
2025-01-22 15:12:57 -08:00
David Vacca 159fc9922c Migrate FabricUIManagerProviderImpl to kotlin (#48869)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48869

Migrate FabricUIManagerProviderImpl to kotlin

changelog: [internal] internal

Reviewed By: tdn120, cortinico

Differential Revision: D68480341

fbshipit-source-id: bf0f548230f9c8bcba07fe32a1fde5d9a1d72550
2025-01-22 13:20:37 -08:00
Joe Vilches 98b0991128 Allow text links to be navigatable via keyboard by default (#48773)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48773

This diff contains 2 fixes with regards to clickable text accessibility on Android.

1. It allows nested `Text` links to be accessible via keyboard. The accessibility here is a bit unique. The clickable text is not focused in the classical since that Android provides on `View`s (after all, the part being focused is not even a `TextView`. Its a `Span` in a `TextView`). However, it is [selected](https://developer.android.com/reference/android/widget/TextView#setSelected(boolean)), and pressing enter while it is selected will press the text, so for all intents and purposes it is focused. Some quirks here, though, are that you cannot press tab to cycle through the links in text, you have to use arrow keys. And the arrow keys no longer let you move around to the next item (as they are stuck being used to navigate the links). I *could* override this behavior but I do not see much of a point as long as one can actually get to everything on screen in a semi-logical way. Anyway, the fix here is using [`LinkMovementMethod`](https://developer.android.com/reference/android/text/method/LinkMovementMethod) to navigate between clickable spans, which is exactly what that class exists for. Note that I override this class so that touching the links does not actually highlight them like you see in the videos.
2. In the case we state update and remove the "click-ability" of the text, this diff makes it so that Explore By Touch no longer can focus on the link. The code was in the same area so I decided to just lump that together :P

Changelog: [Android] [Fixed] - Allow text links to be navigable via keyboard by default

Reviewed By: javache

Differential Revision: D68306316

fbshipit-source-id: a72145f6b60caf2a8077e1bd2ca987bdde0b82ab
2025-01-22 12:16:14 -08:00
Samuel Susla 4d96467954 add payload to Fantom.dispatchNativeEvent (#48794)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48794

changelog: [internal]

Add payload argument to Fantom.dispatchNativeEvent. For example, in `TextInput.onChange` event, new value of input field must be present in the event payload.

Reviewed By: rubennorte

Differential Revision: D68410469

fbshipit-source-id: eb915f9f961efdfe9902f060173072c6259b7eea
2025-01-22 12:16:11 -08:00
Chi Tsai 7b0f83165e Fix unicode character usage in windows tests (#48840)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48840

MSVC unicode handling is causing our windows test to fail. To fix,
simply replace the special characters with the their explicit UTF-16
encoding.

Changelog: [Internal]

Reviewed By: neildhar

Differential Revision: D68466808

fbshipit-source-id: 1bfc689972e1e5862fe6525bc48d5ebc508a95da
2025-01-22 12:07:20 -08:00
David Vacca 2c50e7043b Implement prop diffing for nativeForegroundAndroid prop (#48834)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48834

Implement prop diffing for nativeForegroundAndroid prop

changelog: [internal] internal

Reviewed By: rshest

Differential Revision: D60001410

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

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

changelog: [internal] internal

Reviewed By: rshest

Differential Revision: D59972041

fbshipit-source-id: 171381744e0e695cbc144507fa86b2d2ef536c30
2025-01-22 12:07:06 -08:00
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