Skip to content

Conversation

Saadnajmi
Copy link
Collaborator

@Saadnajmi Saadnajmi commented Aug 3, 2024

Picking up from #2145, many thanks to @FalseLobster for the bulk of the work :)

Merge up to 0.74 branch cut (facebook@c99d96b)

This PR combines most of the work into the single large merge commit for a couple of reasons:

  1. To preserve git history with upstream React Native, we cannot "squash or rebase the commits. Therefore, we must do a merge commit.
  2. I am personally not a fan of committing git merge markers and resolving them in followup commits.

I did have a couple of extra commits after the merge commit for work that I feel could be separated out. I will do my best to list interesting changes in this merge, and what files to look at + what changes I made in those files. For a more "exhaustive" list, I also listed all files that had merge conflicts below. This isn't 100% of the changes (I touched some extra files for some lint fixes / shimming of UIView -> RCTPlatformView / RCTUIView) but it will get you a good 80-90%.

Summary:

Interesting upstream changes:

Each of these changes resulted in extra work to support macOS. See the original commit, which files were touched, and then how those files are diffed in this change.

  • facebook@1b85ed9 Moved RCTPushNotificationManager to use UNNotification APIs
  • facebook@3f621df RCTActionSheetManager was reworked for synchronous calls
  • facebook@e2eb26c RCTRedBox was reworked for iPad and orientation changes, the functionality of RCTRedBoxWindow was reworked into the new ViewController introduced upstream, RCTRedBoxController
  • facebook@0806ad7 Introduced a new stable id for the inspector dev server based on UUID which required a custom macOS implementation
  • facebook@4c108aa Added support to dynamic colors in Fabric

Other interesting changes:

  • Removed a lot of diffs around adding a scaleFactor to places where we manually calculate frames / sizes. With React Native 0.74, Yoga 3.0 introduces Per-Node PointScaleFactor, which is probably more accurate than the scale prop we added to RCTShadowView that keys off the main screen.
  • Reverted Create a RNTesterLoadAllPages integration test #356. This change added an integratiion test, and introduced a bunch of JS diffs. The test itself has since been disabled, many of the JS diffs were actually redundant (applying background colors in macOS only diffs that got overwritten by new styling that upstream changes added, etc), the test was not ported to new platforms (visionOS), and Integration tests in general are heading a different direction (Appium + WebdriverIO). I figured let's revert this and the diffs it introduced rather than fix the integration test
  • I had to manually ifdef out the dev menu PerfMonitor option as we haven't ported that to macOS yet. This presumably now because a problem as recent changes to bridgeless + removing diffs has changed which modules are loaded when. In this case, I think the PerfMonitor module is lazy loaded when you create the dev menu. Without the ifdef, we would Redbox every time we open the dev menu.
  • New lint rules did re-order a lot of imports in macOS specific packages like our local-cli. I also did my best to move macOS specific imports in JS files to a new line to make the diffs a little cleaner.
  • I had to implement RCTUITextView.selectedTextRange on macOS, as that started erroring in RNTester.

Todo:

  • Publish new version of virtualized-list package

Test Plan:

CI should pass. I encourage reviewers to check out and build RNTester as well.

List of merge conflicts.

