Commit Graph

38536 Commits

Author SHA1 Message Date
Krystof Woldrich cd78e39e2b feat(tm-android): TM SyncVoidKind methods throws JSError (#40788)
Summary:
Other RM Sync method calls do return JSError with the throwable information.

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

[ANDROID] [ADDED] - TM SyncVoidKind methods throws JSError

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

Test Plan:
Output of caught error `console.log(e, e.stack, e.cause);`

```js
 LOG  [Error: Exception in HostFunction: Intentional exception from JVM voidFuncThrows] Error: Exception in HostFunction: Intentional exception from JVM voidFuncThrows
    at voidFuncThrows (native)
    at voidFuncThrows (http://10.0.2.2:8081/js/examples/TurboModule/SampleTurboModuleExample.bundle//&platform=android&lazy=true&app=com.facebook.react.uiapp&modulesOnly=true&dev=true&minify=false&runModule=true&shallow=true:100:127)
    at onPress (http://10.0.2.2:8081/js/examples/TurboModule/SampleTurboModuleExample.bundle//&platform=android&lazy=true&app=com.facebook.react.uiapp&modulesOnly=true&dev=true&minify=false&runModule=true&shallow=true:235:71)
    at _performTransitionSideEffects (http://10.0.2.2:8081/js/RNTesterApp.android.bundle//&platform=android&dev=true&lazy=true&minify=false&app=com.facebook.react.uiapp&modulesOnly=false&runModule=true:67991:22)
    at _receiveSignal (http://10.0.2.2:8081/js/RNTesterApp.android.bundle//&platform=android&dev=true&lazy=true&minify=false&app=com.facebook.react.uiapp&modulesOnly=false&runModule=true:67941:45)
    at onResponderRelease (http://10.0.2.2:8081/js/RNTesterApp.android.bundle//&platform=android&dev=true&lazy=true&minify=false&app=com.facebook.react.uiapp&modulesOnly=false&runModule=true:67784:34)
    at apply (native)
    at invokeGuardedCallbackProd (http://10.0.2.2:8081/js/RNTesterApp.android.bundle//&platform=android&dev=true&lazy=true&minify=false&app=com.facebook.react.uiapp&modulesOnly=false&runModule=true:4727:21)
    at apply (native)
    at invokeGuardedCallback (http://10.0.2.2:8081/js/RNTesterApp.android.bundle//&platform=android&dev=true&lazy=true&minify=false&app=com.facebook.react.uiapp&modulesOnly=false&runModule=true:4903:42)
    at apply (native)
    at invokeGuardedCallbackAndCatchFirstError (http://10.0.2.2:8081/js/RNTesterApp.android.bundle//&platform=android&dev=true&lazy=true&minify=false&app=com.facebook.react.uiapp&modulesOnly=false&runModule=true:4917:36)
    at executeDispatch (http://10.0.2.2:8081/js/RNTesterApp.android.bundle//&platform=android&dev=true&lazy=true&minify=false&app=com.facebook.react.uiapp&modulesOnly=false&runModule=true:4994:48)
    at executeDispatchesInOrder (http://10.0.2.2:8081/js/RNTesterApp.android.bundle//&platform=android&dev=true&lazy=true&minify=false&app=com.facebook.react.uiapp&modulesOnly=false&runModule=true:5016:26)
    at executeDispatchesAndRelease (http://10.0.2.2:8081/js/RNTesterApp.android.bundle//&platform=android&dev=true&lazy=true&minify=false&app=com.facebook.react.uiapp&modulesOnly=false&runModule=true:7640:35)
    at executeDispatchesAndReleaseTopLevel (http://10.0.2.2:8081/js/RNTesterApp.android.bundle//&platform=android&dev=true&lazy=true&minify=false&app=com.facebook.react.uiapp&modulesOnly=false&runModule=true:7647:43)
    at forEach (native)
    at forEachAccumulated (http://10.0.2.2:8081/js/RNTesterApp.android.bundle//&platform=android&dev=true&lazy=true&minify=false&app=com.facebook.react.uiapp&modulesOnly=false&runModule=true:5610:22)
    at runEventsInBatch (http://10.0.2.2:8081/js/RNTesterApp.android.bundle//&platform=android&dev=true&lazy=true&minify=false&app=com.facebook.react.uiapp&modulesOnly=false&runModule=true:7660:27)
    at runExtractedPluginEventsInBatch (http://10.0.2.2:8081/js/RNTesterApp.android.bundle//&platform=android&dev=true&lazy=true&minify=false&app=com.facebook.react.uiapp&modulesOnly=false&runModule=true:7693:25)
    at anonymous (http://10.0.2.2:8081/js/RNTesterApp.android.bundle//&platform=android&dev=true&lazy=true&minify=false&app=com.facebook.react.uiapp&modulesOnly=false&runModule=true:7734:42)
    at batchedUpdates$1 (http://10.0.2.2:8081/js/RNTesterApp.android.bundle//&platform=android&dev=true&lazy=true&minify=false&app=com.facebook.react.uiapp&modulesOnly=false&runModule=true:20049:20)
    at batchedUpdates (http://10.0.2.2:8081/js/RNTesterApp.android.bundle//&platform=android&dev=true&lazy=true&minify=false&app=com.facebook.react.uiapp&modulesOnly=false&runModule=true:7616:36)
    at dispatchEvent (http://10.0.2.2:8081/js/RNTesterApp.android.bundle//&platform=android&dev=true&lazy=true&minify=false&app=com.facebook.react.uiapp&modulesOnly=false&runModule=true:7705:23)
{"message": "Intentional exception from JVM voidFuncThrows", "name": "java.lang.RuntimeException", "stackElements": [{"className": "com.facebook.fbreact.specs.SampleTurboModule", "fileName": "SampleTurboModule.java", "lineNumber": 186, "methodName": "voidFuncThrows"}, {"className": "com.facebook.jni.NativeRunnable", "fileName": "NativeRunnable.java", "lineNumber": -2, "methodName": "run"}, {"className": "android.os.Handler", "fileName": "Handler.java", "lineNumber": 958, "methodName": "handleCallback"}, {"className": "android.os.Handler", "fileName": "Handler.java", "lineNumber": 99, "methodName": "dispatchMessage"}, {"className": "com.facebook.react.bridge.queue.MessageQueueThreadHandler", "fileName": "MessageQueueThreadHandler.java", "lineNumber": 27, "methodName": "dispatchMessage"}, {"className": "android.os.Looper", "fileName": "Looper.java", "lineNumber": 205, "methodName": "loopOnce"}, {"className": "android.os.Looper", "fileName": "Looper.java", "lineNumber": 294, "methodName": "loop"}, {"className": "com.facebook.react.bridge.queue.MessageQueueThreadImpl$4", "fileName": "MessageQueueThreadImpl.java", "lineNumber": 234, "methodName": "run"}, {"className": "java.lang.Thread", "fileName": "Thread.java", "lineNumber": 1012, "methodName": "run"}]}
```

Reviewed By: cortinico

Differential Revision: D50169068

Pulled By: javache

fbshipit-source-id: 3a7b5e44fc69e3b8747b12c524c717904c4e808f
2023-10-11 09:12:53 -07:00
Ivan Alexandrov 265af222aa Fix android platform border color (#39893)
Summary:
If you try to apply PlatformColor to borders on Android app will crash with the next error:

"Error while updating property 'borderColor' of a view managed by: RCTView"

## Changelog:

[ANDROID] [FIXED] - Fix android crash when apply PlatformColor to borders

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

Test Plan:
In RNTester example, go to APIs -> PlatformColor
|    Before  | After |
| ----------- | ----------- |
|  <img src="https://github.com/facebook/react-native/assets/70860930/66ac2880-53da-4438-bd9a-332f8ea40645" alt="drawing" width="200"/>    | <img src="https://github.com/facebook/react-native/assets/70860930/151f58a1-d857-4b3d-9ec6-de74eb065127" alt="drawing" width="200"/>      |

Reviewed By: NickGerleman

Differential Revision: D50011758

Pulled By: javache

fbshipit-source-id: ea06c18c6aef4b6731e9b9b87422a1e0d13de208
2023-10-11 08:47:23 -07:00
Alex Hunt f40bb9331c Bump package versions for next major (#39764)
Summary:
#publish-packages-to-npm

Bump all package versions to `0.74.0` (next major release) for `main`, following instructions at https://reactnative.dev/contributing/release-branch-cut-and-rc0#12-bump-minor-version-of-all-monorepo-packages-in-main.

```sh
yarn bump-all-updated-packages --release-branch-cutoff
```

Changelog: [Internal]

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

Test Plan: —

Reviewed By: robhogan

Differential Revision: D49871039

Pulled By: huntie

fbshipit-source-id: f4df6efeae4d8a9209e7aae7b9e6fea3d15793b5
2023-10-11 08:36:23 -07:00
Kacper Kafara bc63e44b23 Purge children from view registry when UIManager is invalidated (#38617)
Summary:
Talking about Paper & iOS here.

In standard RN applications when a native component is removed permanently from view hierarchy [it is invalidated (if it implements `RCTInvalidating`)](https://github.com/facebook/react-native/blob/e64756ae5bb5c0607a4d97a134620fafcb132b3b/packages/react-native/React/Modules/RCTUIManager.m#L483-L495). Components that implement `RCTInvalidating` such as [`RNSScreenView`](https://github.com/software-mansion/react-native-screens/blob/9fb3bd00850bcdf29b46daa57e56eabda3ae30ea/ios/RNSScreen.mm#L35) of [`react-native-screens`](https://github.com/software-mansion/react-native-screens) library rely on `RCTInvalidating#invalidate` method being called in adequate moment to release retained resources (in my case the `RNSScreenView` holds a strong reference to it's view controller preventing it from being garbage collected).

However in case of brownfield applications (React Native is used only for a particular view & loaded on demand, see: https://github.com/software-mansion/react-native-screens/issues/1754 for discussion & app example) when view controller holding `RCTRootView` is dismissed and whole `React Native` managed view / controller tree gets deallocated, `RCTInvalidating#invalidate` method is not called on the dismissed components, thus in my particular use case, leading to memory leak.

Right now I've added call to `RCTUIManager#_purgeChildren:fromRegistry:` (which internally invalidates all components which implement `RCTInvalidating`) in `RCTUIManager#invalidate`.

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

[IOS][FIXED] - Purge children from view registry on `RCTUIManager` invalidation.

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

Test Plan:
You can run the [demo](https://github.com/mkondakov/RNSScreensMemoryLeak) provided in the [issue](https://github.com/software-mansion/react-native-screens/issues/1754).

Following screenshots show that memory leak in brownfield application is resolved.

Without the change (`invalidate` method is not being called on native components)

![image](https://github.com/facebook/react-native/assets/50801299/dac331c2-1e7c-4e66-a8c1-b88f7a007d9b)

With the change:

![image](https://github.com/facebook/react-native/assets/50801299/7a8afbe9-446c-47a2-a972-d7589b921677)

Reviewed By: NickGerleman

Differential Revision: D49952215

Pulled By: javache

fbshipit-source-id: 6336b86774615acc40279c97e6ae0bb777bda8ad
2023-10-11 07:31:57 -07:00
generatedunixname89002005325672 3859eee961 Daily arc lint --take KTFMT
Reviewed By: 0x1eaf

Differential Revision: D50164739

fbshipit-source-id: a3a03735eaea41d3e7e04a73b210c6347ebd078e
2023-10-11 06:05:17 -07:00
Riccardo Cipolleschi c279db78c4 Bump RNTester Cocoapods cache keys after SocketRocket 6.1.0 bump (#40789)
Summary:
Commit 8b88883071 broke the Cache for RNTester because the cached version of the pods does not know about the exitence of SocketRocket 6.1.0
Bumping the keys should force a redownload of the cocoapods specs repo

## Changelog:
[Internal] - Bump RNTester cache keys

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

Test Plan: CircleCI is green

Reviewed By: GijsWeterings

Differential Revision: D50169281

Pulled By: cipolleschi

fbshipit-source-id: 83e251495bfa43d62384470efe97c5505d76684f
2023-10-11 05:02:08 -07:00
Gabriel Donadel 8b88883071 Bump SocketRocket to 0.6.1 (#40774)
Summary:
The SocketRocket version was upgraded to 0.6.1 on the 0.72-stable branch but for some reason it was not updated in main, causing a downgrade when running `pod install` with 0.73.0 RC1

Original commit bumping SocketRocket -> https://github.com/facebook/react-native/commit/8ce471e2fa802cc50ff2d6ab346627cb5f6d79b4

## Changelog:

[IOS] [CHANGED] - Bump SocketRocket to 0.6.1

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

Test Plan: Run rntester locally

Reviewed By: cipolleschi

Differential Revision: D50137261

Pulled By: arushikesarwani94

fbshipit-source-id: dfc2760f5d5611881126ad114d8f6ada23630a29
2023-10-11 02:18:19 -07:00
Phillip Pan 9f51a0c59d hook up unstable_enableSyncVoidMethods to ReactFeatureFlags (#39988)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39988

Changelog: [Internal]

in this pr, we integrate the sync void configuration with our feature flag infra

Reviewed By: luluwu2032

Differential Revision: D50030743

fbshipit-source-id: 03505e5e1f74aa90dc16f33fa4e93f9de9660dae
2023-10-10 22:39:59 -07:00
Phillip Pan 2e16785424 introduce unstable_enableSyncVoidMethods config (#39989)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39989

Changelog: [Internal]

we need some configuration path to turn on the sync void method execution behavior, doing that here

Reviewed By: luluwu2032

Differential Revision: D50028200

fbshipit-source-id: a2501b622685e4bafa5e2a5031275cc8bc5050b7
2023-10-10 22:39:59 -07:00
Phillip Pan b41a2f92ae introduce logic to invoke sync void method (#39970)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39970

Changelog: [Internal]

in this diff, i add the logic that makes void return values run synchronously

Reviewed By: javache

Differential Revision: D49613770

fbshipit-source-id: ef840fb3ee130430505d000a7cf74e094f9d1405
2023-10-10 22:39:59 -07:00
Christoph Purrer 4e92f609af rntester Android > Don't call rncore_ModuleProvider(name, params) twice (#40758)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/40758

This is a follow up to https://github.com/facebook/react-native/pull/39987?fbclid=IwAR3qXLYUtfGSg81CpfDZFAwlnOb2J0zcJb1Wpc9ikLtd_9w2FUDovD6Xwx8

As we already call
```
  return rncore_ModuleProvider(name, params);
```
in:
https://github.com/facebook/react-native/blob/main/packages/react-native/ReactAndroid/src/main/jni/react/newarchdefaults/DefaultTurboModuleManagerDelegate.cpp#L55

we don't have to do it again in:
https://github.com/facebook/react-native/blob/main/packages/rn-tester/android/app/src/main/jni/OnLoad.cpp#L53

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D50109991

fbshipit-source-id: eeb5af739f4dbf4bf45a21a13eec44ae772db7c4
2023-10-10 17:43:37 -07:00
Christoph Purrer 9e3d466c48 Add rn-tester Android BUCK configuration (#39987)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39987

Changelog: [Internal]

Reviewed By: fkgozali

Differential Revision: D49983211

fbshipit-source-id: c362d5b93e159bfb5ca17bea0ec0484adcdb4dca
2023-10-10 17:03:55 -07:00
David Vacca b13ea1786f Remove deprecation of onCatalystInstanceDestroy (#40777)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/40777

In this diff I'm removing the deprecation of NativeModule.onCatalystInstanceDestroy() method, changing it to DeprecatedInNewArchitecture

changelog: [Android][Breaking] Mark NativeModule.onCatalystInstanceDestroy() method as deprecated in new architecture

Reviewed By: christophpurrer

Differential Revision: D50141027

fbshipit-source-id: a4c4911bdadc27f981f3af0522317e6dd08d9344
2023-10-10 16:16:56 -07:00
David Vacca 7a31ecd665 Introduce BaseReactPackage class (#40775)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/40775

In this diff I'm introducing the BaseReactPackage class to the public API of React Native Android. the goal is for this class to replace TurboReactPackage, which will be Deprecated in the New Architecture

changelog: [internal] internal

Reviewed By: christophpurrer

Differential Revision: D50128456

fbshipit-source-id: a65e1eb0d81b94e442799226784f73f489eabb73
2023-10-10 15:43:48 -07:00
Pieter De Baets 7b7f128968 Support NativeState in JSC (#40746)
Summary:
X-link: https://github.com/facebook/hermes/pull/1151

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

This feature was missing in JSC's JSI implementation, which is preventing from rolling out NativeState-based features in React Native.

Changelog: [General][Added] JSC support for the NativeState API in JSI

Reviewed By: neildhar

Differential Revision: D49229022

fbshipit-source-id: 1787c1d1b4803212d84da8f55b7d5a460a9d33c2
2023-10-10 12:44:27 -07:00
Mauricio Guzman 28b089ed3a Update PerspectiveTransform type (#40771)
Summary:
Very simple change, there's a typo in the word "perspective" whilst naming the possible transform property types.

## Changelog:

[INTERNAL] [FIXED] - Fix typo in PerspectiveTransform type

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

Test Plan: -

Reviewed By: javache

Differential Revision: D50133297

Pulled By: arushikesarwani94

fbshipit-source-id: bd742b1bccc5d015e5e8095b1d2b83765fee3d6b
2023-10-10 12:12:53 -07:00
Riccardo Cipolleschi 9c5ceeaf99 Make the Fabric Interop layer work in Bridgeless (#40732)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/40732

This change allows the Fabric Interop Layer to work in bridgeless mode.

Given that the legacy components requires a Bridge to send events and use commands, this change simulates a bridge when it doesn't exists (i.e.: we are in bridgeless mode).

In order to make it work, we had to simulate a few elements from the Bridge and the UIManager.

## Changelog:
[iOS][Fixed] - Make the Fabric interop layer works in bridgeless mode.

## Facebook:
As an alternative approach, we could have created a `protocol RCTBridging`, have the `RCTBridge` conform to that protocol, and create a new type for it.
Practically this would have been much more cumbersome:
1. The [RCTBridge](https://www.internalfb.com/code/fbsource/[916531b9bf7a9943036807f7563c925b4c3e0101]/xplat/js/react-native-github/packages/react-native/React/Base/RCTBridge.h?lines=87-238) interface is quite big. All the props and method should be part of the protocol.
2. Extensions declared on RCTBridge would not have worked. For example, [`RCTBridge (RCTUIManager)`](https://www.internalfb.com/code/fbsource/[916531b9bf7a9943036807f7563c925b4c3e0101]/xplat/js/react-native-github/packages/react-native/React/Modules/RCTUIManager.h?lines=170-174).
3. It would require a major overhaul of the APIs, returning `id<RCTBridging>` in place of **every** function that takes/return an instance of `RCTBridge *`.

Clearly, not a feasible way to go.

Reviewed By: RSNara

Differential Revision: D50079929

fbshipit-source-id: 77d4370e9043c8e06b676bff3987511c042b0f9c
2023-10-10 11:45:38 -07:00
Nick Gerleman c40fc313ca Fix iOS Paper Scroll Event RTL check (#40751)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/40751

In D48379915 I fixed inverted `contentOffset` in `onScroll` events on iOS. I thought I tested on Paper, but I think this was during a period where the Paper route in Catalyst was actually launching Fabric (oops).

In Paper, at least under `forceRTL` and English, `[UIApplication sharedApplication].userInterfaceLayoutDirection` is not set to RTL. We instead have a per-view `reactLayoutDirection` we should be reading.

This sort of thing isn't currently set on Fabric, which checks application-level RTL. This seems... not right with being able to set `direction` in a subtree context, but Android does the same thing, and that would take some greater changes.

Changelog:
[iOS][Fixed] - Fix iOS Paper Scroll Event RTL check

Reviewed By: luluwu2032

Differential Revision: D50098310

fbshipit-source-id: e321fca7b2f7983e903e23237bc2d604c72f98a3
2023-10-10 11:43:14 -07:00
Nick Gerleman 22a7b8dd37 Remove code to support bottom-up layout events in horizontal RTL (#39646)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39646

We can dramatically simplify this code and remove quirks/hacks, now that we can assume layout events are always fired top down.

Changelog: [Internal]

Reviewed By: yungsters

Differential Revision: D49628669

fbshipit-source-id: 7de5bbc4597eba1c59aaa7672c70e76d2786c7ef
2023-10-10 11:43:14 -07:00
Nick Gerleman 56ddace9c8 Deterministic onLayout event ordering for iOS Paper (#40748)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/40748

The ordering of `onLayout` events is non-deterministic on iOS Paper, due to nodes being added to an `NSHashTable` before iteration, instead of an ordered collection.

We don't do any lookups on the collection, so I think this was chosen over `NSMutableArray` for the sake of `[NSHashTable weakObjectsHashTable]`, to avoid retain/release. Using a collection which does retain/release seems to cause a crash due to double release or similar, so those semantics seem intentional (though I'm not super familiar with the model here).

We can replicate the memory semantics with ordering by using `NSPointerArray` (which is unfortunately not parameterized). This change does that, so we get consistently top-down layout events (matching Fabric, and Android Paper as of D49627996). This lets us use multiple layout events to calculate right/bottom edge insets deterministically.

Changelog:
[iOS][Changed] -  Deterministic onLayout event ordering for iOS Paper

Reviewed By: luluwu2032

Differential Revision: D50093411

fbshipit-source-id: f6a9d5c973b97aede879baa8b952cc1be2447f28
2023-10-10 11:43:14 -07:00
Riccardo Cipolleschi 5c2ec558c1 Fix functions that turn on the New Architecture (#40770)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/40770

## Changelog:
[Internal] - Fix functions that turn on the New Architecture

Reviewed By: cortinico

Differential Revision: D50084427

fbshipit-source-id: aae0c77585929eacf8e890321e27e5049e53775e
2023-10-10 10:16:29 -07:00
Fabrizio Cucci b1356fe0d6 Remove stale task/comment in FabricUIManager (#40768)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/40768

The task referenced is 4 years old and it doesn't seem to be relevant anymore given that:
* `addRootView` has been marked as deprecated
* there is an explicit check in `addRootView` mentioning:

> Do not call addRootView in Fabric; it is unsupported. Call startSurface instead

Changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D50122192

fbshipit-source-id: fe02d481b47663f5bdf4fb7527e480117f00be47
2023-10-10 09:41:56 -07:00
Alex Hunt 9e068ac163 Add --experimental-debugger-frontend flag, restore 0.72 flow as base (#40766)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/40766

This changeset allows users to opt into the new debugger frontend experience by passing `--experimental-debugger` to `react-native start`. **We are defaulting this option to `true`** for now, but will continue to evaluate this feature before 0.73 ships. It restores Flipper (via `flipper://`) as the default handling for `/open-debugger` (matching 0.72 behaviour) when this flag is not enabled.

Detailed changes:

- Replaces `enableCustomDebuggerFrontend` experiment in `dev-middleware` with `enableNewDebugger`. The latter now hard-swaps between the Flipper and new launch flows.
    - Removes now-unused switching of `devtoolsFrontendUrl`.
- Implements `deprecated_openFlipperMiddleware` (matching previous RN CLI implementation).
- Disables "`j` to debug" key handler by default.
- Marks "`j` to debug" and `/open-debugger` console logs as experimental.

Changelog:
[Changed][General] Gate new debugger frontend behind `--experimental-debugger` flag, restore Flipper as base launch flow

Reviewed By: motiz88

Differential Revision: D50084590

fbshipit-source-id: 5234634f20110cb7933b1787bd2c86f645411fff
2023-10-10 09:37:41 -07:00
Alex Hunt 4dcd5f1065 Type serve-static and document /debugger-frontend (#40765)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/40765

Types based on https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/serve-static/index.d.ts.

Changelog: [Internal]

Reviewed By: motiz88

Differential Revision: D50084591

fbshipit-source-id: 92fd833d90dfc5acbd3be0476f1da34e5742a732
2023-10-10 09:37:41 -07:00
Pieter De Baets 44f5989c3b Mark AsyncCallback as noexcept (#40745)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/40745

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D49886196

fbshipit-source-id: 6b4fa888f6cffbf7863167396d13c4a00bf485a2
2023-10-10 06:57:39 -07:00
Rubén Norte 5cec1eaabf Make most modules in Image flow strict-local (#40728)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/40728

Just improving type safety of a bunch of modules in the `Image` directory.

Changelog: [internal]

Reviewed By: NickGerleman

Differential Revision: D50080136

fbshipit-source-id: cbfb89aa01cad3882aa08a8ba637e561017d5db6
2023-10-10 05:18:33 -07:00
Rubén Norte 62714b002d Simplify definition of Image component decorator (#40730)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/40730

This way of injecting the decorator is safer and more convenient to have the proper types inferred by Flow in the injected function.

Changelog: [internal]

Reviewed By: NickGerleman

Differential Revision: D50011840

fbshipit-source-id: 760812fc407d3e39fc7601d17488e3f2032a7065
2023-10-10 05:18:33 -07:00
Rubén Norte 7345a5e7c2 Make Image component flow strict-local (#40729)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/40729

This improves the type definition of the `Image` modules (the common module interface, the platform-specific implementations and the shared types module). It makes them `flow strict-local` and explicitly defines the type signature of some functions typed as `any` before.

Changelog: [internal]

Reviewed By: sullenor

Differential Revision: D50014569

fbshipit-source-id: f1eced43edf84c84bbcb10a3a2d2de27e3d5e374
2023-10-10 05:18:33 -07:00
Rubén Norte cee78c79eb Refactor type definitions for image component (#40731)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/40731

The type definitions for `Image` are unnecessarily complicated, and got even more complicated after the changes for the new multiplatform support in Flow.

We had a `Image.js.flow` and a `Image.flow.js` files (which was confusing) and duplicated type definitions in `Image.js.flow`, `Image.android.js` and `Image.ios.js` because all type definitions in the shared module signature must be defined in the platform-specific modules as well.

This moves all type helpers to a new `ImageTypes.js.flow` file, simplifies the common `Image` module interface (to only define the default export type that the platform-specific module must define) and simplifies the Android and iOS specific versions.

As an added benefit, this also improves Flow type coverage by removing a bunch of FlowFixMe comments.

Changelog: [internal]

Reviewed By: mdvacca

Differential Revision: D50011839

fbshipit-source-id: 9da1c0467630bebf73855f5f9f771a2325adbced
2023-10-10 05:18:33 -07:00
Riccardo Cipolleschi ec45af127a Align Podfile.lock with the right versions on main (#40744)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/40744

The Podfile.lock was not aligned properly with the versions of the Pods on main.

## Changelog:
[Internal] - Align the Podfile.lock with the status of podspecs on main

Reviewed By: luluwu2032

Differential Revision: D50084954

fbshipit-source-id: 1cfad35262b2b57ad9ac33f494c7a2f0b723368f
2023-10-10 03:20:40 -07:00
Sunbreak 39bbf8c53c Remove i386 arch check for Hermes (#40656)
Summary:
Since https://github.com/facebook/react-native/commit/21763e85e39e17a19a1cf7a9026ef74517464749, `min_ios_version_supported` is `13.4`. So `i386` is no longer supported as `iOS`(maybe tvOS) target architecture

## Changelog:

[IOS] [INTERNAL] - remove exclude_i386_architecture_while_using_hermes

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

Test Plan: None

Reviewed By: cortinico

Differential Revision: D50117517

Pulled By: cipolleschi

fbshipit-source-id: 774faf82c4cfae45d77d37e471fb883ad775e5cc
2023-10-10 03:19:26 -07:00
Luis Miguel Alvarado 04c501fa4a refactor: removed Object.es8 {entries, values} from js polyfills (#40747)
Summary:
Both `hermes` and `JSC` supports `Object.{values & entries}`, so this polyfills aren't used any more.

## Changelog:
[GENERAL][REMOVED]: removed `Object.{values & entries}` from polyfills

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

Test Plan:
1. We can confirm with `hermes` tests: https://github.com/facebook/hermes/blob/main/test/hermes/object-functions.js#L256
2. Remove this polyfills and check that the code runs as expected.
3. You can also run: `console.log(Object.entries.toString());`  and verify that this is `[native code]`

Reviewed By: christophpurrer

Differential Revision: D50100639

Pulled By: robhogan

fbshipit-source-id: b1cea88bd984e99f304a3a063e985eecff8831dd
2023-10-10 01:12:15 -07:00
David Vacca b7191cde4e Move TurboModule from com.facebook.react.turbomodule -> com.facebook.react.internal.turbomodule (#39682)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39682

Move TurboModule from com.facebook.react.turbomodule -> com.facebook.react.internal.turbomodule

bypass-github-export-checks

changelog: [internal] internal

Reviewed By: RSNara

Differential Revision: D49523696

fbshipit-source-id: fee155f4fb7acf0f28f900c79f7aa38074bec0e6
2023-10-09 19:24:19 -07:00
xSyki 9295b9caa8 Fix react.dev docs urls (#40095)
Summary:
All "https://react.dev/link" links give a 404 and are deprecated. I replaced all URLs with new ones or, if this was not possible, replaced them with a link to legacy documentation.

## Changelog:

[INTERNAL] [FIXED] - Fixed links to React documentation

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

Test Plan: All of the old links didn't work. I tried to match the content of the errors to the new documentation as best as possible. Current links have been tested and direct you to the most relevant article section.

Reviewed By: christophpurrer

Differential Revision: D50094451

Pulled By: arushikesarwani94

fbshipit-source-id: 79fd9e729495cadfb067d94fb58acb30ca308347
2023-10-09 17:26:37 -07:00
Lorenzo Pieri 89c7be890b Add typings for dismissActionSheet method (#40012)
Summary:
This pull request addresses two key issues. Firstly, it adds a missing docstring to the `dismissActionSheet` function within the `ActionSheetIOS` object. Secondly, it introduces TypeScript typings for the `dismissActionSheet` function.

## Changelog:

[iOS] [Added] - Add missing docstring to the `dismissActionSheet` function in `ActionSheetIOS`.
[iOS] [Added] - Add TypeScript typings for the `dismissActionSheet` function in `ActionSheetIOS`.

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

Test Plan:
To ensure the code is solid, I followed these steps:

1. Ran Flow to verify that there were no errors.
2. Added a TypeScript test related to the `dismissActionSheet` function to ensure it's typed as expected.

Reviewed By: NickGerleman

Differential Revision: D50097458

Pulled By: arushikesarwani94

fbshipit-source-id: 63348239dfe19e3a07f94e5a7b59ae43a47c1975
2023-10-09 17:16:27 -07:00
Luis Miguel Alvarado ea88fbe229 fix(jest): added sdks dir to testPathIgnorePatterns to prevent hermes specific tests to run (#40734)
Summary:
When we download the `hermes` repo, we also include its tests, so `jest` try to run them.

## Changelog:

[INTERNAL][FIXED]: don't run `hermes` specific tests.

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

Test Plan:
1. Build the project
2. yarn test
3. See the failing tests running from the `sdks` directory.

Reviewed By: arushikesarwani94

Differential Revision: D50087482

Pulled By: robhogan

fbshipit-source-id: 012672d69c98d8b8e60012d83470cda45edc2fc6
2023-10-09 15:30:00 -07:00
David Vacca be1c3cb3ca Reduce visibility of FrescoBasedReactTextInlineImageSpan
Summary:
In an attempt to reduce footprint of React Native Android public APIs we are reducing visibility of classes and interfaces that are not meant to be used publicly OR are public but have no usages.
As part of our analysis, which involved looking for usages inside the Meta codebase and code search in OSS, we've detected that this class/interface is public but it's not used from other packages.

If you are using this class or interface please comment in this PR and we will restate the public access.

bypass-github-export-checks

changelog: [Android][Changed] Reducing visibility of FrescoBasedReactTextInlineImageSpan

Reviewed By: arushikesarwani94

Differential Revision: D49803287

fbshipit-source-id: 1b00fbcf5f61af96fe7a182d40b985b7ce71a872
2023-10-09 15:00:18 -07:00
David Vacca f158939efa Reduce visibility of FrescoBasedReactTextInlineImageShadowNode
Summary:
In an attempt to reduce footprint of React Native Android public APIs we are reducing visibility of classes and interfaces that are not meant to be used publicly OR are public but have no usages.
As part of our analysis, which involved looking for usages inside the Meta codebase and code search in OSS, we've detected that this class/interface is public but it's not used from other packages.

If you are using this class or interface please comment in this PR and we will restate the public access.

bypass-github-export-checks

changelog: [Android][Changed] Reducing visibility of FrescoBasedReactTextInlineImageShadowNode

Reviewed By: arushikesarwani94

Differential Revision: D49803295

fbshipit-source-id: 9273607af351b85800e37800941039ccf10eef76
2023-10-09 15:00:18 -07:00
David Vacca e96cbcc4dc Reduce visibility of RefreshEvent
Summary:
In an attempt to reduce footprint of React Native Android public APIs we are reducing visibility of classes and interfaces that are not meant to be used publicly OR are public but have no usages.
As part of our analysis, which involved looking for usages inside the Meta codebase and code search in OSS, we've detected that this class/interface is public but it's not used from other packages.

If you are using this class or interface please comment in this PR and we will restate the public access.

bypass-github-export-checks

changelog: [Android][Changed] Reducing visibility of RefreshEvent

Reviewed By: arushikesarwani94

Differential Revision: D49803298

fbshipit-source-id: f8edfd256b3afc82bb02789b34748abb3132cce1
2023-10-09 15:00:18 -07:00
David Vacca 05064dc660 Reduce visibility of VelocityHelper
Summary:
In an attempt to reduce footprint of React Native Android public APIs we are reducing visibility of classes and interfaces that are not meant to be used publicly OR are public but have no usages.
As part of our analysis, which involved looking for usages inside the Meta codebase and code search in OSS, we've detected that this class/interface is public but it's not used from other packages.

If you are using this class or interface please comment in this PR and we will restate the public access.

bypass-github-export-checks

changelog: [Android][Changed] Reducing visibility of VelocityHelper

Reviewed By: arushikesarwani94

Differential Revision: D49803269

fbshipit-source-id: 6b9dcf39979c8b4da5f736ba4fce3d495245755d
2023-10-09 15:00:18 -07:00
David Vacca a81481cb0c Reduce visibility of ReactScrollViewAccessibilityDelegate
Summary:
In an attempt to reduce footprint of React Native Android public APIs we are reducing visibility of classes and interfaces that are not meant to be used publicly OR are public but have no usages.
As part of our analysis, which involved looking for usages inside the Meta codebase and code search in OSS, we've detected that this class/interface is public but it's not used from other packages.

If you are using this class or interface please comment in this PR and we will restate the public access.

bypass-github-export-checks

changelog: [Android][Changed] Reducing visibility of ReactScrollViewAccessibilityDelegate

Reviewed By: arushikesarwani94

Differential Revision: D49803288

fbshipit-source-id: 5a4d9e7feda26501c8a82a0efb0ad28ff68a3157
2023-10-09 15:00:18 -07:00
David Vacca 88a4be378f Reduce visibility of MaintainVisibleScrollPositionHelper
Summary:
In an attempt to reduce footprint of React Native Android public APIs we are reducing visibility of classes and interfaces that are not meant to be used publicly OR are public but have no usages.
As part of our analysis, which involved looking for usages inside the Meta codebase and code search in OSS, we've detected that this class/interface is public but it's not used from other packages.

If you are using this class or interface please comment in this PR and we will restate the public access.

bypass-github-export-checks

changelog: [Android][Changed] Reducing visibility of MaintainVisibleScrollPositionHelper

Reviewed By: arushikesarwani94

Differential Revision: D49803271

fbshipit-source-id: ebc43e60dea8de5ef5c21deb623351e0c8ed00b7
2023-10-09 15:00:18 -07:00
David Vacca 0d0e0e1b53 Reduce visibility of ScaleTypeStartInside
Summary:
In an attempt to reduce footprint of React Native Android public APIs we are reducing visibility of classes and interfaces that are not meant to be used publicly OR are public but have no usages.
As part of our analysis, which involved looking for usages inside the Meta codebase and code search in OSS, we've detected that this class/interface is public but it's not used from other packages.

If you are using this class or interface please comment in this PR and we will restate the public access.

bypass-github-export-checks

changelog: [Android][Changed] Reducing visibility of ScaleTypeStartInside

Reviewed By: arushikesarwani94

Differential Revision: D49803276

fbshipit-source-id: 11ea67cc976a09634293219d0c0933036f34b6ff
2023-10-09 15:00:18 -07:00
David Vacca 9582f98099 Reduce visibility of ReactImageDownloadListener
Summary:
In an attempt to reduce footprint of React Native Android public APIs we are reducing visibility of classes and interfaces that are not meant to be used publicly OR are public but have no usages.
As part of our analysis, which involved looking for usages inside the Meta codebase and code search in OSS, we've detected that this class/interface is public but it's not used from other packages.

If you are using this class or interface please comment in this PR and we will restate the public access.

bypass-github-export-checks

changelog: [Android][Changed] Reducing visibility of ReactImageDownloadListener

Reviewed By: arushikesarwani94

Differential Revision: D49803289

fbshipit-source-id: 19d4c3403449dd9b928963b274362662375b7545
2023-10-09 15:00:18 -07:00
David Vacca fa1a29bdc0 Reduce visibility of ReactEventEmitter
Summary:
In an attempt to reduce footprint of React Native Android public APIs we are reducing visibility of classes and interfaces that are not meant to be used publicly OR are public but have no usages.
As part of our analysis, which involved looking for usages inside the Meta codebase and code search in OSS, we've detected that this class/interface is public but it's not used from other packages.

If you are using this class or interface please comment in this PR and we will restate the public access.

bypass-github-export-checks

changelog: [Android][Changed] Reducing visibility of ReactEventEmitter

Reviewed By: arushikesarwani94

Differential Revision: D49803292

fbshipit-source-id: 5c49555ce35ad10ee46bc3db3bc3bc83d8486a0d
2023-10-09 15:00:18 -07:00
David Vacca aa4490df11 Reduce visibility of YogaNodePool
Summary:
In an attempt to reduce footprint of React Native Android public APIs we are reducing visibility of classes and interfaces that are not meant to be used publicly OR are public but have no usages.
As part of our analysis, which involved looking for usages inside the Meta codebase and code search in OSS, we've detected that this class/interface is public but it's not used from other packages.

If you are using this class or interface please comment in this PR and we will restate the public access.

bypass-github-export-checks

changelog: [Android][Changed] Reducing visibility of YogaNodePool

Reviewed By: arushikesarwani94

Differential Revision: D49803281

fbshipit-source-id: 092826dcd4b7c9858240b760e87eb87a32e54a25
2023-10-09 15:00:18 -07:00
David Vacca 0316f8d117 Reduce visibility of ViewHierarchyDumper
Summary:
In an attempt to reduce footprint of React Native Android public APIs we are reducing visibility of classes and interfaces that are not meant to be used publicly OR are public but have no usages.
As part of our analysis, which involved looking for usages inside the Meta codebase and code search in OSS, we've detected that this class/interface is public but it's not used from other packages.

If you are using this class or interface please comment in this PR and we will restate the public access.

bypass-github-export-checks

changelog: [Android][Changed] Reducing visibility of ViewHierarchyDumper

Reviewed By: arushikesarwani94

Differential Revision: D49803266

fbshipit-source-id: e6a3f5f915975979759b7134a486d96db974703d
2023-10-09 15:00:18 -07:00
David Vacca e2aae65dd4 Reduce visibility of ShadowNodeRegistry
Summary:
In an attempt to reduce footprint of React Native Android public APIs we are reducing visibility of classes and interfaces that are not meant to be used publicly OR are public but have no usages.
As part of our analysis, which involved looking for usages inside the Meta codebase and code search in OSS, we've detected that this class/interface is public but it's not used from other packages.

If you are using this class or interface please comment in this PR and we will restate the public access.

bypass-github-export-checks

changelog: [Android][Changed] Reducing visibility of ShadowNodeRegistry

Reviewed By: arushikesarwani94

Differential Revision: D49803275

fbshipit-source-id: a2796a1e125f0399418aa56cce6eafe7c0509eeb
2023-10-09 15:00:18 -07:00
David Vacca 4f6a74438d Reduce visibility of NoSuchNativeViewException
Summary:
In an attempt to reduce footprint of React Native Android public APIs we are reducing visibility of classes and interfaces that are not meant to be used publicly OR are public but have no usages.
As part of our analysis, which involved looking for usages inside the Meta codebase and code search in OSS, we've detected that this class/interface is public but it's not used from other packages.

If you are using this class or interface please comment in this PR and we will restate the public access.

bypass-github-export-checks

changelog: [Android][Changed] Reducing visibility of NoSuchNativeViewException

Reviewed By: arushikesarwani94

Differential Revision: D49803297

fbshipit-source-id: d2c3e6a2243f6c80db0658c81c44c2d2bbedab5b
2023-10-09 15:00:18 -07:00
David Vacca e65c9f1227 Delete unused code in JavaModuleWrapper (#39822)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39822

Delete unused code in JavaModuleWrapper

changelog: [internal] internal

Reviewed By: philIip

Differential Revision: D49930343

fbshipit-source-id: f74704e6c0fc5ef4470e4327107c11bc78a01f5f
2023-10-09 14:28:03 -07:00