Commit Graph

12270 Commits

Author SHA1 Message Date
Christoph Purrer 70bacfe098 Turbo Module EventEmitter registration must return void or Promise<void> (#45267)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45267

Changelog: [Internal] Turbo Module EventEmitter registration must return void or Promise<void>

Differential Revision: D59333197

fbshipit-source-id: 461dbcb23e0ebb1c145123bf785587b06a3d6c34
2024-07-03 20:51:14 -07:00
Nick Gerleman 95d9cdf228 Fix "Platform.constants.reactNativeVersion.prerelease" Flow and TypeScript types (#45256)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45256

The actual stamped versions here are all strings.

Android interface for constants is untyped, and we always return a string here. iOS, we will try to parse the string into a double, which will fail for every prerelease version RN has ever published.

Platform on Windows seems to uniquely be doing the right thing.

Changelog:
[General][Fixed] - Fix Platform.constants.reactNativeVersion type

Reviewed By: robhogan, necolas

Differential Revision: D59141948

fbshipit-source-id: 9c758e5eb8796b03197258d87ec06b31018e211c
2024-07-03 13:51:59 -07:00
Andrew Coates 2939dfc208 Add config version, and invalidate layout on config change (#45259)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45259

This is a continuation of the previous PR: https://github.com/facebook/react-native/pull/45047

I made the change more generic for allowing any kind of config change to invalidate layout.

Changelog: [Internal]

X-link: https://github.com/facebook/yoga/pull/1674

Reviewed By: rozele

Differential Revision: D59286992

Pulled By: NickGerleman

fbshipit-source-id: f46f35b03d5d9a743b798844ee3e1a02c271ccde
2024-07-03 12:46:18 -07:00
Alex Hunt 47bff1f49b Fix reactNativeVersion string in inspector metadata on iOS (#45266)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45266

Changelog: [Internal]

Reviewed By: hoxyq

Differential Revision: D59279156

fbshipit-source-id: b1ef0273b14e964a7413724f6d382f7a00be103e
2024-07-03 11:12:31 -07:00
Alex Hunt 09bfb68a39 Add appDisplayName to inspector host metadata (#45250)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45250

Adds and implements a new `appDisplayName` field as part of `HostTargetMetadata` and the `ReactNativeApplication.metadataUpdated` CDP event.

This will be used to display the app display name in the debugger frontend.

Changelog: [Internal]

Reviewed By: robhogan

Differential Revision: D59273360

fbshipit-source-id: d770cccadb520b9c13c7288cd690df21683d2cc1
2024-07-03 11:12:31 -07:00
Alex Hunt 9da07d70dc Implement new HostTargetMetadata fields (Android Bridgeless) (#45249)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45249

Follows D58288489, D58415181.

Implements the remaining `HostTargetMetadata` fields, sent by the debugger on `ReactNativeApplication.metadataUpdated`, on **Android Bridgeless**.

This will be used to display details such as the app name and React Native version in the debugger frontend.

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D59271755

fbshipit-source-id: a2488fed98df0800ec0a611d2317cd40cd809aac
2024-07-03 11:12:31 -07:00
Alex Hunt 297ccf325f Implement new HostTargetMetadata fields (Android Bridge) (#45234)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45234

Follows D58288489.

Implements the remaining `HostTargetMetadata` fields, sent by the debugger on `ReactNativeApplication.metadataUpdated`, on **Android Bridge** (Bridgeless to follow).

This will be used to display details such as the app name and React Native version in the debugger frontend.

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D58415181

fbshipit-source-id: 8aca707c0b9f6e933ac5e5b4ac47ba8d48e99241
2024-07-03 11:12:31 -07:00
Nick Gerleman 3af01a8a44 Fix default for showsHorizontalScrollIndicator and showsVerticalScrollIndicator (#45258)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45258

Setting this to false, then removing, will not reset back to default state of `true`. Add explicit defaults so that the absence of the prop will lead to scroll indicators always being shown.

Changelog:
[Android][Fixed] - Fix default for `showsHorizontalScrollIndicator` and `showsVerticalScrollIndicator`

Reviewed By: javache

Differential Revision: D59285745

fbshipit-source-id: 6a7c204cfe9c4ab9e4efbbda300cdfdaf57e8f37
2024-07-03 10:05:13 -07:00
Nick Gerleman d028a68026 Ship set_android_layout_direction by default (#45257)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45257

This doesn't seem to be regressing anything, so let's ship it!

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D58959236

fbshipit-source-id: af6ae5d9145160f5a567e99b5d8db2a4d19a080b
2024-07-03 09:28:27 -07:00
Cedric van Putten 30a3e6e8df refactor(dev-middleware): drop node-fetch in favor of Node built-in fetch (#45227)
Summary:
Node 22 doesn't work well with `node-fetch@2`, as one of their polyfills is using the deprecated `punycode` module. This causes unnecessary warnings like:

<img width="986" alt="image" src="https://github.com/facebook/react-native/assets/1203991/13f66c5b-b6f4-4894-8576-ca9631d93f77">

Instead of upgrading to the [much larger `node-fetch@3`](https://packagephobia.com/result?p=node-fetch%403.3.2), this change drops `node-fetch` in favor of Node's own built-in `fetch` implementation (using [undici](https://github.com/nodejs/undici#readme)).

> Note, `react-native/dev-middleware` [already has the `engines.node >= 18`](https://github.com/facebook/react-native/blob/c7988c9c82793b6b41d4c9190a28ce1202410fa0/packages/dev-middleware/package.json#L38-L40) (which is required for fetch).

## Changelog:

[GENERAL] [CHANGED] - Drop `node-fetch` in favor of Node's built-in fetch from `undici` in `react-native/dev-middleware`

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

Test Plan: See CI for passing tests

Reviewed By: NickGerleman

Differential Revision: D59202017

Pulled By: robhogan

fbshipit-source-id: 15da5d5602e63958b8a3dc581dc1512649f16c12
2024-07-03 09:14:02 -07:00
Håkon Knutzen b1ec698dc4 Fix data race related to RCTNetworkTask.status (#44694)
Summary:
Fix entails using non-synthesized getter, such that underlying backing is an std::atomic<RCTNetworkTaskStatus>.

In the greater scheme of things, I believe `RCTNetworkTask` should be improved as it has several `nonatomic` properties that are read and written to on different threads. Thread safety of this class seems to have been addressed on a per property basis, judging from the employment of `std::mutex` elsewhere in the implementation.

This is an attempt at fixing https://github.com/facebook/react-native/issues/44687.

## Changelog:

[iOS][FIXED] - Fix data race related to access on `RCTNetworkTask.status`.

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

Test Plan: Added unit test in class `RCTNetworkTaskTests`.

Reviewed By: cortinico

Differential Revision: D59217353

Pulled By: javache

fbshipit-source-id: 1af77238ddd99db21e2e53f174a81e207d5832b2
2024-07-03 08:22:26 -07:00
Rubén Norte 8db2995934 Add missing invocation of item dispatch listeners when forcing batching of mount items on Android (#45264)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45264

Changelog: [internal]

We added a flag to fix some issues when committing state updates synchronously from the main thread in https://github.com/facebook/react-native/pull/44015 but that implementation was incorrectly not invoking item dispatch listeners after mount.

This adds the missing logic so we can unblock shipping sync state updates.

Reviewed By: javache

Differential Revision: D59319230

fbshipit-source-id: b0ab7e7c79a3315ef29dbb024e62c10444192509
2024-07-03 05:01:02 -07:00
Sam Zhou 3c6762a5f8 Pre-suppress errors ahead of v0.239 release
Summary: Changelog: [Internal]

Reviewed By: mvitousek

Differential Revision: D59308716

fbshipit-source-id: d741ee004e153810fc913da96505706e43814ec1
2024-07-02 23:37:15 -07:00
Joe Vilches c247e8c8c9 Fix case where absolute nodes would sometimes not be cloned (#45240)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45240

X-link: https://github.com/facebook/yoga/pull/1675

There was a bug where some crash would happen if a tree was cloned that had static/absolute parent/child pair inside it. This was because we were no longer calling `cloneChildrenIfNeeded` on the static parent, but would still layout the absolute child. So that child's owner would be stale and have new layout. In React Native this would lead to a failed assert which causes the crash.

The fix here is to clone the children of static nodes during `layoutAbsoluteDescendants` so that we guarantee the node is either cloned if it is going to have new layout.

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D59175629

fbshipit-source-id: 4d110a08ba5368704327d5ab69a8695b28e746f4
2024-07-02 15:14:33 -07:00
Thomas Nardone 0ba2e9adf2 Prevent View Preallocation (#45163)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45163

Avoid view preallocation when rendering on the main thread

Changelog: [Internal]

Reviewed By: rubennorte

Differential Revision: D58833983

fbshipit-source-id: a942d1fac684be5a8073941dbf043ba1d738e3a0
2024-07-02 14:16:32 -07:00
Joe Vilches d99960744c Inset box shadow impl (#45242)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45242

tsia, comments should explain how this works but tldr is

* Set up cropping region to only draw within the view's bounds
* Draw 2 offscreen rects to cast the shadow. One represents the bounds of the original view, the other represents the clear region. Fill these rects with EO fill algo so the intersection is clear. The disjoint will be colored and cast a shadow.
* Do that for each shadow in reverse order

Changelog: [Internal]

bypass-github-export-checks

Reviewed By: lenaic

Differential Revision: D58885576

fbshipit-source-id: 2f3a5de75e93c7d34676128bbddbe38d64f1fb59
2024-07-02 13:44:58 -07:00
Joe Vilches a3cf1624d0 Outset box shadow impl
Summary:
tisa. Algo is

* Draw offscreen rect the size of the outset shadow (so accounting for spread)
* Set g state to cast shadow in proper place ON screen
* Clear out region in view

The rects need to be offscreen for the following reasons
* We need to account for spread radius, and CGContext shadows do not have support for this. So the only way to create a bigger shadow is the create a path that is the same size as the shadow we want
* We cannot just position this rect onscreen with no offset (so the shadow is casting directly under it) since the blur will look unnatural
* Offscreen means we do not see filled shadow rect but we do see the shadow it casts by offsetting it in the proper location

Changelog: [Internal]

Reviewed By: lenaic

Differential Revision: D58881588

fbshipit-source-id: 2ea1b8945a3b9f182c4fb11668ac91a0ae7846ca
2024-07-02 13:44:58 -07:00
Joe Vilches 24d7cc15db Parse raw box shadow props (#44882)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44882

tsia, nothing too fancy here. Just taking the box shadows from raw props and throwing them into a struct so we can read it.

Changelog: [Internal]

bypass-github-export-checks

Reviewed By: NickGerleman

Differential Revision: D57617028

fbshipit-source-id: 29cf683b663b4903721d674efbf61a200eaf3a64
2024-07-02 13:44:58 -07:00
Christoph Purrer 3fc7ebb311 Don't include C++ bridging header in RCTTurboModule.h (#45251)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45251

https://github.com/facebook/react-native/pull/44914 is causing some iOS build breaks

## Changelog:

[iOS] [Changed] - Don't include C++ bridging header in RCTTurboModule.h

Reviewed By: cortinico

Differential Revision: D59280331

fbshipit-source-id: 489bc94ee0e5073129205370245c0093c0754f58
2024-07-02 11:26:11 -07:00
Wojciech Dróżdż 27ba369f23 Add onUserLeaveHint support to ReactActivityDelegate (#43658)
Summary:
**This is a resubmission of the previous PRs. We are trying to figure out why it causes crashes in some apps.**

This PR adds `onUserLeaveHint` support into the `ReactActivityDelegate`. It allows modules to receive an event every time user moves the app into the background. This is slightly different than `onPause` - it's called only when the user intentionally moves the app into the background, e.g. when receiving a call `onPause` should be called but `onUserLeaveHint` shouldn't.

This feature is especially useful for libraries implementing features like Picture in Picture (PiP), where using `onUserLeaveHint` is the [recommended way of auto-entering PiP](https://developer.android.com/develop/ui/views/picture-in-picture#:~:text=You%20might%20want%20to%20include%20logic%20that%20switches%20an%20activity%20into%20PiP%20mode%20instead%20of%20going%20into%20the%20background.%20For%20example%2C%20Google%20Maps%20switches%20to%20PiP%20mode%20if%20the%20user%20presses%20the%20home%20or%20recents%20button%20while%20the%20app%20is%20navigating.%20You%20can%20catch%20this%20case%20by%20overriding%20onUserLeaveHint()%3A) for android < 12.

## Changelog:

[ANDROID] [ADDED] - Added `onUserLeaveHint` support into `ReactActivityDelegate`

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

Test Plan: Tested in the `rn-tester` app - callbacks are correctly called on both old and new architecture.

Reviewed By: javache

Differential Revision: D56015911

Pulled By: cortinico

fbshipit-source-id: fc41af30f697da6fe7db3dd6e579a702f90cf218
2024-07-02 10:43:29 -07:00
Rubén Norte e35a2f4a7c Set up experiment to fix incorrect state updates in smooth scroll animations on Android (#45237)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45237

Changelog: [internal]

This creates a feature flag to test a fix for an incorrect state update dispatched to Fabric when using smooth scroll animations.

Specifically, when starting a smooth scroll animation from X to Y, the scroll view would set the state to Y, and then all the range from X to Y again. For example, the sequence of state updates when smooth scrolling from 0 to 5 would be `0 -> 5 -> 1 -> 2 -> 3 -> 4 -> 5`, which is obviously incorrect.

This flag prevents setting the final value before it's actually reached.

Reviewed By: javache

Differential Revision: D59233069

fbshipit-source-id: 221602d7d30635070e7776ce756e2ef438edf638
2024-07-02 07:58:37 -07:00
Rubén Norte 818e70f7eb Set up experiment to fix race conditions when doing Fabric state updates on Android (#45236)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45236

Changelog: [internal]

## Context

We're currently observing inconsistencies between the state of the UI on Android and the propagated state in Fabric.

When investigating the issue, we saw that there are some state updates that were going to be dispatched from scroll views to Fabric were skipped because the state object in native was deallocated.

The reason for that is a race condition between:
1. Dispatching new state updates from the UI thread
2. Updating the state previously dispatched from the UI thread on the JS thread.

 {F1735383134}

## Changes

This creates a new feature flag to replace the weak reference with a strong one, so when the previous state is deallocated we can still access it to set new state.

The use of weak references was introduced in D44472121 to avoid holding onto JSI references (which could be contained in the state) when the runtime was deallocated, but we later introduced an explicit clean up mechanism in D45905628 that would make that unnecessary.

Reviewed By: javache

Differential Revision: D59233070

fbshipit-source-id: 018d8935f506430ecab96df0f7a998a37ee0f556
2024-07-02 07:58:37 -07:00
Nicola Corti c25246044f Migrate test_js to GHA (#45246)
Summary:
This migrates the `test_js` workflow to GHA

## Changelog:

[INTERNAL] - Migrate test_js to GHA

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

Test Plan: Will wait for CI

Reviewed By: javache

Differential Revision: D59270333

Pulled By: cortinico

fbshipit-source-id: e77eb9819e0819638c51e61b1e477ac04680a2f4
2024-07-02 05:17:33 -07:00
Wojciech Lewicki 54dadd7bda fix: add JvmStatic to all methods used in cpp (#45243)
Summary:
Following-up on https://github.com/facebook/react-native/pull/45230, I added all the needed `JvmStatic` annotations for methods used in cpp code here: https://github.com/facebook/hermes/blob/f5c867514c71b25212eb3039230e0c095518b532/lib/Platform/Unicode/PlatformUnicodeJava.cpp.

## Changelog:

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

Pick one each for the category and type tags:

[ANDROID] [FIXED] - Use `JvmStatic` annotations for all methods from `AndroidUnicodeUtils.kt`

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

[ANDROID] [FIXED] - Use `JvmStatic` annotations for all methods from `AndroidUnicodeUtils.kt`

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

Test Plan: Try and use those methods to see that they don't crash on `cpp` side.

Reviewed By: cortinico

Differential Revision: D59264093

Pulled By: dmytrorykun

fbshipit-source-id: 07d683ee38ea1c7d9621ad2e37d04f3d484d3200
2024-07-02 02:40:49 -07:00
Christoph Purrer ad3df84668 Add EventEmitter Code-gen support for Java and ObjC Turbo Modules (#45119)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45119

## Changelog:

[iOS][Added] - Add EventEmitter Code-gen support for Java and ObjC Turbo Modules

Reviewed By: RSNara

Differential Revision: D58929417

fbshipit-source-id: 5208ba5ecb5882d47c3827c2aa8e3a54a3d7f2b6
2024-07-01 14:42:46 -07:00
Pieter De Baets 9d3052378a Revert D59107105: Merge newarchdefaults jni target into fabric and turbomodule targets
Differential Revision:
D59107105

Original commit changeset: fb3b25f3ce45

Original Phabricator Diff: D59107105

fbshipit-source-id: 2197d1deb79e7fc9b3ac7b0772225e13c23e0001
2024-07-01 12:47:24 -07:00
Christoph Purrer f473a2f8f4 Add ObjC Turbo Module Event Emitter example (#44914)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44914

Shows a proof of concept how '*strongly typed Turbo Module scoped*' `EventEmitters` can be used in a ObjC Turbo Module.

## Changelog:

[iOS] [Added] - Add ObjC Turbo Module Event Emitter example

Reviewed By: rshest

Differential Revision: D57650830

fbshipit-source-id: c5c2dee4766484e9e58415e33c084999a9ae3bc6
2024-07-01 09:36:51 -07:00
Pieter De Baets 8b121c5071 Use RAII for cleaning up global_refs in JavaTurboModule (#45218)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45218

Noticed that when an exception occurred we would not cleanup global_refs, leaking them in the global table.

Restructure this to use RAII and rely on JNIArgs to do the cleanup as necessary.

Changelog: [Android][Internal]

Reviewed By: RSNara

Differential Revision: D59156494

fbshipit-source-id: c89552d72387bad2a120373e78a2c545415a7c82
2024-07-01 09:16:25 -07:00
Pieter De Baets c68f35d444 Merge newarchdefaults jni target into fabric and turbomodule targets (#45207)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45207

These are their own shared library, and their own soloader-call, but they can easily be pulled into existing targets without causing excessive bloat.

Changelog: [Android][Removed] react_newarchdefaults is no longer a prefab, instead use fabricjni

Reviewed By: christophpurrer

Differential Revision: D59107105

fbshipit-source-id: fb3b25f3ce4511aa18126477f2beefe1292c6d09
2024-07-01 07:28:42 -07:00
Pieter De Baets de7976c69d Remove unused hybrid class from DefaultComponentsRegistry (#45205)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45205

We only need a static register method, which includes the core components and the provider function. CoreComponentsRegistry isn't referenced at all in Kotlin/Java, and can be replaced with DefaultComponentsRegistry with no change in behaviour in all scenarios.

Changelog: [Android][Removed] CoreComponentsRegistry is now fully replaced by DefaultComponentRegistry.

Reviewed By: cortinico

Differential Revision: D59107106

fbshipit-source-id: e679be490f43dab52eb5e11a08aa9d0ae2a89a92
2024-07-01 05:20:31 -07:00
Gabriel Donadel 20521cc908 Fix Android autolink plugin for libraries that are platform specific (#45223)
Summary:
Fixes https://github.com/facebook/react-native/issues/45222

## Changelog:

[ANDROID] [FIXED] - Fix autolink plugin for libraries that are platform-specific

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

Test Plan: And a library that does not have Android native code such as react-native-segmented-control/segmented-control and sync gradle

Reviewed By: rshest

Differential Revision: D59221562

Pulled By: cortinico

fbshipit-source-id: 55739d63ded63e46897d0d770281f937668c1f50
2024-07-01 05:05:23 -07:00
Nicola Corti cef17ba14f Fix crash due to missing @JvmStatic to convertToCase
Summary:
Users are reporting that RN 0.75 is crashing due to us attempting to accessing a static method
on `AndroidUnicodeUtils.convertToCase` which is not static anymore due to Kotlin conversion.

Static access is inside Hermes codebase here:
https://github.com/facebook/hermes/blob/f5c867514c71b25212eb3039230e0c095518b532/lib/Platform/Unicode/PlatformUnicodeJava.cpp#L107-L109

Changelog:
[Android] [Fixed] - Fix crash due to missing JvmStatic to `convertToCase`

Reviewed By: javache

Differential Revision: D59218291

fbshipit-source-id: ac121a8bcd5fd917ee134d257f967c8e3e338ca5
2024-07-01 03:32:14 -07:00
Blake Friedman c7988c9c82 Back out "remove @react-native-community dependencies" (#45225)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45225

Original commit changeset: f238e621c47d

Original Phabricator Diff: D58528447

Changelog: [Internal]

Reviewed By: arushikesarwani94

Differential Revision: D59174823

fbshipit-source-id: 3c6d74aea2fd6de7cfee8f1e4389db3d63da3c4d
2024-06-28 17:01:45 -07:00
Christoph Purrer ed5f558a6c Code-generate an optional base class to use for every NativeModule (#45113)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45113

## Changelog:

[iOS][Added] - Code-generate an optional base class to use for every NativeModule

Extend RN Code-gen to generate a NativeModule base class for each ObjC Turbo Modules.

Its usage is not mandatory now, but would become for future features to add

A practial first step would be to migrate

https://github.com/facebook/react-native/blob/main/packages/react-native/ReactCommon/react/nativemodule/core/platform/ios/ReactCommon/RCTTurboModule.h#L157-L160

from the `protocol` to the default `interface` and then provide a default implementation for it

Reviewed By: RSNara

Differential Revision: D58907395

fbshipit-source-id: a6b0ef97a5c7f5bb0c53a4cb6fd83d2e55306953
2024-06-28 13:29:15 -07:00
Blake Friedman d6e8c061cd fix: ios Helloworld assumes community cli is present (#45221)
Summary:
Use the hard-coded config for Helloworld instead of assuming the community cli is there to generate a config, which we can no longer assume.

Changelog: [Internal]

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

Test Plan:
This works in my local environment:
```
bundle exec pod install
```
and
```
./gradlew generateAutolinkingPackageList
```
Changelog: [Internal]

Reviewed By: javache

Differential Revision: D59162715

Pulled By: blakef

fbshipit-source-id: 95ff2c3929f12ee0ecf468cb80d2df1281eb746e
2024-06-28 12:05:14 -07:00
Christoph Purrer 84a9f5e6c8 Add Java Turbo Module Event Emitter example (#44906)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44906

Shows a proof of concept how '*strongly typed Turbo Module scoped*' `EventEmitters` can be used in a Java Turbo Module.

## Changelog:

[Android] [Added] - Add Java Turbo Module Event Emitter example

Reviewed By: javache

Differential Revision: D57530807

fbshipit-source-id: 04261d8885760f0e3b3c8c1931e0d56a5d33a0df
2024-06-28 09:41:02 -07:00
Håkon Knutzen dba25fa966 Data race related to reading/writing to AllocationTestModule.valid (#45191)
Summary:
The fix entails making `AllocationTestModule.valid` an Objective-C atomic property and funneling access to the ivar via the synthesized property getter and setter.

While the data race was present in test code, it would make it more difficult to spot more severe data races with the TSan. Also, getting rid of a data race is always good.

## Changelog:

[iOS][Fixed] - Data race related to access of `AllocationTestModule.valid`

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

Test Plan: `RCTAllocationTests` will test the implementation of `AllocationTestModule`.

Reviewed By: christophpurrer

Differential Revision: D59155083

Pulled By: javache

fbshipit-source-id: e3217cffd0801377a25f04bf8ed0b4e2d1d88498
2024-06-28 08:11:34 -07:00
Blake Friedman 9269429bb9 remove @react-native-community dependencies (#44928)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44928

The react-native-community/ dependencies aren't being explicitly included as part of the Framworks (RFC-0759) work.

Changelog: [General][Breaking] react-native isn't dependend on react-native-community/*

WARNING: Do not commit until we've cut 0.75, this goes in the 0.76 release only otherwise it'll break `npx react-native@latest init`.

Reviewed By: cortinico

Differential Revision: D58528447

fbshipit-source-id: f238e621c47df9e28b2e18f4137eb08e525052f6
2024-06-28 07:48:10 -07:00
Håkon Knutzen ffc16fc18b Fix data races in RCTImageLoader and RCTNetworkTask with shared atomic counters (#45114)
Summary:
In order to fix the data races described in https://github.com/facebook/react-native/issues/44715, I propose a simple solution by leveraging shared counter functions wherein `std::atomic` is the backing for the integer values.

## Changelog:

[iOS] [Fixed] - Implement shared atomic counters and replace static integers in `RCTImageLoader` and `RCTNetworkTask` that were accessed concurrently, which in some cases lead to data races.

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

Test Plan: Added unit tests for the counters in `RCTSharedCounterTests`.

Reviewed By: cipolleschi

Differential Revision: D59155076

Pulled By: javache

fbshipit-source-id: f73afce6a816ad3226ed8c123cb2ccf4183549a0
2024-06-28 07:37:45 -07:00
Alex Hunt 9833338b5d Support @//xplat/mode/no-react-fusebox (#45216)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45216

Buck modifications supporting the internal React Native DevTools (Fusebox) rollout.

Changelog: [Internal]

Reviewed By: motiz88

Differential Revision: D59154105

fbshipit-source-id: ba22a7f2f64d199b3e4e5a83ffa5036ae36b1a3b
2024-06-28 06:44:52 -07:00
Dmitry Rykun 5532e511af Systrace instrumentation for prop parsing (#45153)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45153

This diff adds more Systrace logging to the component create/update flow.
Changelog: [Internal]

Reviewed By: javache

Differential Revision: D56706472

fbshipit-source-id: c94445693694dfee43f1d46881fc1e18a507eb5e
2024-06-28 06:35:32 -07:00
Oskar Kwaśniewski c5653a03fb feat: add conditionals for iOS only code in RCTDeviceInfo.mm (#45176)
Summary:
Having React Native support every Apple platform is tough to achieve as it introduces many platform-specific ifdefs.

On the other side, maintaining an OOT platform fork is already a demanding job, so to make it easier I propose adding ifdefs for iOS-specific code. Thanks to this change, OOT platforms can focus on their OS-specific features while the core is also adding iOS-specific features behind ifdefs. Fortunately, **most of the code on Apple platforms can be shared** and this PR aims to introduce better support for this and to minimize OOT fork's surface.

In this example `RCTDeviceInfo.mm` has support for handling orientation changes and the availability of this feature across Apple OS looks as follows:

| Platform  | Support |
| ------------- | ------------- |
| macOS |    |
| tvOS |    |
| visionOS |    |
| iOS/iPadOS |    |

Here is a table from `TargetConditionals.h` header file which shows the coverage of `TARGET_OS_IOS` macro. (It supports both iOS and iPadOS)

![CleanShot 2024-06-26 at 11 51 47@2x](https://github.com/facebook/react-native/assets/52801365/5f7dc99a-72b8-46ce-87d4-896bdb017269)

## Changelog:

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

[INTERNAL] [ADDED] - Conditionals for iOS only code in RCTDeviceInfo.mm

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

Test Plan: CI Green

Reviewed By: christophpurrer

Differential Revision: D59106103

Pulled By: cipolleschi

fbshipit-source-id: 594a9d2451024baddfbc9cd3bc1ccfb8829fc31c
2024-06-28 06:02:38 -07:00
Kacper Rozniata c9d589dab5 fix(iOS): fix rendering RCTRedBoxExtraData (#43102)
Summary:
This PR fixes rendering of `RCTRedBoxExtraData`

I noticed that it wasn't displaying the `reload` and `dismiss` buttons, which made it impossible to close modal and to reload JS on e.g. `visionOS` (on `iOS` it could only be closed by swiping).

PR adds these buttons back and also introduces some refactoring

Before & After:

<img width="1118" alt="pr-img" src="https://github.com/facebook/react-native/assets/56474758/50e22499-9df0-45f0-84ac-2118ab7a8e6c">

## Changelog:

[IOS] [FIXED] - Fix rendering `RCTRedBoxExtraData`

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

Test Plan: Make sure that `RCTRedBoxExtraData`  displays and works as expected

Reviewed By: dmytrorykun

Differential Revision: D59108365

Pulled By: cipolleschi

fbshipit-source-id: b88c5665962d0280d68377863aa3346edfdf86b7
2024-06-28 05:58:01 -07:00
zhongwuzw 7698cd0953 Fixes Image load event in new arch (#44918)
Summary:
Fixes https://github.com/facebook/react-native/issues/44896. cc cipolleschi

## Changelog:

[IOS] [FIXED] - Fixes Image load event in new arch

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

Test Plan: https://github.com/facebook/react-native/issues/44896

Reviewed By: dmytrorykun

Differential Revision: D59108500

Pulled By: cipolleschi

fbshipit-source-id: 1fad4f82288141e9fc37f525be7073deb81c542c
2024-06-28 04:35:39 -07:00
imWildCat e320ab47cf fix the path of the script phase (#45208)
Summary:
Since 0.75-rc.x, I cannot run pod install because of an linking issue of react native firebase.

https://github.com/reactwg/react-native-releases/issues/341#issuecomment-2194568204

## Changelog:

[IOS][FIXED] Auto linking script of script phase

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

Test Plan: Full demo of this fix: <https://github.com/imWildCat-archived/react-native-075-rc2-regression-ios-linking-script-phase>

Reviewed By: christophpurrer

Differential Revision: D59125585

Pulled By: blakef

fbshipit-source-id: be96d3b207eff67c5e0d777203e7fc0d10103fc0
2024-06-27 16:14:59 -07:00
Saad Najmi a557a81f96 Remove [RCTConvert UIBarStyle:] (#44597)
Summary:
Resolves https://github.com/microsoft/react-native-macos/issues/2008

Followup to https://github.com/facebook/react-native/pull/42100 / https://github.com/facebook/react-native/commit/157cb0e02b6328e8b640f2b302a11c298a240493 , let's remove the deprecated RCTConvert method.

## Changelog:

[IOS] [REMOVED] - Remove `[RCTConvert UIBarStyle:]`

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

Test Plan: CI should pass

Reviewed By: christophpurrer

Differential Revision: D59128144

Pulled By: javache

fbshipit-source-id: 3e66422a7f4a139a6d68cbdfc6aae211ea239d4e
2024-06-27 16:07:57 -07:00
Tim Yung 1341169a4b RN: Remove forwardRef from ScrollView (#45197)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45197

With React 19, `forwardRef` is no longer necessary because `ref` is available on props. However, this only holds true for functional components — not class components.

This eliminates the `forwardRef` invocation in `ScrollView`, while retaining the wrapper component to map `ref` to `scrollViewRef` for the class component. For now...

Changelog:
[Internal]

Reviewed By: javache

Differential Revision: D59091873

fbshipit-source-id: 60afcd441aec82fa050738b5c09083f3a26378d6
2024-06-27 11:08:11 -07:00
Alex Hunt bfc51f97da Expose preprocessor flag/Buck constraint for Fusebox opt in (#45203)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45203

Configures a `REACT_NATIVE_ENABLE_FUSEBOX_DEBUG` flag, and exposes this flag in the Buck target via a [constraint setting](https://www.internalfb.com/intern/wiki/Buck-users/select-and-friends/#constraint-setting-and-c). This is an additional hook to enable the new debugger stack (codename Fusebox) as part of our internal rollout.

NOTE: This approach replaces D59014161 (reverted).

Changelog: [Internal]

Reviewed By: hoxyq

Differential Revision: D59109110

fbshipit-source-id: 7d23d9d402569b00d8dd17b9c8f3bcc108f0365f
2024-06-27 09:44:15 -07:00
Jorge Cabiedes Acosta eb9c388492 Update Filter header (#45151)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45151

This change was missed when fixing hue-rotate and adding drop-shadow. I believe the only issue with this was stacking context was not being created for these two filters.

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D58965245

fbshipit-source-id: e6bfdb738a8bc8caa878f60420cfe8b421f64aa4
2024-06-27 09:43:39 -07:00
Oskar Kwaśniewski 815c415fb9 refactor: supportedInterfaceOrientations method to use RCTKeyWindow() (#43026)
Summary:
This PR refactors `supportedInterfaceOrientations` to use RCTKeyWindow instead of `[RCTSharedApplication() keyWindow]`.

## Changelog:

[IOS] [CHANGED] - Refactor supportedInterfaceOrientations method to use RCTKeyWindow()

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

Test Plan: CI Green

Reviewed By: dmytrorykun

Differential Revision: D59109614

Pulled By: cipolleschi

fbshipit-source-id: 025534c419078dce29e1e5caacf8a1b15de1abcc
2024-06-27 07:58:50 -07:00