Unmerged paths:
  (use "git add/rm <file>..." as appropriate to mark resolution)
	both modified:   Gemfile.lock
	both modified:   packages/community-cli-plugin/package.json
	both modified:   packages/metro-config/package.json
	both modified:   packages/normalize-color/package.json
	both modified:   packages/react-native/Libraries/Alert/NativeAlertManager.js
	both modified:   packages/react-native/Libraries/AppDelegate/RCTAppDelegate.h
	both modified:   packages/react-native/Libraries/AppDelegate/RCTAppDelegate.mm
	both modified:   packages/react-native/Libraries/Components/AccessibilityInfo/NativeAccessibilityManager.js
	deleted by them: packages/react-native/Libraries/Components/Button.flow.js
	both modified:   packages/react-native/Libraries/Components/Button.js
	both modified:   packages/react-native/Libraries/Components/ScrollView/ScrollView.js
	both modified:   packages/react-native/Libraries/Core/NativeExceptionsManager.js
	both modified:   packages/react-native/Libraries/Image/Image.ios.js
	both modified:   packages/react-native/Libraries/Image/RCTImageLoader.mm
	both modified:   packages/react-native/Libraries/NativeModules/specs/NativeDevSettings.js
	both modified:   packages/react-native/Libraries/PushNotificationIOS/NativePushNotificationManagerIOS.js
	both modified:   packages/react-native/Libraries/PushNotificationIOS/RCTPushNotificationManager.h
	both modified:   packages/react-native/Libraries/PushNotificationIOS/RCTPushNotificationManager.mm
	both modified:   packages/react-native/Libraries/Text/Text/RCTTextView.mm
	both modified:   packages/react-native/Libraries/Text/TextInput/RCTInputAccessoryViewManager.mm
	both modified:   packages/react-native/React-Core.podspec
	both modified:   packages/react-native/React/Base/RCTUtils.m
	both modified:   packages/react-native/React/CoreModules/RCTActionSheetManager.mm
	both modified:   packages/react-native/React/CoreModules/RCTAlertController.mm
	both modified:   packages/react-native/React/CoreModules/RCTAlertManager.mm
	both modified:   packages/react-native/React/CoreModules/RCTAppearance.mm
	both modified:   packages/react-native/React/CoreModules/RCTDevLoadingView.mm
	both modified:   packages/react-native/React/CoreModules/RCTDeviceInfo.mm
	both modified:   packages/react-native/React/CoreModules/RCTRedBox.mm
	both modified:   packages/react-native/React/CoreModules/RCTStatusBarManager.mm
	both modified:   packages/react-native/React/CoreModules/RCTTiming.mm
	both modified:   packages/react-native/React/CoreModules/React-CoreModules.podspec
	both modified:   packages/react-native/React/DevSupport/RCTInspectorDevServerHelper.mm
	both modified:   packages/react-native/React/Fabric/Mounting/ComponentViews/LegacyViewManagerInterop/RCTLegacyViewManagerInteropComponentView.mm
	both modified:   packages/react-native/React/Fabric/Mounting/ComponentViews/Modal/RCTModalHostViewComponentView.mm
	both modified:   packages/react-native/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.mm
	both modified:   packages/react-native/React/Fabric/Mounting/ComponentViews/Text/RCTParagraphComponentView.mm
	both modified:   packages/react-native/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm
	both modified:   packages/react-native/React/Fabric/RCTConversions.h
	both modified:   packages/react-native/React/Fabric/RCTSurfacePointerHandler.mm
	both modified:   packages/react-native/React/Fabric/RCTSurfacePresenter.mm
	both modified:   packages/react-native/React/Modules/RCTUIManager.m
	both modified:   packages/react-native/React/React-RCTFabric.podspec
	both modified:   packages/react-native/React/UIUtils/RCTUIUtils.m
	both modified:   packages/react-native/React/Views/RCTDebuggingOverlayManager.h
	both modified:   packages/react-native/React/Views/RCTModalHostViewController.m
	both modified:   packages/react-native/React/Views/RCTShadowView.m
	both modified:   packages/react-native/React/Views/ScrollView/RCTScrollViewManager.m
	both modified:   packages/react-native/ReactCommon/react/renderer/components/legacyviewmanagerinterop/RCTLegacyViewManagerInteropCoordinator.h
	both modified:   packages/react-native/ReactCommon/react/renderer/components/legacyviewmanagerinterop/RCTLegacyViewManagerInteropCoordinator.mm
	both modified:   packages/react-native/ReactCommon/react/renderer/core/ConcreteComponentDescriptor.h
	both modified:   packages/react-native/ReactCommon/react/renderer/graphics/platform/ios/react/renderer/graphics/RCTPlatformColorUtils.mm
	deleted by them: packages/react-native/ReactCommon/react/renderer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager/NSTextStorage+FontScaling.h
	both modified:   packages/react-native/ReactCommon/react/renderer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager/RCTTextPrimitivesConversions.h
	both modified:   packages/react-native/ReactCommon/react/renderer/uimanager/UIManager.cpp
	both modified:   packages/react-native/index.js
	both modified:   packages/react-native/package.json
	both modified:   packages/react-native/react-native.config.js
	both modified:   packages/react-native/scripts/cocoapods/helpers.rb
	both modified:   packages/react-native/scripts/cocoapods/jsengine.rb
	both modified:   packages/react-native/scripts/cocoapods/utils.rb
	both modified:   packages/react-native/third-party-podspecs/boost.podspec
	both modified:   packages/rn-tester/IntegrationTests/LayoutEventsTest.js
	both modified:   packages/rn-tester/NativeComponentExample/ios/RNTMyLegacyNativeViewManager.mm
	both modified:   packages/rn-tester/NativeComponentExample/ios/RNTMyNativeViewComponentView.h
	both modified:   packages/rn-tester/NativeComponentExample/ios/RNTMyNativeViewComponentView.mm
	both modified:   packages/rn-tester/NativeComponentExample/ios/RNTMyNativeViewManager.mm
	both modified:   packages/rn-tester/Podfile
	both modified:   packages/rn-tester/Podfile.lock
	both modified:   packages/rn-tester/RCTTest/FBSnapshotTestCase/FBSnapshotTestController.m
	both modified:   packages/rn-tester/RCTTest/FBSnapshotTestCase/UIImage+Compare.m
	both modified:   packages/rn-tester/RNTester/AppDelegate.mm
	deleted by them: packages/rn-tester/RNTester/RNTester.entitlements
	both modified:   packages/rn-tester/RNTesterPods.xcodeproj/project.pbxproj
	both modified:   packages/rn-tester/js/RNTesterApp.ios.js
	both modified:   packages/rn-tester/js/components/RNTesterBlock.js
	both modified:   packages/rn-tester/js/components/RNTesterModuleList.js
	both modified:   packages/rn-tester/js/examples/Accessibility/AccessibilityExample.js
	both modified:   packages/rn-tester/js/examples/Image/ImageExample.js
	both modified:   packages/rn-tester/js/examples/PlatformColor/PlatformColorExample.js
	both modified:   packages/rn-tester/js/examples/TextInput/TextInputExample.ios.js
	both modified:   packages/rn-tester/js/examples/TextInput/TextInputSharedExamples.js
	both modified:   packages/virtualized-lists/Lists/VirtualizedList.js
	both modified:   packages/virtualized-lists/Lists/VirtualizedListCellRenderer.js
	both modified:   packages/virtualized-lists/package.json
	deleted by them: scripts/__tests__/publish-npm-test.js
	deleted by them: scripts/monorepo/get-and-update-nightlies.js
	deleted by them: scripts/prepare-package-for-release.js
	deleted by them: scripts/publish-npm.js
	both modified:   scripts/releases/utils/release-utils.js
	both modified:   yarn.lock

generatedunixname89002005325672 and others added 30 commits January 31, 2024 09:36
Summary:
Pull Request resolved: facebook#42772

Changelog: [Internal]

Reviewed By: bigfootjon

Differential Revision: D53257696

fbshipit-source-id: f384899361215288a3c9578ae22c9f097c4a3201
)

Summary:
Pull Request resolved: facebook#42744

This adds a nightlies-feedback workflow, which our partners can get permission to mirror the results of their nightlies CI workflows.  We do this to use our internal tools that are restricted to Meta owned Github projects.

The benefit to partners is that they can add this step to their workflow:

```
      - if: ${{ success() || failure() }}
        env:
          OUTCOME: ${{ contains(steps.*.conclusion, 'failure') && 'fail' || 'pass' }}
        run: |
          curl -X POST \
               -H "Accept: application/vnd.github.v3+json" \
               -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
               https://api.github.com/repos/facebook/react-native/actions/workflows/nightlies-feedback.yml/dispatches \
               -d "$(printf '{"ref":"main","inputs":{"outcome":"%s","stage":"needs_an_action","link":"http://github.com/some/action","version":"%s"}}' "$OUTCOME" "${{ inputs.version }}" )"

```

### Feedback:
It's complicated, but there are ways to simplify this for our users.  I'd like to prove out that it's valuable first with Expo.

### Limits:

There's certainly a lot of room for improvement, which we could provide with a published action (populate the ref correctly, simplify gathering the outcome, labelling of failing step correctly, etc...).

### Changelog: [Internal]

Reviewed By: cipolleschi

Differential Revision: D53229996

fbshipit-source-id: 10e4ba5b5fd85935b1b03aaafa41ef8b96d2faca
Summary: Currently rejecting all users, use the [github.actor](https://docs.github.com/en/actions/learn-github-actions/contexts#github-context:~:text=The%20username%20of%20the%20user%20that%20triggered,run%20(github.triggering_actor)%20has%20different%20privileges.)

Reviewed By: hoxyq

Differential Revision: D53275232

fbshipit-source-id: 54bbbdb857db6c642814953832e0ffdc55505deb
Summary:
`CustomStyleSpan`: Move the class comment (it was misplaced)

## Changelog:

[INTERNAL] [FIXED] - `CustomStyleSpan`: Move the class comment

Pull Request resolved: facebook#42700

Reviewed By: yungsters

Differential Revision: D53195908

Pulled By: NickGerleman

fbshipit-source-id: f77575e16f76871dcf10d75448282b2166003412
Summary:
Pull Request resolved: facebook#42776

Changelog: [Internal] set all monorepo packages (including react-native) to one version and update all inter-dependencies (including the template)

Reviewed By: huntie

Differential Revision: D53251917

fbshipit-source-id: 95330ca66dcb7234a3f09752ecc3ed9087ced4bf
Summary:
Pull Request resolved: facebook#42719

The task T175989432 started firing on October 30 2020, which correspond to the landing of D24512203. I believe disabling CustomDrawOrder could be a potential cause of T175989432, that's why in this diff I'm creating an experiment to understand what is the impact (negative or positive) of re-enabling CustomDrawOrder in RN Android

Original diff: D24512203

Changelog: [Internal] internal

Reviewed By: javache

Differential Revision: D53150292

fbshipit-source-id: f0abbc7d175c2cd717ce87bbe69aeaf3db0b0e5c
Summary:
Pull Request resolved: facebook#42721

If left and right are swapped, this code assumes every yoga layoutable shadownode is a view, and mutates its props as if they were ViewProps. This is not safe, and could lead to memory corruption.

Changelog: [Internal]

Reviewed By: rozele

Differential Revision: D53213652

fbshipit-source-id: c43e0f80fdd5889761317c1243ccc0ab392e3443
Summary:
Pull Request resolved: facebook#42748

React Native has globally enabled RTTI within `rn_xplat_cxx_library`, ahead of RTTI being forced on (regardless of flag) in Android apps (it was previously enabled everywhere but Android, which has caused us no small share of headaches, with public JSI APIs designed around clients using RTTI).

This diff:
1. Mechanically replaces usages of `traitCast` with equivalent calls to `dynamic_cast` or `dynamic_pointer_cast`
    1. These have similar semantics as current iteration of `traitCast`, where we return `nullptr` for pointer form, or throw on invalid cast for reference form.
2. Removes `IdentifierTrait` as a requirement to cast to a ShadowNode
3. Removes the ShadowNode traits used solely as cast identities

This enables consistent usage of `dynamic_cast` (including for user defined ShadowNodes), and also exposes some places where `traitCast` allowed implicit const conversion.

The OSS builds should already have RTTI on, and will be able to use `dynamic_cast` on RN provided types (`traitCast` is not extendable).

Changelog:
[General][Breaking] - Delete traitCast and identifier traits

Reviewed By: sammy-SC

Differential Revision: D53215009

fbshipit-source-id: d20cbf66b725f5565fa5d03332010d87f2b08b61
Summary:
Pull Request resolved: facebook#42777

During view preallocation eventEmitter information is not being passed to the platform. This causes bugs with emision of events during initial rendering when using the new Fabric Event dispatching system.

e.g. Rendering a TextInput that has 'onFocus' event and also has autoFocus enabled.

The new Fabric Event dispatching system dispatch events earlier (this is expected)

In this diff I'm fixing this issue by ensuring that all preallocated views have an eventEmitter (when its shadowNode has an eventEmitter)

This was actually implemented in the past, but in order to optimize, we run an experiment (D29117957) and it was later deleted.
(D40356386). I didn't find details of the results of the experiment.
We could run another experiment to understand potential negative perf impact of this change, although I believe it's the right thing to do here.

Changelog: [Android][Fixed] Fix delivery of events during initial rendering in new architecture

Reviewed By: sammy-SC

Differential Revision: D53108114

fbshipit-source-id: 0b56b7495db63e4a478f4b34e91f4bcbf452ef92
…act-native.config.js (facebook#42771)

Summary:
Pull Request resolved: facebook#42771

This feature was first introduced here facebook#34580
And then removed here facebook#41654
The motivation for its removing was that Node resolver should handle all those cases for which `react-native.config.js` was used. But it turns out that it fails for the setup that `react-native-builder-bob` has.
This diff brings back support for defining external libraries in `react-native.config.js`.

Changelog: [iOS][Fixed] - Bring back support for defining external libraries in react-native.config.js

Reviewed By: cipolleschi

Differential Revision: D53267857

fbshipit-source-id: 7625dfe7b4a4651eb60eaec725f94f222a244e30
Summary:
Pull Request resolved: facebook#42781

Change in [31cf4c4](facebook@31cf4c4) broke the template for bridgeless as we changed the signature of a method in the header of `RCTAppDelegate`.

This change aligns the API between RCTAppDelegate and the template's AppDelegate

## Changelog:
[iOS][Fixed] - Align the the bundleURL API from `RCTAppDelegate` to template's `AppDelegate`

Reviewed By: cortinico, dmytrorykun

Differential Revision: D53274434

fbshipit-source-id: 25bad702ba05db2e3a6a9449abbda7d8e2fdb8a0
Summary:
Pull Request resolved: facebook#42774

Reorganise release scripts so that command entry points are grouped based on execution context, which also reflects dependencies between scripts.

Also:

- Document the current behaviours of these scripts.
- Relocate utils out of the root contents.
- Replace `exec` call to `set-rn-version` script with function import.

NOTE: `yarn trigger-react-native-release` (documented command in release process) is unchanged, since this is aliased from `package.json`.

```
├── releases
│   ├── templates/
│   ├── utils/
│   ├── remove-new-arch-flags.js
│   ├── set-rn-version.js
│   └── update-template-package.js
├── releases-ci
│   ├── prepare-package-for-release.js
│   └── publish-npm.js
└── releases-local
    └── trigger-react-native-release.js
```

Changelog: [Internal]

Reviewed By: cipolleschi

Differential Revision: D53274341

fbshipit-source-id: eec2befc43e7a47fd821b2e2bcc818ddffbb6cf7
Summary:
On latest `main`, RN Tester was crashing for me just after loading the JS bundle with `java.lang.UnsatisfiedLinkError: dlopen failed: library "libreactfeatureflagsjni.so" not found`

It seems to be named `featureflagsjni` instead in [here](https://github.com/facebook/react-native/blob/main/packages/react-native/ReactAndroid/src/main/jni/react/featureflags/CMakeLists.txt#L11)

## Changelog:

No changelog needed

Pull Request resolved: facebook#42770

Test Plan:
```bash
./gradlew :packages:rn-tester:android:app:installHermesDebug -PreactNativeArchitectures=arm64-v8a
```

Then run the app, the app was crashing before the fix, not crashing now

Reviewed By: javache

Differential Revision: D53268873

Pulled By: cortinico

fbshipit-source-id: f098ca12baadab358f72b1c9d5720123248b8e1a
Summary:
Pull Request resolved: facebook#42783

This change will fix the publishing of Nightlies for React Native with the right version

## Changelog:
[Internal] - Update the package.json of react native correctly.

Reviewed By: cortinico, huntie

Differential Revision: D53309082

fbshipit-source-id: 2fa4d4fdf4f984603c6b3d3690fa3c464ee6d030
Summary:
![image](https://github.com/facebook/react-native/assets/5061845/557c51fd-e675-4d36-b85d-f9367b44dfda)
cc. cortinico

## Changelog:

[ANDROID] [FIXED] - Fixes Android compile failed.

Pull Request resolved: facebook#42787

Test Plan: N/A

Reviewed By: cipolleschi

Differential Revision: D53312698

Pulled By: cortinico

fbshipit-source-id: 29fdd1957c2310cef9b7aca06b09b5691176ea58
Summary:
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: facebook#42741

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

Reviewed By: javache

Differential Revision: D53279501

Pulled By: cortinico

fbshipit-source-id: 491fc062421da7e05b78dc818b22cd1ee79af791
Summary:
Pull Request resolved: facebook#42635

Changelog: [Internal]

Adds a RuntimeAgent interface to the modern CDP backend, plus an `InstanceTargetDelegate::createRuntimeAgent()` method. This allows the RN integration to provide an engine-specific CDP implementation.

This diff includes all the plumbing in Bridge and Bridgeless to route `createRuntimeAgent()` calls to the right place - ending up at `JSExecutor::createRuntimeAgent()` and `JSIRuntimeHolder::createInspectorAgent` respectively - at which point we currently return `nullptr` to signify that JS debugging isn't supported.

## Next steps

In upcoming diffs we'll add concrete implementations of `RuntimeAgent`, and teach both Bridge and Bridgeless to create them as appropriate:

* `HermesRuntimeAgent` for Hermes
* `FallbackRuntimeAgent` for all other JS engines (JSI or not)

We'll also (likely) add assertions to ensure that any JSI runtime that reports itself as "inspectable" (a flag used to control some of the in-app debugging UI) comes with a non-default `createRuntimeAgent()` implementation. We avoid this for now to prevent crashing the modern backend on Hermes.

NOTE: Like the rest of the modern CDP backend, the `RuntimeAgent` API is 100% experimental and subject to change without notice. A *future* version of this API will allow out-of-tree JSI engines to integrate with the modern CDP backend. Either way, it is intended strictly for the use case of integrating with a JS engine, not for adding any other framework-level CDP functionality.

Reviewed By: huntie

Differential Revision: D51231326

fbshipit-source-id: 81e87c5134df73cc4aac0f9d5793a5236b5720d6
…ok#42746)

Summary:
Pull Request resolved: facebook#42746

Changelog: [Internal]

Formally introduces the concept of "session state" to the modern CDP backend, with the simplest possible implementation:

* `PageTargetSession` has a mutable `SessionState` member.
* All agents receive the same `SessionState&` in their constructor (with `SessionState`'s lifetime being the caller's responsibility).
* It's only legal to read/write to `SessionState` on the thread where requests are handled and Agents are created (the "main" thread).
* Agents are expected to play nice and not clobber each other's state in `SessionState`; this is *not* protected with visibility or `const`ness, however.
  * We'll probably want to come up with some API-level mechanism to control this as the complexity of our agents grows.

## Current use case: `<Domain>.enable`

The first use case for session state is to let `PageAgent` manage the `Log.enable` and `Runtime.enable` state for the session. This will allow agents created later in the session (or recreated as part of a reload) to emit Log and Runtime notifications without waiting for additional `enable` messages (that the client is not required to send).

We'll likely want to generalise this design to arbitrary domains in some way (e.g. add a top-level domain router that agents register with explicitly?) but I went with the simplest implementation for our current needs.

NOTE: The CDP spec doesn't state this explicitly, but it's clear from Chrome's behaviour that a `<Domain>.enable` command is intended to be session-scoped and survive reloads.

## Future use case: Instance/Runtime state persistence

The `<Domain>.enable` use case could have been solved with passing *immutable* state to Agents (`const SessionState&`). We make the state mutable in anticipation of `HermesRuntimeAgent` needing to store its own state in the session down the line, which we know is going to be needed in order for breakpoints to survive reloads.

Agents that never need to mutate state SHOULD only store this as a const reference.

Reviewed By: huntie

Differential Revision: D53006916

fbshipit-source-id: a0443c507294faa94efdf25b2f1670129774dc78
Summary:
Pull Request resolved: facebook#42745

Changelog: [Internal]

Creates the `FallbackRuntimeAgent` class and uses it (as the name would suggest) as a fallback in cases where no other suitable `RuntimeAgent` implementation is available.

`FallbackRuntimeAgent`'s only feature is logging a message explaining that the runtime isn't debuggable. In the final product, users shouldn't get this far into launching the debugger if they're not using a compatible engine like Hermes, but this is a nice touch in case they do. (It's also useful for testing while we're working on landing the actual Hermes integration.)

Reviewed By: huntie

Differential Revision: D51449229

fbshipit-source-id: 3b3455a8b482b33bccbb6cc90083aad15052a3e5
Summary:
Pull Request resolved: facebook#42789

I stumbled upon the JSDoc in the [ActivityIndicator](https://fburl.com/code/aq8ljc86) component and noticed a discrepancy wrt our [website](https://reactnative.dev/docs/activityindicator).

So I looked more and found out that the doc is not really generated from the code (even though there is a confusing `generate-docs`) but actually lives in the react-native-website [codebase](https://github.com/facebook/react-native-website/blob/994cab25b63d4bed57cedfba95f0133537d42ac7/docs/activityindicator.md?plain=1#L6).

Here I'm just aligning the JSDoc to the source of truth (i.e. react-native-website) but this begs the question on whether there is any value in keeping both.

Changelog: [Internal]

Reviewed By: lunaleaps

Differential Revision: D53307738

fbshipit-source-id: b01691460714687f35f875ec51c310333b667fc8
…cebook#42791)

Summary:
Pull Request resolved: facebook#42791

Original commit changeset: 491fc062421d

Original Phabricator Diff: D53279501

Reviewed By: mdvacca

Differential Revision: D53321360

fbshipit-source-id: 36ce929250077a9c2919ba7f01d937dc09986ec8
Summary:
Pull Request resolved: facebook#42794

As mentioned also in D53307738, `generate-docs` doesn't seem to be used.

Changelog: [Internal]

Reviewed By: christophpurrer

Differential Revision: D53308808

fbshipit-source-id: c2504c36d42a508621572a237964ff51cff75e70
Summary:
Pull Request resolved: facebook#42795

As per title.

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D53308758

fbshipit-source-id: 7efb2f5c6ac4aad54082a12cdcff13e9445fff58
…acebook#42773)

Summary:
The previous typing of FlatList and VirtualizedList did not convey any information on the type of the items passed in to `onViewableItemsChanged`, but instead the type was set to `any`. This PR adds the type information.

I set a default type `any` for thy ViewToken, because the type is exported and not having it would be a breaking change if that type is used. Like this it gracefully falls back to the default behavior of the `any` type.

Notice: I don't know how typing in "flow" works, but the same "issue" seems to be in there as well. Maybe someone with more flow experience can fix that as well:
https://github.com/facebook/react-native/blob/ae42e0202de2c3db489caf63839fced7b52efc5d/packages/virtualized-lists/Lists/ViewabilityHelper.js#L19-L20

## Changelog:

[GENERAL] [FIXED] - Add type information for items of VirtualizedList in `onViewableItemsChanged` signature
[GENERAL] [FIXED] - Add type information for items of FlatList in `onViewableItemsChanged` signature

Pull Request resolved: facebook#42773

Test Plan:
Without the changes, typecheck of the project was fine, but with the changes applied to the node_modules/react-native copy a type error was found:
```
$ npm run typecheck

> my-project@1.0.0 typecheck
> tsc --skipLibCheck

src/MyComponent.tsx:385:29 - error TS2345: Argument of type '(string | number)[]' is not assignable to parameter of type 'number[]'.
  Type 'string | number' is not assignable to type 'number'.
    Type 'string' is not assignable to type 'number'.

385                             viewableItems
                                ~~~~~~~~~~~~~
386                                 .filter(
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```

Reviewed By: rozele

Differential Revision: D53276749

Pulled By: NickGerleman

fbshipit-source-id: 3fa5c65b388a59942c106286ac502a85c583da50
…book#42798)

Summary:
Pull Request resolved: facebook#42798

Bump hermes-parser and related packages to [0.19.0](https://github.com/facebook/hermes/blob/main/tools/hermes-parser/js/CHANGELOG.md).

Changelog: [internal]

Reviewed By: mvitousek, SamChou19815

Differential Revision: D53330004

fbshipit-source-id: c20ef324ac2a295c3f42fa6bbe1dbbf816146ccb
Summary:
This PR removes the TypeScript entry for `UIManager.takeSnapshot()`. This function does not appear to be implemented anywhere, and calling it throws `TypeError: _reactNative.UIManager.takeSnapshot is not a function (it is undefined)`.

I think this functionality is still supported by [react-native-view-shot](https://github.com/gre/react-native-view-shot) for anyone who needs it!

## 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
-->
[General] [Removed] - Removed type definition `UIManager.takeSnapshot()`

Pull Request resolved: facebook#42779

Test Plan: Ran TypeScript checks.

Reviewed By: cipolleschi

Differential Revision: D53307137

Pulled By: NickGerleman

fbshipit-source-id: 2e65c58c77bcde4f36f5065295d15757c519239d
…ce to 0.19.0

Differential Revision:
D53330004

Original commit changeset: c20ef324ac2a

Original Phabricator Diff: D53330004

fbshipit-source-id: 4953b2ff66fd3d8ad31dae7fa4c72e92ebef6a8c
Summary:
Pull Request resolved: facebook#42796

As per title.

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D53308084

fbshipit-source-id: 872f828b8dc019e65cd32549f9633efb6cde18f5
…iOS without changing Text baseline (Paper - old arch) (facebook#38359)

Summary:
This PR fixes visual regression introduced with facebook#37465 (comment)

Adding paragraphStyle.maximumLineHeight to a iOS UITextField displays the text under the UITextField ([ios-screenshot-1][1], [ios-screenshot-2][2], [ios-screenshot-3][3]).

The PR implements the logic from RCTTextShadowView [#postprocessAttributedText](https://github.com/facebook/react-native/blob/9ab27e8895d6934e72ebdc601d169578ab9628f1/packages/react-native/Libraries/Text/Text/RCTTextShadowView.m#L165-L167) in RCTBaseTextInpuShadowView [#uiManagerWillPerformMounting](https://github.com/facebook/react-native/blob/4c944540f732c6055d447ecaf37d5c8f3eec1bc4/packages/react-native/Libraries/Text/TextInput/RCTBaseTextInputShadowView.m#L130-L192).

[1]: https://user-images.githubusercontent.com/24992535/238834159-566f7eef-ea2d-4fd4-a519-099b0a12046c.png "ios-screenshot-1"
[2]: https://user-images.githubusercontent.com/24992535/238834184-feb454a9-6504-4832-aec8-989f1d027861.png "ios-screenshot-2"
[3]: https://user-images.githubusercontent.com/24992535/238834283-cf572f94-a641-4790-92bf-bbe43afb1443.png "ios-screenshot-3"

[4]: https://github.com/Expensify/App/assets/24992535/06726b45-7e35-4003-9fcc-50c8d0dff0f6
[5]: https://github.com/Expensify/App/assets/24992535/d9745d29-8863-4170-bcc3-e78fa7e550d2

fixes facebook#28012 fixes facebook#33986
Related facebook#35741 facebook#31112

## Changelog:

[IOS] [FIXED] - Fix TextInput vertical alignment issue when using lineHeight prop on iOS without changing Text baseline (Paper - old arch)

Pull Request resolved: facebook#38359

Test Plan: Extensive test included in the PR comments facebook#37465 (comment) and Expensify/App#17767 (comment)

Reviewed By: cipolleschi

Differential Revision: D52325261

Pulled By: dmytrorykun

fbshipit-source-id: d072a598bfaafbbffc41005b1fda1795cf3d8ab9
)

Summary:
Pull Request resolved: facebook#42724

All these classes are NullSafe, let's mark them as NullSafe(Local) to ensure lint detect errors in the future

changelog: [internal] internal

Reviewed By: NickGerleman

Differential Revision: D53200100

fbshipit-source-id: e6355af332c601e0d61e698d2fa0506c6a293989
cortinico and others added 14 commits February 19, 2024 08:15
Summary:
Pull Request resolved: facebook#43091

Fix typo in unit test

Changelog:
[Internal] [Changed] - Fix typo in unit test

Reviewed By: mdvacca

Differential Revision: D53918471

fbshipit-source-id: 0453c01fab1dc04397058577ea61b50994124cf0
Summary:
Pull Request resolved: facebook#43089

Changelog: [Internal]

Completes React Native's support for the [`Runtime.addBinding`](https://cdpstatus.reactnative.dev/devtools-protocol/tot/Runtime#method-addBinding) and [`Runtime.removeBinding`](https://cdpstatus.reactnative.dev/devtools-protocol/tot/Runtime#method-removeBinding) methods (in the modern CDP backend) by handling the optional `executionContextId` and `executionContextName` params.

Reviewed By: huntie

Differential Revision: D53760393

fbshipit-source-id: 1679fcde64c1125eb3f0f780432fedd6e3c2efc1
Summary:
Changelog: [Internal]

Ports RN's Hermes CDP integration tests to `TYPED_TEST` so we can easily run them against a different Hermes engine adapter in another diff.

bypass-github-export-checks

Reviewed By: huntie

Differential Revision: D53810359

fbshipit-source-id: fb9717bbdc1346ed26b9c8796c13bac641bc5a60
Summary:
Pull Request resolved: facebook#42801

Fixes some tech debug

Changelog: [Internal] [Fixed] Share re-defined defineReadOnlyGlobal(...)

Reviewed By: javache

Differential Revision: D53340274

fbshipit-source-id: 1f8021eae7403675bc045c8031af09718830c2fe
Summary:
Pull Request resolved: facebook#43054

Changelog: [iOS][Android][Added] Experimental macro to autolink C++ turbomodules

This implementation is inspired by RCT_EXPORT_MODULE on iOS. We keep a global data structure that maps module names to a lambda that returns the C++ turbomodule. This will come with a hit to startup time. the only way to avoid that is a solution that does static analysis of the list of C++ turbomodules being linked to the library.

Reviewed By: fkgozali

Differential Revision: D53602544

fbshipit-source-id: 8ea49fa576dc718f44b1595b68ab7c606c2db605
Summary:
Pull Request resolved: facebook#43098

Changelog: [Internal]

Wraps Hermes's `CDPHandler::getState()` API in an engine-agnostic abstraction (`RuntimeAgentDelegate::getExportedState`).

An Agent's lifetime ends when its Target is destroyed, but it can occasionally be useful to persist some state for the "next" Target+Agent of the same type (in the same session) to read.

`RuntimeAgentDelegate` is polymorphic and can't just write arbitrary data to SessionState. Instead, it can now *export* a state object that we'll store and pass to the next `RuntimeTargetDelegate::createAgentDelegate` call.

Reviewed By: huntie

Differential Revision: D53919696

fbshipit-source-id: a8e9b921bc8fc2d195c5dddea9537e6ead3d0358
Summary:
Changelog: [Internal]

TSIA

bypass-github-export-checks

Reviewed By: huntie

Differential Revision: D53919695

fbshipit-source-id: 54792111f075d9834a2b61de91251614ad5ce770
…acebook#43105)

Summary:
Pull Request resolved: facebook#43105

This is a quality of like improvement for the project we create for the final users.
Codegen generates code in `rncore`, within `node_modules`. This is not the perfect approach but it is working so far.

To make it more robust, we added a small script in React-Fabric podspec to check that codegen run properly when building.
In this way, if a user run `yarn install` and, for any reason, react-native is regenerated, we can provide a better DevX to our users with an actionable message on how to fix the build problem.

##Changelog
[iOS][Added] - Add error message if codegen has not run properly

Reviewed By: cortinico

Differential Revision: D53927788

fbshipit-source-id: a01a33086e4a0a1b0ada6c83283a5fd3fb5ee3eb
Summary:
De-duplicate the logic for counting attachments.

This is a minor improvement in the context of my multi-PR work on react-native-community/discussions-and-proposals#695.

## 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] [CHANGE] - De-duplicate the logic for counting attachments

Pull Request resolved: facebook#42596

Reviewed By: rshest

Differential Revision: D53917281

Pulled By: cipolleschi

fbshipit-source-id: cdb9bc834bddd7deffc60f33578464733982fedf
Summary:
Pull Request resolved: facebook#43106

Missed import in untyped, untested script during recent file move.

Changelog: [Internal]

Reviewed By: cipolleschi

Differential Revision: D53940160

fbshipit-source-id: ec86c5881a2f34d992538c713f808c8d5634ba16
Summary:
Pull Request resolved: facebook#43107

Changelog: [Internal]

Reviewed By: cipolleschi

Differential Revision: D53940161

fbshipit-source-id: 0de7887ff117db6f876420c1b609924bfc237847
Summary:
Pull Request resolved: facebook#43109

Changelog: [Internal]

Reviewed By: cipolleschi

Differential Revision: D53940616

fbshipit-source-id: 8ce85437ab5164dae81a9956706c517880ee1f74
Summary:
Pull Request resolved: facebook#43070

**Context**

The `codegenNativeComponent` function is a hint for the codegen that the file that contains it is a Native Component spec. Static ViewConfig codegen overwrites this function call by the generated ViewConfig.
If this function is not overwritten by the codegen, it has runtime behaviour that falls back to `requireNativeComponent`. At the time when this system was built `requireNativeComponent` was not supported in Bridgeless mode because it is relied on some Bridge-only functionality. That's why it outputs error in Bridgeless mode.
 ---

This is not the case any more, we now have interop layers which provide the functionality needed by `requireNativeComponent`.
The SVC codegen is implemented as [Babel plugin](https://github.com/facebook/react-native/tree/main/packages/babel-plugin-codegen). The are scenarios when it is not run for the native component specs:
- If the plugin is not used for whatever reason.
- If Babel is not used for whatever reason.

In order to not to regress the DevX for such cases, we've turned the error into the warning.

**Note:** we use `console.info('⚠️...` instead of `console.warn('...`. That's because `console.warn` also prints a stack trace in the console, and we didn't want to create too much noise.

Changelog: [General][Changed] - codegenNativeComponent show warning and not error if not code generated at build time.

Reviewed By: huntie, rshest

Differential Revision: D53761805

fbshipit-source-id: c924c7668e6d2e45b920672b8a309221be767a73
Summary:
Bump CLI version to 13.6.0

## Changelog:

[GENERAL] [CHANGED] - Bump CLI to 13.6.0

Pull Request resolved: facebook#43093

Test Plan: CI

Reviewed By: cipolleschi

Differential Revision: D53920559

Pulled By: cortinico

fbshipit-source-id: 7c95345f47c80864881fff7fce5adb35195ec723
@Saadnajmi Saadnajmi requested a review from a team as a code owner August 3, 2024 20:52
@Saadnajmi Saadnajmi changed the title Merge up to 0.74 branch commit Merge up to 0.74 branch cut commit Aug 3, 2024
@Saadnajmi Saadnajmi marked this pull request as draft August 6, 2024 06:58
@Saadnajmi Saadnajmi marked this pull request as ready for review August 6, 2024 07:52
Saadnajmi and others added 2 commits August 6, 2024 17:17
Co-authored-by: Alicia Drummond <7664112+FalseLobster@users.noreply.github.com>
@Saadnajmi Saadnajmi enabled auto-merge August 9, 2024 21:20
@Saadnajmi Saadnajmi merged commit 23a33f2 into microsoft:main Aug 9, 2024
@Saadnajmi Saadnajmi deleted the 74merge-redo branch August 9, 2024 21:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.